Puja
Puja

Reputation: 601

Swagger Error : parse JSON/YAML response

I want to implement swagger for my web project(APIs) . I am using maven spring MVC. I used following link for reference : https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup-1.5.X

I added following dependencies in my pom.xml file :

   <dependency>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-jersey-jaxrs</artifactId>
        <version>1.5.0</version>

        <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </exclusion>
        <exclusion>
            <artifactId>bean-validator</artifactId>
            <groupId>org.glassfish.hk2.external</groupId>
        </exclusion>
        </exclusions>

    </dependency>

And in application config :

<bean id="beanConfig" class="io.swagger.jaxrs.config.BeanConfig">
    <property name="title" value="Swagger Sample App" />
    <property name="version" value="1.0.0" />
    <property name="schemes" value="http" />
    <property name="host" value="localhost:8002" />
    <property name="basePath" value="/api" />
    <property name="resourcePackage" value="io.swagger.resources" />
    <property name="scan" value="true" />
    <property name="prettyPrint" value="true" />
</bean>

<bean id="apiListingResource" class="io.swagger.jaxrs.listing.ApiListingResource" />
<bean id="swaggerSerializers" class="io.swagger.jaxrs.listing.SwaggerSerializers"
    scope="singleton" />

If I see the output on browser then I get following screen : enter image description here

But if I use http://swagger.io/ to see API details then I am getting following error : enter image description here

I am new to swagger so please help me to come out of this issue.

Upvotes: 2

Views: 3352

Answers (1)

fehguy
fehguy

Reputation: 6824

Please check out http://springfox.github.io/springfox/ for support with spring-mvc. The core swagger tools support jersey.

Upvotes: 1

Related Questions