Skip to content

Commit b4572c4

Browse files
committed
[docs] Update site with global properties list and usage explanation
1 parent 5e42868 commit b4572c4

File tree

5 files changed

+61
-15
lines changed

5 files changed

+61
-15
lines changed

docs/customization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ You can use this as additional dependency of the `openapi-generator-maven-plugin
9090
If you publish your artifact to a distant maven repository, do not forget to add this repository as `pluginRepository` for your project.
9191

9292
## Selective generation
93-
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:
93+
94+
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 or [global properties](./global-properties.md) to control the output.
9495

9596
The default is generate *everything* supported by the specific library. Once you enable a feature, it will restrict the contents generated:
9697

docs/global-properties.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
id: globals
3+
title: Global Properties
4+
---
5+
6+
## Available Global Properties
7+
8+
| Property | Description | Acceptable value |
9+
| -------- | ------------| ---------------- |
10+
| debugOpenAPI | Dumps JSON formatted and fully parsed OpenAPI document during generation | none |
11+
| debugModels | Dumps JSON formatted template-bound model information during generation | none |
12+
| debugOperations | Dumps JSON formatted template-bound operation information during generation | none |
13+
| debugSupportingFiles | Dumps JSON formatted Supporting File information during generation | none |
14+
| verbose | Defines the verbosity | `true` or `false` |
15+
| generateAliasAsModel | Defines whether primitive types defined at the model/schema level will be wrapped in a model | `true` or `false` |
16+
| org.openapitools.codegen.utils.oncelogger.enabled | Enable/disable the "OnceLogger" which reduces noise for select repeated logs | `true` or `false` |
17+
| supportingFiles | Allows the user to define which supporting files will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of file names |
18+
| models | Allows the user to define which models will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of model names |
19+
| apis | Allows the user to define which apis will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of api names |
20+
| apiDocs | Allows the user to define if api docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
21+
| modelDocs | Allows the user to define if model docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
22+
| apiTests | Allows the user to define if api tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
23+
| modelTests | Allows the user to define if model tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
24+
| withXml | Allows the user to control support of XML generated constructs, where supported | none |
25+
26+
27+
## Note on Global Property declaration
28+
29+
There are _two ways_ to provide selective generation properties or "global properties". First, these can be passed as Java System Properties. Second, these can be passed via the global property tooling option (`--global-property` in CLI and `globalProperty` in Maven and Gradle configurations). This differentiation is new in version 5.0 with the removal of the `-D` CLI option and the renaming of `systemProperties`. If you're upgrading to OpenAPI Generator 5.0+
30+
31+
While the examples seen in [Customization](./customization.md) use the Java System Property syntax, keep in mind that the following are equivalent:
32+
33+
```sh
34+
java -Dmodels {jar} generate {opts}
35+
```
36+
37+
and
38+
39+
```sh
40+
java {jar} generate {opts} --global-property=models
41+
```
42+
43+
Why the two differing ways to provide the same properties? We previously accepted a `-D` tooling option which resembled Java System Property declaration. In older versions of OpenAPI Generator, the option modified the SystemProperties collection directly and was truly a "system property". This option changed during the 4.x release in an effort to make OpenAPI Generator thread-safe and isolate its configuration via thread locals. We no longer mutate System Properties. In the 4.x release and earlier, specifying the tooling `-D` option with system properties intended for other tools like swagger-parser rather than passing them as true Java System Properties would lead to unexpected behavior for the user; if our tool set the system property _after_ invoking certain code, it would seem to the user like Java System Properties weren't working!

docs/usage.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,14 @@ SYNOPSIS
260260
[(-a <authorization> | --auth <authorization>)]
261261
[--api-name-suffix <api name suffix>] [--api-package <api package>]
262262
[--artifact-id <artifact id>] [--artifact-version <artifact version>]
263-
[(-c <configuration file> | --config <configuration file>)]
264-
[-D <system properties>...] [--dry-run]
263+
[(-c <configuration file> | --config <configuration file>)] [--dry-run]
265264
[(-e <templating engine> | --engine <templating engine>)]
266265
[--enable-post-process-file]
267266
[(-g <generator name> | --generator-name <generator name>)]
268267
[--generate-alias-as-model] [--git-host <git host>]
269268
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
270-
[--group-id <group id>] [--http-user-agent <http user agent>]
269+
[--global-property <global properties>...] [--group-id <group id>]
270+
[--http-user-agent <http user agent>]
271271
(-i <spec file> | --input-spec <spec file>)
272272
[--ignore-file-override <ignore file override location>]
273273
[--import-mappings <import mappings>...]
@@ -323,10 +323,6 @@ OPTIONS
323323
different for each language. Run config-help -g {generator name}
324324
command for language-specific config options.
325325
326-
-D <system properties>
327-
sets specified system properties in the format of
328-
name=value,name=value (or multiple options, each with name=value)
329-
330326
--dry-run
331327
Try things out and report on potential changes (without actually
332328
making changes).
@@ -342,11 +338,11 @@ OPTIONS
342338
343339
--generate-alias-as-model
344340
Generate model implementation for aliases to map and array schemas.
345-
An 'alias' is an array, map, or list which is defined inline in a
346-
OpenAPI document and becomes a model in the generated code.
347-
A 'map' schema is an object that can have undeclared properties,
348-
i.e. the 'additionalproperties' attribute is set on that object.
349-
An 'array' schema is a list of sub schemas in a OAS document.
341+
An 'alias' is an array, map, or list which is defined inline in a
342+
OpenAPI document and becomes a model in the generated code. A 'map'
343+
schema is an object that can have undeclared properties, i.e. the
344+
'additionalproperties' attribute is set on that object. An 'array'
345+
schema is a list of sub schemas in a OAS document
350346
351347
--git-host <git host>
352348
Git host, e.g. gitlab.com.
@@ -357,6 +353,11 @@ OPTIONS
357353
--git-user-id <git user id>
358354
Git user ID, e.g. openapitools.
359355
356+
--global-property <global properties>
357+
sets specified global properties (previously called 'system
358+
properties') in the format of name=value,name=value (or multiple
359+
options, each with name=value)
360+
360361
--group-id <group id>
361362
groupId in generated pom.xml
362363

website/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const docusaurusConfig = {
4646
},
4747

4848
links: [
49-
{to: 'docs/installation', label: 'Install'},
49+
{to: 'docs/installation', label: 'Getting Started'},
5050
{to: 'docs/generators', label: 'Generators'},
5151
{to: 'docs/roadmap', label: 'Roadmap'},
5252
{to: "docs/faq", label: "FAQ" },

website/sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = {
55
'installation',
66
'plugins',
77
'online',
8-
'usage'
8+
'usage',
9+
'globals'
910
],
1011
'Extending': [
1112
'templating',

0 commit comments

Comments
 (0)