-
-
Notifications
You must be signed in to change notification settings - Fork 537
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
So to make a simplified example, I have these 2 entities:
public class EntityA {
@Schema(required = true)
private String fieldA;
//Getters and setters...
}
public class EntityB {
@Schema(required = true)
private String fieldB;
@Schema(required = true)
private EntityA entityA;
//Getters and setters...
}
As you see, EntityB has 2 required atributes fieldB and entityA.
I also have this method in the controller:
@GetMapping(path = "/entity-b", produces = { "application/json", "application/xml" })
public EntityB getEntityB(){
return new EntityB();
}
When the doc is generated, in the EntityB, only fieldB is marked as required:
"EntityA":{
"required":[
"fieldA"
],
"type":"object",
"properties":{
"fieldA":{
"type":"string"
}
}
},
"EntityB":{
"required":[
"fieldB"
],
"type":"object",
"properties":{
"fieldB":{
"type":"string"
},
"entityA":{
"$ref":"#/components/schemas/EntityA"
}
}
}
The expected behaviour is that both fieldB and entityA should be marked as required in the schema EntityB
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working