Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing validators for referencing parameters #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix missing validators for referencing parameters #65

wants to merge 2 commits into from

Conversation

gotchazipc
Copy link

fix to solve #40

  • moved merge logic into validators, removing temporal map in builder
  • added testcase and fixed some tests for the added path in pets.json

If some parameters has only $ref without name or in, builder overwrites the parameters in raw object with same key, NaN (undefined + undefined). So, merging should be done after resolving references.

김중훈 added 2 commits June 22, 2016 02:49
 - moved merge logic into validators, removing temporal map
 - added testcase and fixed some tests for added path in pets.json
@subeeshcbabu-zz
Copy link
Member

Like the idea of using the resolved $ref. However the operation level parameters should be overriding the path level (applicable for all the operations) parameters. The concat here - https://github.com/krakenjs/swaggerize-routes/pull/65/files#diff-2d057fabb5adb84befefd4c50a8edc6bL64 - simply adds the duplicates as well, I think.

@gotchazipc
Copy link
Author

Actually, the validators for operation level parameters, made in validators.js, overwrites the validators for path level parameters in validators#makeAll(). Because, input parameters are just built with concat (def.parameters, operation.parameters) and they are checked with forEach().

Since new logic does not use 'name' nor 'in' before calling makeAll(), eleminating 'to-be-overrided' parameters (not to build unused validators) seems to be a liitle bit hard. Is there any property that can be used to check?

Copy link

@shattar shattar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please accept this pull request.

@subeeshcbabu-zz
Copy link
Member

How about passing both def.parameters and operation.parameters to makeAll , instead of concat?
Then we will be able to call make for all the parameters and construct the final validator array/list by using the unique key combination of name and in

@subeeshcbabu-zz
Copy link
Member

@gotchazipc - How about passing both def.parameters and operation.parameters to makeAll , instead of concat?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants