Skip to content

Raise errors when undefined query parameters are given #189

@petedmarsh

Description

@petedmarsh

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions