java - Handling special cases with generics in Swagger -
i adding swagger existing project generate documentation. works great, there's edge-cases produce weird documentation , i'm wondering if there's way handle them.
one web method operate on generic types, looking this:
public abstract class abstractserviceclass<t> { @apioperation(value="blah blah",tags={ "generic methods"}) @path("/dogenericthing") @post @consumes({ "application/xml", "application/json" }) @produces({ "application/xml", "application/json" }) public t dogenericthing(@apiparam t entity) { //... } } @api(value="/a.b.c") @path("a.b.c") public class concreteservice extends abstractserviceclass<someentitytype>{ //... }
when swagger generates documentation concreteservice
, generates documentation method dogenericthing
, not able determine parameter type someentitytype
. there way tell swagger parameter type of inherited method when generates documentation of concrete service class?
i have similar situation generic method work on entities. entities have custom annotation applied them, , code able determine if given input can handle. there way tell swagger not generate method documentation inherited methods in service classes marked @api
?
i'm rather new swagger , i'm not sure if it's capable of handling these scenarios. i'm open adding mapping files, or extending api (if there's reasonable , documented way this) add custom functionality. rewriting these classes easier swagger digest not going option.
i suggest opening issue on https://github.com/swagger-api/swagger-core/issues track this. there limitations due type erasure cannot overcome reading implementation @ runtime.
Comments
Post a Comment