Skip to content

Commit 929f8ec

Browse files
committed
[python-fastapi] Fix: Skip sorting of path operations (#22163)
Make use of helpful code added in 243f501 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: #22163
1 parent 40b9d69 commit 929f8ec

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public String getHelp() {
8989
public PythonFastAPIServerCodegen() {
9090
super();
9191

92+
// Skip sorting of operations to preserve the order found in the OpenAPI spec file. See
93+
// https://fastapi.tiangolo.com/tutorial/path-params/?h=path#order-matters for details on why order matters.
94+
LOGGER.info("Skipping sorting of path operations, order matters, let the developer decide via their specification file.");
95+
setSkipSortingOperations(true);
96+
9297
modifyFeatureSet(features -> features.includeSecurityFeatures(
9398
SecurityFeature.OAuth2_AuthorizationCode,
9499
SecurityFeature.OAuth2_Password

0 commit comments

Comments
 (0)