ErikWittern / openapi-snippet

Generates code snippets for given Swagger / Open API documents
MIT License
116 stars 67 forks source link

Fix support for params to have a schema #35

Closed codyaray closed 4 years ago

codyaray commented 4 years ago

We have a param that looks like this:

{
  name: 'email',
  in: 'query',
  required: false,
  schema: { '$ref': '#/components/schemas/SearchFilter' },
  example: 'marty.mcfly@example.com',
  description: 'Filter the results by a partial search of email.'
}

We just need to dereference the schema if its provided this way.

Added a unit test case too. Unfortunately none of the existing samples have this usage, so I just inlined one.

ErikWittern commented 4 years ago

@codyaray I think this is now addressed by https://github.com/ErikWittern/openapi-snippet/pull/39

If not, we can reopen this.