Open aiman-alsari opened 8 months ago
Just a note that this used to work on Connexion 2.x and is holding us up from migrating to Connexion 3
This is an issue with Starlette route priority. https://www.starlette.io/routing/#route-priority
The recommendation is to order the routes such that more specific (e.g. my bye example) routes are placed first. This however impacts the end-user of these APIs as it will then dictate the swagger-ui ordering.
I realise this isn't an issue with connexion per-se, but it does feel a little clunky.
I have found an acceptable workaround. If you use tags, swagger ui orders them alphabetically within the tag. I'm happy to close this as it is no longer a blocker, but I still think it's important to call this out for anyone upgrading from connexion 2.x as the behaviour is different.
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: