cancel
Showing results for 
Search instead for 
Did you mean: 

CXF Swagger2Feature return the same swagger.json

New Contributor

CXF Swagger2Feature return the same swagger.json

am trying to generate swaggger documentation for our APIs.

what i did is creating a bean based on the org.apache.cxf.jaxrs.swagger.Swagger2Feature:

 

<bean id="MySwagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature" abstract="true">
            <property name="scanAllResources" value="true"/>
            <property name="title" value="Swagger API for Restful Services"/>
            <property name="description" value="Swagger API for Restful Services"/>
            <property name="version" value="1.0.0"/><!--TODO:: version -->
            <property name="prettyPrint" value="true"/>
</bean>

and then for each Service(Endpoint) i created a separate bean that extends the parent bean. exp

 

<bean id="dashboardSwagger" parent="MySwagger2Feature">
            <property name="basePath" value="/services/rest/dashboard"/>
</bean> <bean id="usersSwagger" parent="MySwagger2Feature"> <property name="basePath" value="/services/rest/users"/>
</bean>

 

and then add them to the <property name="features">, but the problem is that all the services return the same swagger.json and that is the one that comes first in the Alphabet order.

so i searched the internet and some developers said that i should add

 

<property name="usePathBasedConfig" value="true" />

to each child bean. and when i did that all the services now just return this swagger.json file.

 

{
    "swagger": "2.0"
}

 Any Suggestions please.

Tags (2)
1 REPLY 1
Moderator

Re: CXF Swagger2Feature return the same swagger.json

The CXF implementation is part of the CXF framework and is not related to Swagger. Unfortunately, we don't know it well enough to provide support for it. Please post your question in their forums.


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview