Open
Description
Description
See https://openapi-generator.tech/docs/usage/#type-mappings-and-import-mappings
I would love to be able to do this command:
openapi-typescript specs/openapi.yaml -o specs/openapi.ts --type-mappings=date-time=Date
To generate the Date
type instead of the string
type for date-time fields.
Hence, this YAML:
MyEntity:
type: object
required:
- createdAt
properties:
createdAt:
type: string
format: date-time
description: When the entity was created
Would generate this TypeScript:
MyEntity: {
/**
* Format: date-time
* @description When the entity was created
*/
createdAt: Date; // <- instead of string
};
Proposal
Add the same flag as https://openapi-generator.tech/docs/usage/#type-mappings-and-import-mappings, which is --type-mappings
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)