-
-
Notifications
You must be signed in to change notification settings - Fork 568
Description
Describe the bug
I encountered an issue with SpringDoc OpenAPI when using a Java record named Item. The generated schema incorrectly places the reason field from the Serial record as a direct field of Item, while the serial field is completely ignored. Additionally, the Serial record is not documented as a separate schema at all.
Example record definition:
public record Item(
String itemNo,
String material,
String quantity,
List<Serial> serials
) {}
public record Serial(
String serial,
String reason
) {}
However, when I rename Item to Item2, the schema is generated correctly. This suggests a possible naming conflict affecting schema generation.
Could you please confirm whether this is a bug or an expected limitation?
Let me know if you need more details or sample output.
To Reproduce
Steps to reproduce the behavior:
- Spring boot: 3.2.0
- 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
- Expected and actual attached as files
Below are the sample records and the controller that uses the wrapper one. (Item)
public record Item(
String itemNo,
String material,
String quantity,
List<Serial> serials
) {}
public record Serial(
String serial,
String reason
) {}
@RestController
public class ItemsController{
public void add(@RequestBody Item item){
}
}