Comments (7)
@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
from swagger-maven-example.
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
from swagger-maven-example.
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.?
from swagger-maven-example.
Verified it is working THanks @who Andrew
from swagger-maven-example.
This seems to be a fixed here: #14
I faced the same issue which was solved by applying the fix from mentioned pull request
from swagger-maven-example.
Thanks @who
With your link, it work (https://github.com/swagger-maven-plugin/swagger-maven-example)
I can summarize what have you changed on this new project.
1. update pom file:
- use plugin swagger-maven-plugin with release version (you use 3.1.1 and i even can use 3.1.5).
- In dependency section, change groupId of swagger-core from com.wordnik to io.swagger (use the original one)
- Define security definition in apiSource like this:
<securityDefinitions>
<securityDefinition>
<json>/securityDefinitions.json</json>
</securityDefinition>
</securityDefinitions>
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;
I see we need to change for package xxx.resource and xxx.model
You would see some incompatibilities from new import, so just fix following what maven tell you (ex: remove type attribute from annotation of apis (it's already declared on securityDefinition.json)
Do following those steps then i can make the original example run perfectly.
it also fix this one #16
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
from swagger-maven-example.
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!
from swagger-maven-example.
Related Issues (20)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project wallet-core: Compilation failure: Compilation failure: [ERROR] /Users/mac1/Documents/alex/pilot/Alex-Wallet/wallet-core/src/main/java/com/alex/wallet/core/impl/PromotionServiceImpl.java:[117,61] diamond operator is not supported in -source 1.6 HOT 2
- com.github.kongchen.swagger.sample.wordnik.util.ApiAuthorizationFilterImpl - no util package
- Swagger.json is not generating at all HOT 2
- XmlAttribute is ignored
- Question: does the `attachSwaggerArtifact` not work anymore? HOT 1
- Cannot find 'supportSpringMvc' error while updating swagger version to 3.0.1 from 2.3.4
- I made a json file use swagger editor, is there any way to convert it to html?
- Problem with generated resource model definition for model with generic type
- Generate yaml in maven multi project
- reponse
- Cannot load Swagger extension: com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension
- "allowableValues" in "ApiModelProperty" are ignored / not visualized in html output
- Is @JsonView supported and honored in generated swagger?
- error NullPointerException on compile with version 3.1.8
- This plug-in cannot collect interface information
- a valid example, hope can help you guys HOT 1
- Override swagger:generate goal
- document.html - blank / 404
- Operations parameters are always named "body" in json documents HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-maven-example.