This article is a mirror article of machine translation, please click here to jump to the original article.

View: 39087|Reply: 0

[Source] Swagger Can't use schemaId xx for type xx. The same schemaId is already ...

[Copy link]
Posted on 5/20/2021 3:53:30 PM | | | |
Can't use schemaId xx for type xx. The same schemaId is already used for type xx

InvalidOperationException: Can't use schemaId "$Itsvse" for type "$WebApplication2.Controllers.Test1+Itsvse". The same schemaId is already used for type "$WebApplication2.Controllers.Test+Itsvse"
Error causes:



in the projectThere are request parameters and response parameters with the same object name, but they are in an unused namespace, the example error code is as follows:

"components": {
    "schemas": {
      "Itsvse": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "disabled": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": false
      },
      "Itsvse1": {
        "type": "object",
        "properties": {
          "name2": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }


solution

services. AddSwaggerGen is set up with the following code:



(End)




Previous:Nuget packages multiple libraries into a package
Next:Jenkins (3) Plugin image site acceleration
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com