-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Argument of type '"/example/post-endpoint"' is not assignable to parameter of type 'PathsWithMethod<paths, "post">' #2021
Comments
Hi @ViktorPontinen! Could you provide an OpenAPI schema that result in the same behavior so we can reproduce your issue? |
Hi @kerwanp , I was finally able to reproduce it in a smaller scope, our real openapi yaml has almost 97k lines and is auto-generated. The paths Here is repo for reproduction, see EDIT: I now see the error is different, give me a minute to push updated. |
Hi, sorry for the long wait. I was able to narrow it down to the structure of our API, and the error Basically if you have a path like Reproduction repo: https://github.com/ViktorPontinen/open-api-bug Not sure if this something that should be solved on API design level or if open-api typescript/fetch can have built-in support for this structure. |
Could it be related to microsoft/TypeScript#21760 ? In the |
Unfortunately |
Description
A brief description of the bug. Provide either a screenshot or the full error message
When we use the
--path-params-as-types
flag withopenapi-typescript
to generate types, some post requests(seems to only affect post requests) stop being autocompleted/discovered and shows error:Argument of type '"/example/post-endpoint"' is not assignable to parameter of type 'PathsWithMethod<paths, "post">'
.Example(ignore the untyped body):
Without the
--path-params-as-types
flag, everything works as expected. Only difference I see in generated types is the adjustments to dynamic paths keys:[path: `/example/dynamic/${string}`]:
.Anyone else got same issue or just us?
Reproduction
How can this be reproduced / when did the error occur? Does the issue occur in a specific browser, or all browsers?
Not sure if reproducible in other repos, I guess try to regenerate your types with the
--path-params-as-types
flag. Will try to test outside our repo to test.Expected result
I think description covers it's all.
(in case it’s not obvious)
Checklist
The text was updated successfully, but these errors were encountered: