springfox-swagger 3.0.0 - SNAPSHOT - JSON schema not being generated as it was before te update
See original GitHub issuePlease take the time to search the repository, if your question has already been asked or answered.
-3.0.0-SNAPSHOT
- SpringBoot 2.2.7 Webflux
- JsonView
I’m using SpringFox swagger in SpringBoot with JsonView support
My docket configuration is:
final List<ResponseMessage> globalResponses = Arrays.asList(
new ResponseMessageBuilder().code(400)
.message(ErrorMessages.INVALID_REQUEST)
.responseModel(new ModelRef("InvalidDataResponse"))
.build(),
new ResponseMessageBuilder().code(401)
.message(ErrorMessages.UNAUTHENTICATED)
.responseModel(new ModelRef("UnauthenticatedResponse"))
.build(),
new ResponseMessageBuilder().code(403)
.message(ErrorMessages.FORBIDDEN)
.responseModel(new ModelRef("ForbiddenResponse"))
.build(),
new ResponseMessageBuilder().code(500)
.message(ErrorMessages.INTERNAL_SERVER_ERROR)
.responseModel(new ModelRef("InternalServerError"))
.build()
);
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.globalResponseMessage(RequestMethod.GET, globalResponses)
.globalResponseMessage(RequestMethod.POST, globalResponses)
.globalResponseMessage(RequestMethod.DELETE, globalResponses)
.globalResponseMessage(RequestMethod.PATCH, globalResponses)
.globalResponseMessage(RequestMethod.PUT, globalResponses)
.useDefaultResponseMessages(false)
.genericModelSubstitutes(ResponseEntity.class)
.alternateTypeRules(
newRule(typeResolver.resolve(
Mono.class,
typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
typeResolver.resolve(WildcardType.class))
)
.additionalModels(
typeResolver.resolve(InvalidDataResponse.class),
typeResolver.resolve(UnauthenticatedResponse.class),
typeResolver.resolve(ForbiddenResponse.class),
typeResolver.resolve(NotFoundResponse.class),
typeResolver.resolve(InternalServerResponse.class)
)
.host(baseUrl);
And for the following endpoint/annotations:
@ApiOperation(
value = "List all projects"
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = SuccessMessages.CONTENT_READY
)
})
@GetMapping(path = "/projects", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@JsonView({View.List.class})
Mono<ResponseEntity<SuccessResponse<PaginatedListResult<ProjectModel>>>> getAll(
Now i get the schema of :
"responses": {
"200": {
"description": "content ready",
"schema": {
"$ref": "#/definitions/Error-ModelName{namespace='reactor.core.publisher', name='Mono«ResponseEntity«SuccessResponse«PaginatedListResult«Project»»»»'}"
}
}
}
And the model definition is exported as :
"SuccessResponse«PaginatedListResult«Project»»View": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "content ready!"
},
"result": {
"example": "null",
"$ref": "#/definitions/PaginatedListResult«Project»View"
},
"status": {
"type": "boolean",
"example": true
}
},
"title": "SuccessResponse«PaginatedListResult«Project»»View",
"description": "Success response model"
}
Before the last update this was working with the schema being generated similar to what is shown below
"responses": {
"200": {
"description": "content ready",
"schema": {
"$ref": "#/definitions/Mono«ResponseEntity«SuccessResponse«PaginatedListResult«Project»»»»"
}
}
}
....
"Mono«ResponseEntity«SuccessResponse«PaginatedListResult«Project»»»»": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "content ready!"
},
"result": {
"example": "null",
"$ref": "#/definitions/PaginatedListResult«Project»View"
},
"status": {
"type": "boolean",
"example": true
}
},
"title": "SuccessResponse«PaginatedListResult«Project»»View",
"description": "Success response model"
}`
What should i do different to fix this up ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Springfox 3.0.0 is not working with Spring Boot 2.6.0 [duplicate]
Up to now, Springfox 3.0.0 only works with Spring 2.6.0-M2 but not with versions ... EDIT: The server starts, but no API info...
Read more >Springfox Reference Documentation - GitHub Pages
1. Introduction. The Springfox suite of java libraries are all about automating the generation of machine and human readable specifications for ...
Read more >springfox/springfox - Gitter
I'm using Springfox / Swagger / Spring Boot, and trying to figure out how to make the Swagger UI use https. In Spring...
Read more >OpenAPI 3 Library for spring-boot
Automatically generates documentation in JSON/YAML and HTML format APIs. This documentation can be completed by comments using swagger-api ...
Read more >Spring Boot and Swagger - Documenting RESTful Services ...
We will learn how to expose automated swagger documentation from your application. We will also add documentation to the REST API with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is a sad example with DTO class:
It should still work however. I’ll try and fix that 😃 Thanks for reporting