openapi typescript-fetch generates non-nullable types as nullable

Viewed 442

Basically all my DTOs are generated with nullable fields like: id?: number;. How can I create non-nullable types for types which are not flagged as nullable.

My DTO schema looks like this:

 "UserDTO": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "integer",
            "format": "int32"
          }
        }

I generate the code like this: openapi-generator generate --additional-properties=prefixParameterInterfaces=true,typescriptThreePlus=true --remove-operation-id-prefix -i libs/services/defs/swagger.json -g typescript-fetch -o libs/services/src/api

0 Answers
Related