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

Exception raised on enum query parameters without "type" #106

Open
letmaik opened this issue Jan 12, 2021 · 0 comments
Open

Exception raised on enum query parameters without "type" #106

letmaik opened this issue Jan 12, 2021 · 0 comments

Comments

@letmaik
Copy link

letmaik commented Jan 12, 2021

JSON Schema does not require "type" to be present for enums, see also https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values.

The plugin however requires it for all query parameter schemas:

for param in filter(lambda p: p['in'] == 'query', parameters):
yield indent + ':query {type} {name}:'.format(
type=param['schema']['type'],
name=param['name'])

Sample error:

2021-01-12T14:38:38.9415027Z Exception occurred:
2021-01-12T14:38:38.9416063Z   File "/__w/1/s/env/lib/python3.8/site-packages/sphinxcontrib/openapi/openapi30.py", line 281, in _httpresource
2021-01-12T14:38:38.9416591Z     type=param['schema']['type'],
2021-01-12T14:38:38.9416959Z KeyError: 'type'

Sample parameter:

          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "PENDING",
                "TRUSTED",
                "RETIRED"
              ]
            }
          }
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

1 participant