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

nullable property is not nullable in generated code #2055

Open
rwb196884 opened this issue Dec 18, 2024 · 0 comments
Open

nullable property is not nullable in generated code #2055

rwb196884 opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library

Comments

@rwb196884
Copy link

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.

@rwb196884 rwb196884 added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

1 participant