OpenApi Generator create models with type String instead of Date

Viewed 2404

Im using OpenApi Generator to create services and models for my angular project.

This is an example of my Json:

"uploadDate" : {
              "type" : "string",
              "description" : "Data caricamento",
              "format" : "date-time"
            },

When I generate the files uploadDate is converted to String instead of Date.

See:

     /**
     * Data caricamento
     */
    uploadDate?: string;

Is there a way to add a configuration and create models with Date as a type where format is date-time?

This is the script that I use to launch the generation:

"generate": "openapi-generator-cli generate -g typescript-angular -i openapi.json -o ./generated-sources/client"
1 Answers

Fixed by adding: --type-mappings=DateTime=Date

Related