-
-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect enum ApiPaths members when parametrized paths #2194
Comments
It looks like https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/src/transform/paths-enum.ts#L34-L35 is the root cause. |
@wgebczyk @wgebczyk |
@theo-staizen Probably we misunderstood each other. I'm not referring to use of The only case that it might help in above case is to use postprocessing to find out generated enum, parse it's values (not names/identifiers for it's values) and try manually prepare/guess ... or maybe I'm misreading issue and your suggestion... |
@wgebczyk Oh I see, yes I did misunderstand your question. Lucky for you, I did run across that issue as well, which I fixed by adding an {
"paths": {
"/ActivityLogs/staff/{id}": {
"get": {
"tags": [
"ActivityLogs"
],
"operationId": "ActivityLogs_GetByStaffId",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"default": 100
}
},
{
"name": "cursor",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
} P.s: The issue template mentions linting your scheme using the |
Uhm... yeah... Just reading sources :) Probably I should stop being lazy and manually define all operations with ID and would be fine. Still some error during generation would be helpful , like: |
openapi-typescript version
7.6.1
Node.js version
23.9.0
OS + version
win11
Description
Hey!
It seems that code that generates ApiPath enum incorrectly tries to deduplicate enum identifiers when paths differs on params. This is as well visible when path has multple params of various level of reusing parameter names.
Reproduction
Small open ap spec
command line:
output:
Expected result
not have same enum member identifiers
Required
npx @redocly/cli@latest lint
)Extra
The text was updated successfully, but these errors were encountered: