Springfox 3.0.0 generates 3 classes instead of 1 (Class, ClassReq, ClassRes) and ClassReq is missing required fields
See original GitHub issue- What version of the library are you using? 3.0.0
For a single class 3.0.0 generates 3 classes: the original class, one with the Req and one with the Res postfix. Req seems to be used if @RequestBody is being used. Res I suppose when @ResponseBody is in use (do not use it, class is still generated). The original Class name is used when the class is present on another object.
This makes it impossible to pass a response object to a request API in Java and other other languages that rely on nominal typing because they are completely separate classes.
Even worse: it seems that the ParsedBusinessScheduleReq object does not properly generate the required fields. Below is the used class. Take a look at the required field which is absent for the ParsedBusinessScheduleReq object.
@ApiModel(value = "ParsedBusinessSchedule")
data class OpeningHours(
val daysInWeek: List<WeeklyOpeningHours> = emptyList(),
val daysInYear: List<YearlyOpeningHours> = emptyList(),
val winterSeason: WinterSeason? = null,
val closedOnHoliday: Boolean = true
)
{
"ParsedBusinessSchedule": {
"type": "object",
"required": [
"closedOnHoliday",
"daysInWeek",
"daysInYear"
],
"properties": {
"closedOnHoliday": {
"type": "boolean"
},
"daysInWeek": {
"type": "array",
"items": {
"$ref": "#/definitions/WeeklyOpeningHours"
}
},
"daysInYear": {
"type": "array",
"items": {
"$ref": "#/definitions/YearlyOpeningHours"
}
},
"winterSeason": {
"$ref": "#/definitions/WinterSeason"
}
}
},
"ParsedBusinessScheduleReq": {
"type": "object",
"properties": {
"closedOnHoliday": {
"type": "boolean"
},
"daysInWeek": {
"type": "array",
"items": {
"$ref": "#/definitions/WeeklyOpeningHoursReq"
}
},
"daysInYear": {
"type": "array",
"items": {
"$ref": "#/definitions/YearlyOpeningHoursReq"
}
},
"winterSeason": {
"$ref": "#/definitions/WinterSeasonReq"
}
}
},
"ParsedBusinessScheduleRes": {
"type": "object",
"required": [
"closedOnHoliday",
"daysInWeek",
"daysInYear"
],
"properties": {
"closedOnHoliday": {
"type": "boolean"
},
"daysInWeek": {
"type": "array",
"items": {
"$ref": "#/definitions/WeeklyOpeningHoursRes"
}
},
"daysInYear": {
"type": "array",
"items": {
"$ref": "#/definitions/YearlyOpeningHoursRes"
}
},
"winterSeason": {
"$ref": "#/definitions/WinterSeasonRes"
}
}
}
}
- Question. Is this a question about how to do a certain thing? Not sure if this is a bug or feature, couldn’t find any docs on that.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:30 (2 by maintainers)
Top Results From Across the Web
Springfox 3.0.0 is not working with Spring Boot 2.6.0 [duplicate]
Only adding @EnableWebMvc in main class resolved the problem: @EnableWebMvc @SpringBootApplication public class MyApp { public static void ...
Read more >Bountysource
Springfox 3.0.0 generates 3 classes instead of 1 (Class, ClassReq, ClassRes) and ClassReq is missing required fields.
Read more >Springfox Reference Documentation - GitHub Pages
Springfox works by examining an application, once, at runtime to infer API semantics based on spring configurations, class structure and ...
Read more >API Documentation with Springfox 3 - Microflash
The code written for this post uses: Java 14; Spring Boot 2.3.3; Springfox Boot Starter 3.0.0; Postgres 13 running in a Docker container;...
Read more >I can't run any version of swagger-fox. Spring Boot 2.4.2 + JDK 8.
IllegalArgumentException: Unresolvable class definition for class [springfox.documentation.spring.web.OnServletBasedWebApplication]
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 FreeTop 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
Top GitHub Comments
This is still an issue.
It’s causing a lot of discomfort for us still. Could someone address this issue?