How to make the swagger reflections rescan at every call

55 views
Skip to first unread message

Emmanuel Courreges

unread,
Jun 21, 2017, 9:04:40 AM6/21/17
to Swagger
Hello, I have a Java REST API on Tomcat that properly generates the swagger through the annotations and a ReaderListener.
It only runs the ReaderListener and the reflections once on first call to swagger.json
Is there a way to make it rescan at every call (not great for performance but does the trick)?
Or a way to rescan on certain conditions (In my case, I would like to rescan when the user authenticated is different).
Maybe I need to init swagger programmatically rather than through a bean?
Or running it as a filter? But how does that work?

Thank you!

Here is my bean config in tomcat 8.0:

    <bean id="SwaggerScanner" class="io.swagger.jaxrs.config.BeanConfig">
     
<property name="contact" value="m...@me.com" />
     
<property name="version" value="${project.version}" />
     
<property name="title" value="My API" />
     
<property name="description" value="My Swagger" />
     
<property name="license" value="" />
     
<property name="scan" value="true"/>
     
<property name="prettyPrint" value="true"/>
     
<property name="basePath" value="/mybase/v1"/>
     
<property name="resourcePackage" value="com.mypackage.api,com.mypackage.ws.impl"/>
   
</bean>


And pom.xml:
            <dependency>
               
<groupId>io.swagger</groupId>
               
<artifactId>swagger-jaxrs</artifactId>
               
<version>1.5.10</version>
           
</dependency>



Ron Ratovsky

unread,
Jun 21, 2017, 1:22:43 PM6/21/17
to swagger-sw...@googlegroups.com

You can do it, but it’s going to require a bit of work.

Would suggest following the code in BaseApiListingResource to see what would need to change.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages