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

oas-valdiator "in: query" is ok, when its actually path #79

Closed
2 tasks done
philsturgeon opened this issue Jul 18, 2018 · 7 comments
Closed
2 tasks done

oas-valdiator "in: query" is ok, when its actually path #79

philsturgeon opened this issue Jul 18, 2018 · 7 comments

Comments

@philsturgeon
Copy link

Swagger Editor reports a semantic error for parameters which are marked as query but are defined in the URI template as part of the path.

Semantic error at paths./v3/companies/{company_id}/seats/{uuid}
Declared path parameter "uuid" needs to be defined as a path parameter at either the path or operation level

Checklist

  • Conversion: I have checked my source definition is valid OpenAPI 3.0
  • Validation: I believe my source definition is invalid OpenAPI 3.0.x but the validator does not complain
  '/v3/companies/{company_id}/seats/{uuid}':
    parameters:
      - name: company_id
        in: path
        description: Company UUID
        example: 6bc8bb80-1e32-0136-eb32-0242ac11530c
        schema:
          type: string
          format: UUID
        required: true
      - name: uuid
        in: query
        description: User UUID
        example: '123456'
        schema:
          type: string
          format: uuid
        required: true
@MikeRalphson
Copy link
Contributor

Fixed case where this existing check was not being executed when the operation did not have any parameters of its own. The code is still done as part of the operation validation, so if the path has no operations (as literally in your example above) then it still won't flag as an error. I think that limitation is worth not duplicating the code for now.

@philsturgeon
Copy link
Author

Thanks for a fix! I think the complete resolution to this would be having it check "Hey um you said this was in the query but uggghhhhh it's in the path..."

@MikeRalphson
Copy link
Contributor

It checks both ways, that all path parameters exist in the path value, and all templated components in the path value exist as path parameters. Thus extraneous query (or elsewhere) parameters don't come into it / need to be checked.

@MikeRalphson
Copy link
Contributor

E.g. you can have the same parameter name in path and in query so that extra checking would be complex.

@philsturgeon
Copy link
Author

Ah, im just trying to figure out the discrepency between this validator and whatever Swagger Editor is doing. Folks keep raising concerns about Speccy when the answers from both systems are different.

@MikeRalphson
Copy link
Contributor

Fix above should resolve it, except in the case there are no operations at all on a path.

@philsturgeon
Copy link
Author

Fantastic! Thank you :)

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

No branches or pull requests

2 participants