1
votes

As of 2.7.0 SpringFox Swagger does not support inheritance:

https://github.com/springfox/springfox/issues/1983

I have an app that relies on the fact that swagger supports inheritance, but still need to update library to version 2.8.0.

Is it actually possible to provide backward compatibility for inheritance in a way (even dirty way)?

Would really appreciate any help, thanks

1
Did you find a workaround ? I have the same issue. Share the details, if you have found any workaround. Thanks - user1917034
Yes, Please share your workaround - user1917034

1 Answers

1
votes

SpringFox Swagger 2.9.0 (latest version at the time of this post) introduced one part of the inheritance functionality. so you can use smth like @Apimodel(parent = MyParent.class) to add allof $ref to the child, but this version doesn't support the oneof $ref for the parent class

My workaround was migrating to springdoc open-api

parent class

@Schema(oneOf = {Child1.class, Child2.class})

child class

@Schema(allOf = Parent.class)