Skip to content

nullable property is not nullable in generated code #2055

Closed
@rwb196884

Description

@rwb196884

Here is a property in my swagger.json

          "Retained9": {
            "maximum": 100,
            "minimum": 0,
            "type": "integer",
            "description": "Retained9\r\nThis property is....\r\n",
            "format": "int32",
            "default": "100",
            "nullable": true
          },

Using openapi-typescript version 6.7.6 this generates

      /**
       * Format: int32
       * @description Retained9
       * This property is...
       *
       * @default 100
       */      Retained9?: number | null;

But using openapi-typescript version 7.4.4 this generates

            /**
             * Format: int32
             * @description Retained9
             *     This property is used...
             *
             * @default 100
             */
            Retained9: number;

It is good that the useless and annoying ? has gone, but in the specification the property is nullable and therefore it is an error to have removed the | null.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript libraryquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions