Forum Discussion

arlecchino's avatar
New Contributor
6 years ago

swagger-ui JPA relationships



I'm using swagger-ui with Spring Boot.

In my models are some relationships like





Can I tell swagger-ui that it shouldn't put in the complete related model, but only the table field with the key_id?


I know that is something DB specific how the relationships are handled, but I know that with ...


class Mother {
    @OneToMany(mappedBy = "mother")
    List<Child> childs;

class Child {
    Mother mother;

there is a field mother_id in table CHILD.

I don't want to see the Mother object but only this mother_id in swagger-ui.


Can this be configured?



2 Replies

  • Swagger UI is a project that renders API definitions that are being produced by Springfox (in your case). Springfox translates your code into the API definition and uses your code to extract what your API looks like.


    Springfox is not one of our projects and we're not familiar with it enough to offer support for it. We recommend filing a ticket directly with the project in Github.

    • arlecchino's avatar
      New Contributor

      Ok. I've thought of something like @ApiModelProperty. So I've asked.

      I'll try now to find something in Springfox.

      Thx RonRatovsky