Skip to content

Commit 380d8c1

Browse files
committed
added config help, example for #1784 (comment)
1 parent ceadea1 commit 380d8c1

File tree

6 files changed

+847
-22
lines changed

6 files changed

+847
-22
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit
4444
- [Java JAX-RS](#java-jax-rs)
4545
- [Java Spring MVC](#java-spring-mvc)
4646
- [To build the codegen library](#to-build-the-codegen-library)
47+
- [Workflow Integration](#workflow-integration)
4748
- [Online Generators](#online-generators)
4849
- [Guidelines for Contribution](https://github.com/swagger-api/swagger-codegen/wiki/Guidelines-for-Contribution)
4950
- [License](#license)
@@ -556,6 +557,11 @@ mvn package
556557

557558
Note! The templates are included in the library generated. If you want to modify the templates, you'll need to either repackage the library OR specify a path to your scripts
558559

560+
## Workflow integration
561+
562+
You can use the [swagger-codegen-maven-plugin](modules/swagger-codegen-maven-plugin/README.md) for integrating with your workflow, and generating any codegen target.
563+
564+
559565
## Online generators
560566

561567
One can also generate API client or server using the online generators (https://generator.swagger.io)

modules/swagger-codegen-maven-plugin/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
1111
<plugin>
1212
<groupId>io.swagger</groupId>
1313
<artifactId>swagger-codegen-maven-plugin</artifactId>
14-
<version>${project.version}</version>
14+
<version>2.1.5-SNAPSHOT</version>
1515
<executions>
1616
<execution>
1717
<goals>
@@ -46,10 +46,8 @@ mvn clean compile
4646
- `apiPackage` - the package to use for generated api objects/classes
4747
- `invokerPackage` - the package to use for the generated invoker objects
4848
- `configOptions` - a map of language-specific parameters (see below)
49+
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
4950

50-
### Java-specific parameters (under configOptions)
51+
### Sample configuration
5152

52-
- `sourceFolder` - the folder to use for generated sources under the output folder
53-
- `groupId` - groupId in generated pom.xml
54-
- `artifactId` - artifactId in generated pom.xml
55-
- `artifactVersion` - artifact version in generated pom.xml
53+
- Please see [an example configuration](examples) for using the plugin
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<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/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>io.swagger</groupId>
4+
<artifactId>sample-project</artifactId>
5+
<packaging>jar</packaging>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>sample-project</name>
8+
<url>http://maven.apache.org</url>
9+
<build>
10+
<plugins>
11+
<!-- activate the plugin -->
12+
<plugin>
13+
<groupId>io.swagger</groupId>
14+
<artifactId>swagger-codegen-maven-plugin</artifactId>
15+
<version>2.1.5-SNAPSHOT</version>
16+
<executions>
17+
<execution>
18+
<goals>
19+
<goal>generate</goal>
20+
</goals>
21+
<configuration>
22+
<!-- specify the swagger yaml -->
23+
<inputSpec>swagger.yaml</inputSpec>
24+
25+
<!-- target to generate -->
26+
<language>java</language>
27+
28+
<!-- pass any necessary config options -->
29+
<configOptions>
30+
<dateLibrary>java8</dateLibrary>
31+
</configOptions>
32+
33+
<!-- override the default library to jersey2 -->
34+
<library>jersey2</library>
35+
</configuration>
36+
</execution>
37+
</executions>
38+
</plugin>
39+
</plugins>
40+
</build>
41+
<dependencies>
42+
<!-- dependencies are needed for the client being generated -->
43+
<dependency>
44+
<groupId>io.swagger</groupId>
45+
<artifactId>swagger-annotations</artifactId>
46+
<version>${swagger-annotations-version}</version>
47+
</dependency>
48+
49+
<!-- HTTP client: jersey-client -->
50+
<dependency>
51+
<groupId>org.glassfish.jersey.core</groupId>
52+
<artifactId>jersey-client</artifactId>
53+
<version>${jersey-version}</version>
54+
</dependency>
55+
<dependency>
56+
<groupId>org.glassfish.jersey.media</groupId>
57+
<artifactId>jersey-media-multipart</artifactId>
58+
<version>${jersey-version}</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.glassfish.jersey.media</groupId>
62+
<artifactId>jersey-media-json-jackson</artifactId>
63+
<version>2.22.1</version>
64+
</dependency>
65+
66+
<!-- JSON processing: jackson -->
67+
<dependency>
68+
<groupId>com.fasterxml.jackson.core</groupId>
69+
<artifactId>jackson-core</artifactId>
70+
<version>${jackson-version}</version>
71+
</dependency>
72+
<dependency>
73+
<groupId>com.fasterxml.jackson.core</groupId>
74+
<artifactId>jackson-annotations</artifactId>
75+
<version>${jackson-version}</version>
76+
</dependency>
77+
<dependency>
78+
<groupId>com.fasterxml.jackson.core</groupId>
79+
<artifactId>jackson-databind</artifactId>
80+
<version>${jackson-version}</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>com.fasterxml.jackson.datatype</groupId>
84+
<artifactId>jackson-datatype-joda</artifactId>
85+
<version>2.1.5</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>joda-time</groupId>
89+
<artifactId>joda-time</artifactId>
90+
<version>${jodatime-version}</version>
91+
</dependency>
92+
93+
<!-- Base64 encoding that works in both JVM and Android -->
94+
<dependency>
95+
<groupId>com.brsanthu</groupId>
96+
<artifactId>migbase64</artifactId>
97+
<version>2.2</version>
98+
</dependency>
99+
<!-- test dependencies -->
100+
<dependency>
101+
<groupId>junit</groupId>
102+
<artifactId>junit</artifactId>
103+
<version>${junit-version}</version>
104+
<scope>test</scope>
105+
</dependency>
106+
</dependencies>
107+
<properties>
108+
<swagger-annotations-version>1.5.0</swagger-annotations-version>
109+
<jersey-version>2.12</jersey-version>
110+
<jackson-version>2.4.2</jackson-version>
111+
<jodatime-version>2.3</jodatime-version>
112+
<maven-plugin-version>1.0.0</maven-plugin-version>
113+
<junit-version>4.8.1</junit-version>
114+
</properties>
115+
</project>

0 commit comments

Comments
 (0)