Suppose we have the following routes (in form operationName=route path):
getTopScoredPosts=/posts/top-scored
getPostById=/posts/{postId}
Operations are sorted by operationId like below:
ops.sort((one, another) -> ObjectUtils.compare(one.operationId, another.operationId));
|
ops.sort((one, another) -> ObjectUtils.compare(one.operationId, another.operationId)); |
When generating server, routes are going to be registered with a router (like express) in the following order:
getPostById=/posts/{postId}
getTopScoredPosts=/posts/top-scored
```
This leads to an issue where requests like `GET /posts/top-scored` will be actually matched by `GET /posts/{postId}` route handler.
The simplest solution is to avoid sorting operations and have them in order as they are defined in the opeanpi doc.
Suppose we have the following routes (in form operationName=route path):
Operations are sorted by operationId like below:
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
Line 604 in 1b60ee1
When generating server, routes are going to be registered with a router (like express) in the following order: