Skip to content

Commit adeff78

Browse files
committed
instructions for selective generation
1 parent e289b85 commit adeff78

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,36 @@ to the code generator like this:
212212

213213
Great for creating libraries on your ci server, from the [Swagger Editor](http://editor.swagger.io)... or while coding on an airplane.
214214

215+
### Selective generation
216+
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:
217+
218+
The default is generate *everything* supported by the specific library. Once you enable a feature, it will restrict the contents generated:
219+
220+
```
221+
# generate only models
222+
java -Dmodels {opts}
223+
224+
# generate only apis
225+
java -Dapis {opts}
226+
227+
# generate only supporting files
228+
java -DsupportingFiles
229+
230+
# generate models and supporting files
231+
java -Dmodels -DsupportingFiles
232+
```
233+
234+
To control the specific files being generated, you can pass a CSV list of what you want:
235+
```
236+
# generate the User and Pet models only
237+
-Dmodels=User,Pet
238+
239+
# generate the User model and the supportingFile `StringUtil.java`:
240+
-Dmodels=User -DsupportingFiles=StringUtil.java
241+
```
242+
243+
When using selective generation, _only_ the templates needed for the specific generation will be used.
244+
215245
### Customizing the generator
216246

217247
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:

0 commit comments

Comments
 (0)