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

@nestia/migrate does not support OpenAPI 3.1.0 'null' type #983

Closed
fidgi opened this issue Aug 11, 2024 · 1 comment · Fixed by #988
Closed

@nestia/migrate does not support OpenAPI 3.1.0 'null' type #983

fidgi opened this issue Aug 11, 2024 · 1 comment · Fixed by #988
Assignees
Labels
bug Something isn't working

Comments

@fidgi
Copy link

fidgi commented Aug 11, 2024

Summary

@nestia/migrate does not support OpenAPI 3.1.0 'null' type

  • SDK Version: 5.5.0-dev.20240722
  • Migrate should support full OpenAPI 3.1.0 specification:
  • Migrate does not support 'null' type:

Code occuring the bug

With the following OpenAPI specifcation file

{
  "openapi": "3.1.0",
  "info": {
    "title": "Sample",
    "version": "1.0.0",
    "description": "sample",
    "license": {
      "name": "IST"
    }
  },
  "servers": [
    {
      "url": "https://nowhere.org/{version}",
      "description": "sample\n",
      "variables": {
        "version": {
          "default": "v1"
        }
      }
    }
  ],
  "paths": {
    "/user": {
      "get": {
        "summary": "Get user data",
        "description": "Get user data.<br>\n",
        "operationId": "getUserData",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The numeric identifier of the user",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Get user data response.\n",
                  "type": "object",
                  "properties": {
                    "id": {
                      "description": "User id.\n",
                      "type": "string",
                      "example": "99899",
                      "pattern": "^\\d{1,9}$"
                    },
                    "name": {
                      "description": "User name.\n",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "error occurred - see status code and message for more information.",
            "content": {}
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "description": "Use a JWT as an HTTP authentication bearer\n",
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}

Migrate fails

npx @nestia/migrate
? Migration mode NestJS
? Swagger file location dist/specs/openapi-bundle.json
? Output directory path /tmp/test
? Mokup Simulator true
? Generate E2E tests true
[
  {
    path: '$input.paths["/user"].get.responses["200"].content["application/json"].schema.properties.name.type',
    expected: 'undefined',
    value: [ 'string', 'null' ]
  }
]
Error: Invalid swagger file (must follow the OpenAPI 3.0 spec).
    at /home/xxxx/.npm/_npx/42538cd42232552b/node_modules/@nestia/migrate/lib/internal/MigrateCommander.js:49:19
    at Generator.next (<anonymous>)
    at fulfilled (/home/xxxx/.npm/_npx/42538cd42232552b/node_modules/@nestia/migrate/lib/internal/MigrateCommander.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@samchon samchon self-assigned this Aug 11, 2024
@samchon samchon added the bug Something isn't working label Aug 11, 2024
samchon added a commit to samchon/openapi that referenced this issue Aug 11, 2024
@samchon
Copy link
Owner

samchon commented Aug 14, 2024

Upgrade to @nestia/[email protected], then the problem be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants