`@ApiModel(parent = Pet.class)` seems to have no affect when `subTypes` isn't set
Say one has Pet.class with perhaps Cat.class
I understand the approach is then to have:
@ApiModel(subTypes = {Cat.class})
public class class Pet {
...
}
@ApiModel(parent = Pet.class)
public class Dog extends Pet {
...
}
This works well for me. In fact, even this would suffice:
@ApiModel(subTypes = {Cat.class})
public class class Pet {
...
}
// Note we do not annotate Dog and specify a parent
public class Dog extends Pet {
...
}
But, the following won't work for me:
// Note this time we don't annotate Pet with its subtypes
public class class Pet {
...
}
@ApiModel(parent = Pet.class)
public class Dog extends Pet {
...
}
It seems like io.swagger.jackson.SwaggerAnnotationIntrospector only cares about the subTypes and not the parent, which is a problem because, what am I to do if say Dog.class is actually a part of some other module and is not visible to the Pet module? I cannot annotate the Pet class with its subtypes... and i'm stuck.
How would you expect this to work? Looking for input on how we scan objects.
@fehguy see my PR here: https://github.com/swagger-api/swagger-core/issues/1741
There's also a unit test included to demonstrate the behavior. Let me know if that's what you've been looking for
Any news?
Any news?
I guess there are still no news?
I also would like to have this feature if it is possible. I am currently in a situation where i needed to have a subclass of a specific class. That class comes from an external library so I can't annotate that class with ApiModel and provide the subclass information...
Only thing what I can do is annotating the subclass and provide the property from which parent it is a subclass, but it won't reflect in the generated swagger-ui model section as @roni-frantchi mentioned
Say one has
Pet.classwith perhapsCat.classI understand the approach is then to have:@ApiModel(subTypes = {Cat.class}) public class class Pet { ... } @ApiModel(parent = Pet.class) public class Dog extends Pet { ... }This works well for me. In fact, even this would suffice:
@ApiModel(subTypes = {Cat.class}) public class class Pet { ... } // Note we do not annotate Dog and specify a parent public class Dog extends Pet { ... }But, the following won't work for me:
// Note this time we don't annotate Pet with its subtypes public class class Pet { ... } @ApiModel(parent = Pet.class) public class Dog extends Pet { ... }It seems like
io.swagger.jackson.SwaggerAnnotationIntrospectoronly cares about thesubTypesand not theparent, which is a problem because, what am I to do if sayDog.classis actually a part of some other module and is not visible to thePetmodule? I cannot annotate thePetclass with its subtypes... and i'm stuck.
Any Updates on this?
Closing this issue as part of our backlog cleanup effort.
This issue is outdated and/or inactive for a long time, and we’re not able to revisit it meaningfully.
If this problem is still relevant, please open a new issue and reference this one for context.
Thank you for your understanding!