Description
If a controller operation has a parameter or return type with a wildcard generic type, the type information is lost and any customizers will see the generically typed property of the class as just an Object
rather than the upper bound of the type parameter.
This is fairly complex so I've created an example on a fork of the project: robfletcher@6f212b2
When considering the parameter and response types of the controller method here: robfletcher@6f212b2#diff-3cea84ffe0d7e0808cc1ed9cd9c1fe9aR16-R18
With the wildcard the schemas in the API treat the PetRecord.pet
property as just an object
. If I change the generic declarations on the controller to PetRecord<? extends Pet>
then it works correctly. However, this shouldn't be necessary since that is just re-declaring the same variance as on the PetRecord
class. Removing the generic type altogether also works (with a compiler warning). I originally ran into this problem in a Kotlin codebase where omitting the generic type is not possible.