ErikWittern / openapi-snippet

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

Fixing support for schema references in parameters. #39

Closed vpillinger closed 4 years ago

vpillinger commented 4 years ago

This is a recreation of PR #27 that fixes #26, but with tests and merge-able. I believe it also accomplishes the goal of #35?

An additional point of concern:

I also noticed that the generated snippets with this just say qs: {pet: 'SOME_OBJECT_VALUE'} instead of giving a full example/generation of the object.

Is this an issue/improvement that needs to be made, or is my test case missing something in order to get that to work?

Either way, it seems like an issue for a different PR but I would like some clarification on this.

ErikWittern commented 4 years ago

@vpillinger Thank you for that PR!

I agree, this successfully revives #27, and it does address #26.

I also think this fixes #35 (@codyaray)

Giving a better example than 'SOME_OBJECT_VALUE' is not yet supported. I think this may warrant a new, dedicated issue (and eventually PR). However, one concern I have is that there are different encoding styles for query strings, especially when dealing with objects / arrays - so the question becomes which one to use? My personal opinion is that relying on a popular library like https://www.npmjs.com/package/qs to handle the encoding (using default settings) may be a way to go.

For now, thanks for the PR, I will accept and create a new version.