wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

Ignoring certain annotations on parameters #10

Closed SStorm closed 11 years ago

SStorm commented 11 years ago

Hi, I've added support for ignoring parameters that are annotated with certain annotations (which a user can specify). This is useful if anyone (like we!) have custom argument resolvers, that inject parameters for us (and we use annotations to hint that its injectable) - of course we don't want these injected parameters to become visible in the documentation. The configuration in Spring could be like:

    <bean id="documentationController" class="com.knappsack.swagger4springweb.controller.ApiDocumentationController">
        <property name="basePath" value="${documentation.services.basePath}" />
        <property name="baseControllerPackage" value="com.foo.bar.package.controllers" />
        <property name="baseModelPackage" value="com.foo.bar.package.models" />
        <property name="apiVersion" value="v1" />
        <property name="ignorableAnnotations">
            <list>
                <value>com.foo.bar.package.annotations.IgnoreParameterWithThisAnnotation</value>
                <value>com.foo.bar.package.annotations.IgnoreThisOneAlso</value>
            </list>
        </property>
    </bean>

Regards, Roman

wkennedy commented 11 years ago

Thanks for the changes!