You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A brief description of the bug. Provide either a screenshot or the full error message
When we use the --path-params-as-types flag with openapi-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">'.
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)
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.
While doing so, I also think I figured out why it's happening. Unclear tho if this is because we structure our endpoints incorrectly or if it's just an edge-case that is not covered by openapi-fetch/openapi-typescript.
The paths "/api/sessions/create" and [path: `/api/sessions/${string}`] most likely collide because /create can also match the /${string} path.
EDIT: I now see the error is different, give me a minute to push updated.
EDIT TWO: Nvm, will take a while to figure it out. It's something else. Will post when ready.
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: