1

We have a Person class. Person class has a property with type PersonDetail. And PersonDetail has a property with type Mail class.

When we start the application and navigate to swagger ui html page, Mail class is not generated in components section of openapi definition and we get "Could not resolve reference: Could not resolve pointer: /components/schemas/Mail does not exist in document" error on page. As we checked if there is a complex type in the third level that time springdoc can not resolve that type. Person and PersonDetail works fine but Mail fails.

Person->PersonDetail->Mail

public class Person {
private String name;

private PersonDetail personDetail;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public PersonDetail getPersonDetail() {
    return personDetail;
}

public void setPersonDetail(PersonDetail personDetail) {
    this.personDetail = personDetail;
}
}

public class PersonDetail {
private String surname;

private List<Mail> mails;

public List<Mail> getMails() {
    return mails;
}

public void setMails(List<Mail> mails) {
    this.mails = mails;
}
}

public class Mail {
private String mailAddress;

public String getMailAddress() {
    return mailAddress;
}

public void setMailAddress(String mailAddress) {
    this.mailAddress = mailAddress;
}
}

@get(path = "/getPersonTest")
@operation(description = "Testttt")
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation",
content = @content(schema = @Schema(implementation = Person.class)))})
public ResponseEntity getPerson(@RequestParam String name){
Person person = new Person();
return ResponseEntity.status(HttpStatus.OK).body(person);
}
Bilgehan
  • 1,135
  • 1
  • 14
  • 41

1 Answers1

1

There is no issue. It seems that you are not using the right configuration.

We already answered you here: https://github.com/springdoc/springdoc-openapi/issues/679

brianbro
  • 4,141
  • 2
  • 24
  • 37