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

KeyError: None when all parameters are in: query #358

Open
caffeinatedMike opened this issue Jan 23, 2020 · 0 comments
Open

KeyError: None when all parameters are in: query #358

caffeinatedMike opened this issue Jan 23, 2020 · 0 comments

Comments

@caffeinatedMike
Copy link

Using 'uiversion': 3 and openapi: 3.0.1

Using the following yaml

/brand:
    post:
      tags:
      - Brands
      summary: Create a new brand
      description: Parameters can be provided in the query for quick brand adding
      operationId: postBrand
      parameters:
      - name: name
        in: query
        required: true
        schema:
          type: string
      - name: status
        in: query
        required: true
        schema:
          type: string
          enum:
          - active
          - disabled
      responses:
        200:
          description: Brand created
          content: {}
        401:
          description: Invalid token supplied
          content: {}

I receive the following error

127.0.0.1 - - [23/Jan/2020 18:33:24] "�[1m�[35mPOST /brand?name=test&status=active HTTP/1.1�[0m" 500 -
Traceback (most recent call last):
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_restful\__init__.py", line 269, in error_router
    return original_handler(e)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\_compat.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_restful\__init__.py", line 269, in error_router
    return original_handler(e)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\_compat.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1947, in full_dispatch_request
    rv = self.preprocess_request()
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 2241, in preprocess_request
    rv = func()
  File "C:\Users\mhill\AppData\Local\Programs\Python\Python37\lib\site-packages\flasgger\base.py", line 631, in before_request
    param.get('type', None)],
KeyError: None

However, if I change the two parameters to in: path the same request succeeds. How can I fix this? I need to be able to use query parameters, not path parameters with the number of parameters some of my routes require.

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 a pull request may close this issue.

1 participant