You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have two endpoints in the open API spec that have a similar routing path, then connexion gets confused and adds the same validation to both endpoints.
In the example below we have two endpoints:
/v1/{first}/{last}
/v1/bye/{param1}
Both take string parameters but the hello also expects a header. When running this, we can see that connexion expects both endpoints to have the header, which is incorrect.
openapi: "3.0.3"info:title: Helloworld APIdescription: API defining the operations available in the Helloworld APIversion: 0.1.0servers:- url: "https://localhost/"description: Production API endpoint for the Hello World APIpaths:/v1/{first}/{last}:get:summary: Retrieve a greeting messageoperationId: asgi.get_greetparameters:- name: titlein: headerschema:type: stringrequired: true- name: firstin: pathschema:type: stringrequired: true- name: lastin: pathschema:type: stringrequired: trueresponses:
'200':description: A successful responsecontent:application/json:schema:type: objectproperties:message:type: stringexample: Hello, World!/v1/bye/{param1}:get:summary: Retrieve a greeting messageoperationId: asgi.get_byeparameters:- name: param1in: pathschema:type: stringrequired: trueresponses:
'200':description: A successful responsecontent:application/json:schema:type: objectproperties:message:type: stringexample: Hello, World!
Expected behaviour
Header Validation should only apply to the "hello" endpoint and not the "bye" endpoint.
Actual behaviour
# Correct validation
> curl -s localhost:8000/v1/alan/plonk -H 'title: mr'
"Hello mr alan plonk"
# Incorrect validation, title is not relevant for this endpoint
> curl -s localhost:8000/v1/bye/alan
{"type": "about:blank", "title": "Bad Request", "detail": "Missing header parameter 'title'", "status": 400}
# If header is passed, it works
> curl -s localhost:8000/v1/bye/alan -H 'title: mr'
"Goodbye alan"
Description
If we have two endpoints in the open API spec that have a similar routing path, then connexion gets confused and adds the same validation to both endpoints.
In the example below we have two endpoints:
/v1/{first}/{last}
/v1/bye/{param1}
Both take string parameters but the hello also expects a header. When running this, we can see that connexion expects both endpoints to have the header, which is incorrect.
Expected behaviour
Header Validation should only apply to the "hello" endpoint and not the "bye" endpoint.
Actual behaviour
Steps to reproduce
Create file called run.py
Run using
uvicorn run:app
Additional info:
Output of the commands:
The text was updated successfully, but these errors were encountered: