Q&A (please complete the following information)
- OS: macos
- Browser: chrome
- Version: 130.0.6723.117
- Method of installation: https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/#unpkg
- Swagger-UI version: 5.11.0
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
I am migrating from swagger 1.2 to swagger 2.0 spec. My APIs are configured in this way
@ApiOperation(value = "Get user", notes = "get user", response = User.class) @ApiResponses(value = { @ApiResponse(code = RestConstant.STATUS_CODE_400, message = "Invalid User Input"), @ApiResponse(code = RestConstant.STATUS_CODE_500, message = "Internal Server Error") }) @Override @GZIP @Path("/{number}") @PUT public Response getUser( @ApiParam(value = "Profile object with hostname", required = true) User user, @PathParam("accountNumber") String number) { Swagger/OpenAPI definition: My schema for request and response is coming as null
"User": { "type": "object", "properties": { }, "xml": { "name": "user" } } Swagger-UI configuration options:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="description" content="SwaggerUI" /> <title>SwaggerUI</title> <link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" /> </head> <body> <div id="swagger-ui"></div> <script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script> <script src="https://unpkg.com/[email protected]/swagger-ui-standalone-preset.js" crossorigin></script> <script> window.onload = () => { window.ui = SwaggerUIBundle({ url: 'restservices/swagger.json', dom_id: '#swagger-ui', presets: [ SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], layout: "StandaloneLayout", }); }; </script> </body> </html> How can we help?
I didn't use @ApiModel and @ApiModelProperty with swagger 1.2 and swagger was able to generate schema, but now it is broken. So is it compulsory now? Also I am generating model classes from xsd files, please provide a doc on how to annotate that?