forked from loafle/openapi-generator-original
* [python-fastapi] Fix: Skip sorting of path operations (#22163)
Make use of helpful code added in
243f501aef to skip sorting of path
parameters. In FastAPI, order matters, see link for details:
https://fastapi.tiangolo.com/tutorial/path-params/?h=path#order-matters
Issue: https://github.com/OpenAPITools/openapi-generator/issues/22163
* Update samples after previous commit
Reading comprehension is hard. I missed the part of step 3 where
samples would be updated in response to the change I had previous
submitted.
Via this commit, update samples to match expectations. The order of
various endpoint implementations is now changed in the sample, matchcing
the order in the yaml files that created them.
OpenAPI generated FastAPI server
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Generator version: 7.17.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonFastAPIServerCodegen
Requirements.
Python >= 3.7
Installation & Usage
To run the server, please execute the following from the root directory:
pip3 install -r requirements.txt
PYTHONPATH=src uvicorn openapi_server.main:app --host 0.0.0.0 --port 8080
and open your browser at http://localhost:8080/docs/ to see the docs.
Running with Docker
To run the server on a Docker container, please execute the following from the root directory:
docker compose up --build
Tests
To run the tests:
pip3 install pytest
PYTHONPATH=src pytest tests