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

Raise errors when undefined query parameters are given #189

Open
petedmarsh opened this issue Jan 12, 2018 · 1 comment
Open

Raise errors when undefined query parameters are given #189

petedmarsh opened this issue Jan 12, 2018 · 1 comment

Comments

@petedmarsh
Copy link
Contributor

If a URL query parameter is part of a URL but is not defined in the schema then no error is raised, e.g.

The following schema

/get/{id}/:
    get:
      summary: An Example
      description: ''
      produces:
        - application/json
      parameters:
        - in: path
          name: id
          description: ''
          required: true
          type: integer
      responses:
        200:
          description: ''

would not generate errors for the URL http://example.org/get/213?some_query_param=123

I think this can be implemented simply by checking the given list of parameters vs the defned validators in: https://github.com/pipermerriam/flex/blob/master/flex/validation/parameter.py#L98.

However, I am not 100% sure this is the correct behaviour as defined by the specification (i.e. I think it's right to raise errors query parameters undefined in the schema have been passed but I can't see this behaviour dictated in the spec). I'm happy to add this validation (even if it is an opt-in feature).

@jkblume
Copy link

jkblume commented May 31, 2018

I am facing the same "problem". I expected the same behavior as @petedmarsh proposes. The documentation says this gets validated

Request validation looks at the following things.

  1. Request path.
  2. Parameters in the path.
  3. Query parameters.
  4. Request method.
  5. Headers.
  6. Content Type

What do you think about this feature?

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