-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apmoust empty swagger.json with swagger-maven-plugin-3.1.1-SNAPSHOT #9
Comments
It looks like the problem is not with the project but with swagger-maven-plugin. Downgraded its version to 3.0-M2-SNAPSHOT generated proper annotation |
Yes same for me i tried 3.1.0 , after downgraded to 3.0-M2-SNAPSHOT it is generated. I want to use latest 3.1.0 . In that case what should i do.? |
@Vidhyadharantechdays @Chort409 I have upgraded the example project to work with swagger-maven-plugin 3.1.0. You may view it here: https://github.com/swagger-maven-plugin/swagger-maven-example |
Verified it is working THanks @who Andrew |
This seems to be a fixed here: #14 |
Thanks @who I can summarize what have you changed on this new project. 1. update pom file:
put file securityDefinitions.json to main/resources folder 2. Change import in source code: Scan all classes and change import from com.wordnik.swagger.annotations.*; to io.swagger.annotations.*; AND com.wordnik.swagger.annotations.ApiResponse; to io.swagger.annotations.ApiResponse; Do following those steps then i can make the original example run perfectly. Here is my new pom.xml <xml version="1.0" encoding="UTF-8"? >
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>swagger-maven-example</groupId>
<artifactId>swagger-maven-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.5</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>com.github.kongchen.swagger.sample.wordnik.resource</locations>
<schemes>http,https</schemes>
<host>petstore.swagger.wordnik.com</host>
<basePath>/api</basePath>
<info>
<title>Swagger Maven Plugin Sample</title>
<version>v1</version>
<description>This is a sample for swagger-maven-plugin</description>
<termsOfService>
http://www.github.com/kongchen/swagger-maven-plugin
</termsOfService>
<contact>
<email>[email protected]</email>
<name>Kong Chen</name>
<url>http://kongch.com</url>
</contact>
<license>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<name>Apache 2.0</name>
</license>
</info>
<!-- Support classpath or file absolute path here.
1) classpath e.g: "classpath:/markdown.hbs", "classpath:/templates/hello.html"
2) file e.g: "${basedir}/src/main/resources/markdown.hbs",
"${basedir}/src/main/resources/template/hello.html" -->
<templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
<outputPath>${basedir}/generated/document.html</outputPath>
<swaggerDirectory>generated/swagger-ui</swaggerDirectory>
<securityDefinitions>
<securityDefinition>
<json>/securityDefinitions.json</json>
</securityDefinition>
</securityDefinitions>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<scope>compile</scope>
<version>1.5.3</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey2-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey2-version}</version>
</dependency>
</dependencies>
<properties>
<jetty-version>9.0.7.v20131107</jetty-version>
<jersey2-version>2.4.1</jersey2-version>
<logback-version>1.0.1</logback-version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project> Thanks a lot |
I have the same problems,my swagger-maven-plugin version is 1.3.5 , and I add the "method = RequestMethod.POST" on the annotation @RequestMapping, then it worked! |
Updated the project to use swagger-maven-plugin-3.1.1-SNAPSHOT, since 3.0.1-SNAPSHOT cannot be found and all I got under swager.json is :
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample for swagger-maven-plugin",
"version" : "v1",
"title" : "Swagger Maven Plugin Sample",
"termsOfService" : "http://www.github.com/kongchen/swagger-maven-plugin",
"contact" : {
"name" : "Kong Chen",
"url" : "http://kongch.com",
"email" : "[email protected]"
},
"license" : {
"name" : "Apache 2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host" : "petstore.swagger.wordnik.com",
"basePath" : "/api",
"schemes" : [ "http", "https" ]
}
The text was updated successfully, but these errors were encountered: