openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

--make-paths-enum renames the paths URL

Open semanser opened this issue 10 months ago • 3 comments

openapi-typescript version

7.5.2

Node.js version

20.12.1

OS + version

macOS 15.1.1

Description

This is basically exactly the same issue as described here https://github.com/openapi-ts/openapi-typescript/issues/950. It seems like the bug was added back here https://github.com/openapi-ts/openapi-typescript/pull/2052 when implementing this feature again for the v7.

In short, the ApiPaths urls are getting renamed like so /persons/{id} -> /persons/:id, which shouldn't happen.

The line that needs to be fixed is this:

https://github.com/openapi-ts/openapi-typescript/blob/7d6e896f915e333aa1fc6cfee1db24e4a1ad40af/packages/openapi-typescript/src/transform/paths-enum.ts#L34-L35

See this PR https://github.com/openapi-ts/openapi-typescript/pull/951 on how it was fixed before.

Let me know if you want me to open the PR. Thanks!

Reproduction

See this PR https://github.com/openapi-ts/openapi-typescript/issues/950

Expected result

Ths URLs in both paths and ApiPaths should be identical.

Required

  • [X] My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

semanser avatar Jan 13 '25 17:01 semanser

Great investigative work! Yes would love a PR for this, thank you 🙏

drwpow avatar Jan 25 '25 23:01 drwpow

Is there any updates here? @drwpow @semanser , this is pretty much blocking me

insertmike avatar Feb 13 '25 15:02 insertmike

+1

Is there any updates here? @drwpow @semanser , this is pretty much blocking me

Yep, it did block us too. Solved it with sed -E -i 's|/:([^/"]+)|/{\1}|g' api.ts for the time being

reflexxion avatar Mar 06 '25 07:03 reflexxion