Skip to content
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

--make-paths-enum generate enum with another paths #950

Closed
Semigradsky opened this issue Oct 5, 2022 · 4 comments · Fixed by #951
Closed

--make-paths-enum generate enum with another paths #950

Semigradsky opened this issue Oct 5, 2022 · 4 comments · Fixed by #951

Comments

@Semigradsky
Copy link
Contributor

For example, it generates

export interface paths {
  '/download/{p1}': {
    // ...
  },
}

export enum ApiPaths {
  getDownload: '/download/:p1',
}

So I can't choose type:

type X = paths[ApiPaths.getDownload] // error

As I see, that is why paths in export interface paths { and export enum ApiPaths { are different:
https://github.com/drwpow/openapi-typescript/blob/a4e05fa005277ea1e42eb191921aae5d9f51293a/src/transform/paths.ts#L127-L128

@berzi hi! Could you answer if this change is needed?

@Semigradsky
Copy link
Contributor Author

@drwpow or it can be customized by option...

@drwpow
Copy link
Contributor

drwpow commented Oct 29, 2022

This makes sense to me! Thanks for making this change.

@Semigradsky
Copy link
Contributor Author

@drwpow is it possible to release this in 5.x version? As I see this feature was totally removed in 6.x

@insertmike
Copy link
Contributor

This was somewhat broken again?? @drwpow

insertmike referenced this issue Feb 13, 2025
…2052)

* feat: brings back --make-paths-enum option to generate ApiPaths enum

* chore: adds --make-paths-enum flag to cli docs

* chore: adds minor changeset for

* tests: adds tests for --make-paths-enum option and paths-enum.ts transformer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants