Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecations 5.0 #6060

Merged
merged 19 commits into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0f5fd3a
[breaking] Enforce vendor extension naming convention
jimschubert May 15, 2020
5e42868
[breaking] Rename system properties to global properties
jimschubert Apr 26, 2020
b4572c4
[docs] Update site with global properties list and usage explanation
jimschubert Apr 26, 2020
dc7eef7
Use proper vendor extension casing in all templates
jimschubert May 10, 2020
4408b95
Set remaining vendor extensions to convention of lower kebab-cased wi…
jimschubert Apr 27, 2020
00861fb
[samples] Regenerate
jimschubert Apr 27, 2020
5ff6f52
Update modules/openapi-generator/src/main/java/org/openapitools/codeg…
jimschubert May 8, 2020
110d331
[Samples] Regenerated!
jimschubert May 8, 2020
51a47cc
Fix -D conversion to additional-properties, missed in bat files
jimschubert May 10, 2020
c59d5ac
JERSEY2 option changed
jimschubert May 15, 2020
18ce686
Merge branch 'master' into remove-deprecations-5.0
jimschubert May 25, 2020
746d145
[samples] Regenerate
jimschubert May 25, 2020
4bb103b
[scala][finch] Fix remaining vendor extensions format to conventino
jimschubert May 25, 2020
f911781
Merge branch 'master' into remove-deprecations-5.0
jimschubert May 27, 2020
918ff2d
[scala] The -D option was replaced with --global-property
jimschubert May 27, 2020
afa2c42
[samples] Regenerate
jimschubert May 27, 2020
54826e2
Merge branch 'master' into remove-deprecations-5.0
jimschubert May 30, 2020
db5ec21
Fix -DskipFormModel usage which has been moved to --global-property s…
jimschubert May 30, 2020
d961b12
[samples] Regenerate
jimschubert May 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/apex-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g apex -o samples/client/petstore/apex -DskipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g apex -o samples/client/petstore/apex --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/ruby-client-petstore-faraday.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ find samples/client/petstore/ruby-faraday/spec -type f -not -name petstore_helpe

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore-faraday.json -o samples/client/petstore/ruby-faraday --additional-properties skipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore-faraday.json -o samples/client/petstore/ruby-faraday --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/ruby-client-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ find samples/client/petstore/ruby/spec -type f -not -name petstore_helper.rb -no

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby --additional-properties skipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/scala-finch-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/scala-finch -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-finch -o samples/server/petstore/scala-finch -DskipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/scala-finch -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-finch -o samples/server/petstore/scala-finch --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/scala-lagom-server-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/scala-lagom-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-lagom-server -o samples/server/petstore/scala-lagom-server -DskipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/scala-lagom-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-lagom-server -o samples/server/petstore/scala-lagom-server --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/scalaz-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/scalaz -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scalaz -o samples/client/petstore/scalaz -DskipFormModel=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/scalaz -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scalaz -o samples/client/petstore/scalaz --global-property skipFormModel=true $@"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/windows/android-petstore-httpclient.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ If Not Exist %executable% (
)

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g android -o samples\client\petstore\android\httpclient -Dlibrary=httpclient
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g android -o samples\client\petstore\android\httpclient --additional-properties library=httpclient

java %JAVA_OPTS% -jar %executable% %ags%
2 changes: 1 addition & 1 deletion bin/windows/go-experimental-petstore.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo Removing files and folders under %STUB_DIR%
del /F /S /Q %STUB_DIR%

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -t modules\openapi-generator\src\main\resources\%GENERATOR% -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstore
set ags=generate -t modules\openapi-generator\src\main\resources\%GENERATOR% -i %SPEC% -g %GENERATOR% -o %STUB_DIR% --additional-properties packageName=petstore

java %JAVA_OPTS% -jar %executable% %ags%

Expand Down
11 changes: 9 additions & 2 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ You can use this as additional dependency of the `openapi-generator-maven-plugin
If you publish your artifact to a distant maven repository, do not forget to add this repository as `pluginRepository` for your project.

## Selective generation
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:

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.

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

Expand Down Expand Up @@ -142,7 +143,13 @@ When using selective generation, _only_ the templates needed for the specific ge
To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to false) (this option is introduced at v3.2.2)

```sh
java -DskipFormModel=true
java -DskipFormModel=true <path to jar> generate …
```

or

```sh
java <path to jar> generate --global-property skipFormModel=true …
```

This option will be helpful to skip model generation due to the form parameter, which is defined differently in OAS3 as there's no form parameter in OAS3
Expand Down
43 changes: 43 additions & 0 deletions docs/global-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
id: globals
title: Global Properties
---

## Available Global Properties

| Property | Description | Acceptable value |
| -------- | ------------| ---------------- |
| debugOpenAPI | Dumps JSON formatted and fully parsed OpenAPI document during generation | none |
| debugModels | Dumps JSON formatted template-bound model information during generation | none |
| debugOperations | Dumps JSON formatted template-bound operation information during generation | none |
| debugSupportingFiles | Dumps JSON formatted Supporting File information during generation | none |
| verbose | Defines the verbosity | `true` or `false` |
| generateAliasAsModel | Defines whether primitive types defined at the model/schema level will be wrapped in a model | `true` or `false` |
| org.openapitools.codegen.utils.oncelogger.enabled | Enable/disable the "OnceLogger" which reduces noise for select repeated logs | `true` or `false` |
| 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 |
| 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 |
| 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 |
| apiDocs | Allows the user to define if api docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
| modelDocs | Allows the user to define if model docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
| apiTests | Allows the user to define if api tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
| modelTests | Allows the user to define if model tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
| withXml | Allows the user to control support of XML generated constructs, where supported | none |


## Note on Global Property declaration

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+

While the examples seen in [Customization](./customization.md) use the Java System Property syntax, keep in mind that the following are equivalent:

```sh
java -Dmodels {jar} generate {opts}
```

and

```sh
java {jar} generate {opts} --global-property=models
```

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!
25 changes: 13 additions & 12 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ SYNOPSIS
[(-a <authorization> | --auth <authorization>)]
[--api-name-suffix <api name suffix>] [--api-package <api package>]
[--artifact-id <artifact id>] [--artifact-version <artifact version>]
[(-c <configuration file> | --config <configuration file>)]
[-D <system properties>...] [--dry-run]
[(-c <configuration file> | --config <configuration file>)] [--dry-run]
[(-e <templating engine> | --engine <templating engine>)]
[--enable-post-process-file]
[(-g <generator name> | --generator-name <generator name>)]
[--generate-alias-as-model] [--git-host <git host>]
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
[--group-id <group id>] [--http-user-agent <http user agent>]
[--global-property <global properties>...] [--group-id <group id>]
[--http-user-agent <http user agent>]
(-i <spec file> | --input-spec <spec file>)
[--ignore-file-override <ignore file override location>]
[--import-mappings <import mappings>...]
Expand Down Expand Up @@ -324,10 +324,6 @@ OPTIONS
different for each language. Run config-help -g {generator name}
command for language-specific config options.

-D <system properties>
sets specified system properties in the format of
name=value,name=value (or multiple options, each with name=value)

--dry-run
Try things out and report on potential changes (without actually
making changes).
Expand All @@ -343,11 +339,11 @@ OPTIONS

--generate-alias-as-model
Generate model implementation for aliases to map and array schemas.
An 'alias' is an array, map, or list which is defined inline in a
OpenAPI document and becomes a model in the generated code.
A 'map' schema is an object that can have undeclared properties,
i.e. the 'additionalproperties' attribute is set on that object.
An 'array' schema is a list of sub schemas in a OAS document.
An 'alias' is an array, map, or list which is defined inline in a
OpenAPI document and becomes a model in the generated code. A 'map'
schema is an object that can have undeclared properties, i.e. the
'additionalproperties' attribute is set on that object. An 'array'
schema is a list of sub schemas in a OAS document

--git-host <git host>
Git host, e.g. gitlab.com.
Expand All @@ -358,6 +354,11 @@ OPTIONS
--git-user-id <git user id>
Git user ID, e.g. openapitools.

--global-property <global properties>
sets specified global properties (previously called 'system
properties') in the format of name=value,name=value (or multiple
options, each with name=value)

--group-id <group id>
groupId in generated pom.xml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public class Generate extends OpenApiGeneratorCommand {
+ "Pass in a URL-encoded string of name:header with a comma separating multiple values")
private String auth;

// TODO: Remove -D short option in 5.0
@Option(
name = {"-D", "--global-property"},
name = {"--global-property"},
title = "global properties",
description = "sets specified global properties (previously called 'system properties') in "
+ "the format of name=value,name=value (or multiple options, each with name=value)")
Expand Down
Loading