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

Allow TypeMapping (without transformation) #341

Open
mumenthalers opened this issue Dec 30, 2024 · 0 comments
Open

Allow TypeMapping (without transformation) #341

mumenthalers opened this issue Dec 30, 2024 · 0 comments

Comments

@mumenthalers
Copy link

mumenthalers commented Dec 30, 2024

The Docs States "No data transformation is ever performed.." which is totally fine.

Still it would be very useful to generate types with DateTime as Date as it is quite simple to add an angular http interceptor which would to the work.

something like

{
  "$schema": "node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
  "input": "my-api.yaml",
  "output": "src/app/api",
  "typeMapping": {
    "date-time": "Date"
  }
}

Without this feature we're forced to always do a manual Mapping and define a Mapped type like type MappedType = Omit<OriginalType, 'createdAt'> & {createdAt:Date} which is (1) cumbersome and (2) error prone (as nullability cannot be addressed and property renaming would lead to a runtime error).

I would be open to create a PR but only if you're actually willing to introduce this feature.

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

No branches or pull requests

1 participant