FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve documentation for usage of a generator in an other jar (#817) · runningcode/openapi-generator@b91c8e1 · GitHub

Commit b91c8e1

Browse files
authored andcommitted
Improve documentation for usage of a generator in an other jar (OpenAPITools#817)
1 parent dcc622d commit b91c8e1

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

‎docs/customization.md‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ These names can be anything you like. If you are building a client for the white
3535

3636
**NOTE** Convention is to use kebab casing for names passed to `-n`. Example, `scala-finatra` would become `ScalaFinatraGenerator`.
3737

38+
#### Use your new generator with the CLI
39+
3840
To compile your library, enter the `out/generators/my-codegen` directory, run `mvn package` and execute the generator:
3941

4042
```sh
@@ -50,11 +52,59 @@ Note the `my-codegen` is an option for `-g` now, and you can use the usual argum
5052

5153
```sh
5254
java -cp out/codegens/customCodegen/target/my-codegen-openapi-generator-1.0.0.jar:modules/openapi-generator-cli/target/openapi-generator-cli.jar \
53-
io.openapitools.codegen.OpenAPIGenerator generate -g my-codegen \
55+
org.openapitools.codegen.OpenAPIGenerator generate -g my-codegen \
5456
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
5557
-o ./out/myClient
5658
```
5759

60+
For Windows users:
61+
```
62+
java -cp out/codegens/customCodegen/target/my-codegen-openapi-generator-1.0.0.jar;modules/openapi-generator-cli/target/openapi-generator-cli.jar \
63+
org.openapitools.codegen.OpenAPIGenerator generate -g my-codegen \
64+
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
65+
-o ./out/myClient
66+
```
67+
68+
#### Use your new generator with the maven plugin
69+
70+
Install your library to your local maven repository by running:
71+
72+
```
73+
mvn clean install -f out/generators/my-codegen
74+
```
75+
76+
This will install `org.openapitools:my-codegen-openapi-generator:1.0.0` to your local maven repository.
77+
78+
You can use this as additional dependency of the `openapi-generator-maven-plugin` plugin and use `my-codegen` as `generatorName` value:
79+
80+
```xml
81+
<plugin>
82+
<groupId>org.openapitools</groupId>
83+
<artifactId>openapi-generator-maven-plugin</artifactId>
84+
<version>${openapi-generator-version}</version>
85+
<executions>
86+
<execution>
87+
<id>generate-client-code</id>
88+
<goals>
89+
<goal>generate</goal>
90+
</goals>
91+
<configuration>
92+
<generatorName>my-codegen</generatorName>
93+
<!-- other configuration ... -->
94+
</configuration>
95+
</execution>
96+
</executions>
97+
<dependencies>
98+
<dependency>
99+
<groupId>org.openapitools</groupId>
100+
<artifactId>my-codegen-openapi-generator</artifactId>
101+
<version>1.0.0</version>
102+
</dependency>
103+
</dependencies>
104+
</plugin>
105+
```
106+
107+
If you publish your artifact to a distant maven repository, do not forget to add this repository as `pluginRepository` for your project.
58108

59109
### Selective generation
60110
You may not want to generate *all* models in your project. Likewise you may want just one or two apis to be written. If that's the case, you can use system properties to control the output:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL