Update documentation with global propperty (#6863)

* update documentation with global propperty

* remove java opts

* remove KotlinNewServerCodegen

* update contributing.md
This commit is contained in:
William Cheng 2020-07-05 18:20:26 +08:00 committed by GitHub
parent 8c5c0597ae
commit 47b7a0d243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 172 additions and 102 deletions

View File

@ -85,12 +85,17 @@ For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master
To add test cases (optional) covering the change in the code generator, please refer to [modules/openapi-generator/src/test/java/org/openapitools/codegen](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen)
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under `bin` and `bin/openapi3` folder. For example, run `./bin/python-petstore.sh` and `./bin/openapi3/python-petstore.sh` to update the Python PetStore API client under [`samples/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/client/petstore/python) and [`samples/openapi3/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/openapi3/client/petstore/python). For Windows, the batch files can be found under `bin\windows` folder. (If you find that there are new files generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `./bin/python-petstore.sh -t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -rf :<artifactId>`, e.g. open a shell in `samples/client/petstore/python`, run `mvn integration-test -rf :PythonPetstoreClientTests`. The artifactId of the project can be found in the pom.xml file. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
- Finally, git commit the updated samples files: `git commit -a`
(`git add -A` if added files with new test cases)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)
To start the CI tests, you can:
- Run `mvn verify -Psamples`, assuming you have all the required tools installed to run tests for different languages.

View File

@ -77,7 +77,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
- [1.4 - Build Projects](#14---build-projects)
- [1.5 - Homebrew](#15---homebrew)
- [1.6 - Docker](#16---docker)
- [1.7 - NPM](#17---npm)
- [1.7 - NPM](#17---npm)
- [2 - Getting Started](#2---getting-started)
- [3 - Usage](#3---usage)
- [3.1 - Customization](#31---customization)
@ -457,29 +457,28 @@ NAME
SYNOPSIS
openapi-generator-cli generate
[(-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>...]
[--api-name-suffix <api name suffix>] [--api-package <api package>]
[--artifact-id <artifact id>] [--artifact-version <artifact version>]
[(-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-repo-id <git repo id>]
[--git-user-id <git user id>] [--group-id <group id>]
[--generate-alias-as-model] [--git-host <git host>]
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
[--global-property <global properties>...] [--group-id <group id>]
[--http-user-agent <http user agent>]
(-i <spec file> | --input-spec <spec file>)
[(-i <spec file> | --input-spec <spec file>)]
[--ignore-file-override <ignore file override location>]
[--import-mappings <import mappings>...]
[--instantiation-types <instantiation types>...]
[--invoker-package <invoker package>]
[--language-specific-primitives <language specific primitives>...]
[--library <library>] [--log-to-stderr] [--minimal-update]
[--legacy-discriminator-behavior] [--library <library>]
[--log-to-stderr] [--minimal-update]
[--model-name-prefix <model name prefix>]
[--model-name-suffix <model name suffix>]
[--model-package <model package>]
[(-o <output directory> | --output <output directory>)]
[(-p <additional properties> | --additional-properties <additional properties>)...]
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
[--package-name <package name>] [--release-note <release note>]
[--remove-operation-id-prefix]
[--reserved-words-mappings <reserved word mappings>...]
@ -509,13 +508,12 @@ mvn package
```
Other languages have petstore samples, too:
```sh
./bin/android-petstore-all.sh
./bin/java-petstore-all.sh
./bin/objc-petstore.sh
```
... and others. [Here is a list of all scripts.](https://github.com/OpenAPITools/openapi-generator/wiki/Samples-folder#scripts)
- [Swift5](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift5)
- [Ruby](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/ruby)
- [Kotlin](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/kotlin)
... and more.
### [3.1 - Customization](#table-of-contents)

View File

@ -45,7 +45,7 @@ Once built, `run-in-docker.sh` will act as an executable for openapi-generator-c
./run-in-docker.sh list # Executes 'list' command for openapi-generator-cli
./run-in-docker.sh /gen/bin/generate-samples.sh /gen/bin/configs/go-petstore.yaml # Builds the Go client
./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
-g go -o /gen/out/go-petstore -DpackageName=petstore # generates go client, outputs locally to ./out/go-petstore
-g go -o /gen/out/go-petstore --packageName=petstore # generates go client, outputs locally to ./out/go-petstore
```
### Docker in Vagrant

View File

@ -89,12 +89,17 @@ For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master
To add test cases (optional) covering the change in the code generator, please refer to [modules/openapi-generator/src/test/java/org/openapitools/codegen](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen)
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under `bin` and `bin/openapi3` folder. For example, run `./bin/python-petstore.sh` and `./bin/openapi3/python-petstore.sh` to update the Python PetStore API client under [`samples/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/client/petstore/python) and [`samples/openapi3/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/openapi3/client/petstore/python). For Windows, the batch files can be found under `bin\windows` folder. (If you find that there are new files generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `./bin/python-petstore.sh -t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -rf :<artifactId>`, e.g. open a shell in `samples/client/petstore/python`, run `mvn integration-test -rf :PythonPetstoreClientTests`. The artifactId of the project can be found in the pom.xml file. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
- Finally, git commit the updated samples files: `git commit -a`
(`git add -A` if added files with new test cases)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)
To start the CI tests, you can:
- Run `mvn verify -Psamples`, assuming you have all the required tools installed to run tests for different languages.

View File

@ -93,49 +93,49 @@ If you publish your artifact to a distant maven repository, do not forget to add
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:
The default is generate *everything* supported by the specific library. Once you enable a feature, it will restrict the contents generated:
```sh
# generate only models
java -Dmodels {opts}
--global-property models
# generate only apis
java -Dapis {opts}
--global-property apis
# generate only supporting files
java -DsupportingFiles
--global-property supportingFiles
# generate models and supporting files
java -Dmodels -DsupportingFiles
--global-property models,supportingFiles
```
To control the specific files being generated, you can pass a CSV list of what you want:
```sh
# generate the User and Pet models only
-Dmodels=User,Pet
--global-property models="User,Pet"
# generate the User model and the supportingFile `StringUtil.java`:
-Dmodels=User -DsupportingFiles=StringUtil.java
--global-property models=User,supportingFiles=StringUtil.java
```
To control generation of docs and tests for api and models, pass false to the option. For api, these options are `-DapiTests=false` and `-DapiDocs=false`. For models, `-DmodelTests=false` and `-DmodelDocs=false`.
These options default to true and don't limit the generation of the feature options listed above (like `-Dapi`):
To control generation of docs and tests for api and models, pass false to the option. For api, these options are `--global-property apiTests=false,apiDocs=false`. For models, `--global-property modelTests=false,modelDocs=false`.
These options default to true and don't limit the generation of the feature options listed above (like `--global-property api`):
```sh
# generate only models (with tests and documentation)
java -Dmodels {opts}
--global-property models
# generate only models (with tests but no documentation)
java -Dmodels -DmodelDocs=false {opts}
--global-property models,modelDocs=false
# generate only User and Pet models (no tests and no documentation)
java -Dmodels=User,Pet -DmodelTests=false {opts}
--global-property models="User,Pet",modelTests=false
# generate only apis (without tests)
java -Dapis -DapiTests=false {opts}
--global-property apis,apiTests=false
# generate only apis (modelTests option is ignored)
java -Dapis -DmodelTests=false {opts}
--global-property apis,modelTests=false
```
When using selective generation, _only_ the templates needed for the specific generation will be used.
@ -143,13 +143,7 @@ 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 <path to jar> generate …
```
or
```sh
java <path to jar> generate --global-property skipFormModel=true …
--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

View File

@ -13,48 +13,117 @@ For example, if you generate the aspnetcore generator passing `--minimal-update
```bash
export JAVA_OPTS="-Dlog.level=off"
./bin/aspnetcore-petstore-server.sh --minimal-update --dry-run
./bin/generate-samples.sh ./bin/configs/lua.yaml -- --minimal-update --dry-run
```
You'll see the output similar to the following:
```
# START SCRIPT: ./bin/aspnetcore-petstore-server.sh
```bash
$ ./bin/generate-samples.sh ./bin/configs/lua.yaml -- --minimal-update --dry-run
# START SCRIPT: ./bin/generate-samples.sh
This script generates all configs under bin/configs by default.
You may generate a targeted script or set of scripts using glob patterns.
For example:
./bin/generate-samples.sh bin/configs/java-*
You may generate a single config with additional options if you use -- to
separate the single config file from the generator arguments.
For example:
./bin/generate-samples.sh bin/configs/java-vertx.yaml -- --global-property debugModels=true
[main] INFO o.o.codegen.DefaultGenerator - Generating with dryRun=true
[main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: lua (client)
[main] INFO o.o.codegen.DefaultGenerator - Generator 'lua' is considered beta.
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] INFO o.o.codegen.DefaultGenerator - Model inline_object (marked as unused due to form parameters) is generated due to the system property skipFormModel=false (default)
[main] INFO o.o.codegen.DefaultGenerator - Model inline_object_1 (marked as unused due to form parameters) is generated due to the system property skipFormModel=false (default)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN o.o.codegen.DefaultCodegen - Multiple MediaTypes found, using only the first one
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] ERROR o.o.codegen.DefaultGenerator -
Dry Run Results:
s /path/to/aspnetcore/.openapi-generator-ignore
n /path/to/aspnetcore/.openapi-generator/VERSION
n /path/to/aspnetcore/Org.OpenAPITools.sln
n /path/to/aspnetcore/README.md
n /path/to/aspnetcore/build.bat
n /path/to/aspnetcore/build.sh
w /path/to/aspnetcore/src/Org.OpenAPITools/.gitignore
n /path/to/aspnetcore/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Dockerfile
n /path/to/aspnetcore/src/Org.OpenAPITools/Filters/BasePathFilter.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/ApiResponse.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/Category.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/Order.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/Pet.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/Tag.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Models/User.cs
n /path/to/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj
n /path/to/aspnetcore/src/Org.OpenAPITools/Program.cs
w /path/to/aspnetcore/src/Org.OpenAPITools/Properties/launchSettings.json
n /path/to/aspnetcore/src/Org.OpenAPITools/Startup.cs
w /path/to/aspnetcore/src/Org.OpenAPITools/appsettings.json
w /path/to/aspnetcore/src/Org.OpenAPITools/wwwroot/README.md
w /path/to/aspnetcore/src/Org.OpenAPITools/wwwroot/index.html
n /path/to/aspnetcore/src/Org.OpenAPITools/wwwroot/openapi-original.json
w /path/to/aspnetcore/src/Org.OpenAPITools/wwwroot/web.config
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/.openapi-generator-ignore
n /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/.openapi-generator/VERSION
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/api_response_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/category_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/inline_object_1_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/inline_object_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/order_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/pet_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/pet_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/store_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/tag_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/user_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/user_spec.lua
States:
- w Write
- n Write if New/Updated
- i Ignored
- s Skipped Overwrite
- k Skipped by user option(s)
- e Error evaluating file write state
[main] ERROR o.o.codegen.DefaultGenerator -
Dry Run Results:
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/.openapi-generator-ignore
n /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/.openapi-generator/VERSION
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/api_response_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/category_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/inline_object_1_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/inline_object_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/order_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/pet_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/pet_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/store_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/tag_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/user_api_spec.lua
k /Users/williamcheng/Code/openapi-generator/samples/client/petstore/lua/spec/user_spec.lua
States:
@ -78,13 +147,13 @@ If you find an operation that you feel should result in a different state, pleas
Sometimes, you may have issues with variables in your templates. As discussed in the [templating](./templating.md) docs, we offer a variety of system properties for inspecting the models bound to templates.
<dl>
<dt><code>-DdebugOpenAPI</code></dt>
<dt><code>--global-property debugOpenAPI</code></dt>
<dd>Prints out the JSON model of the OpenAPI Document, as seen by OpenAPI Generator</dd>
<dt><code>-DdebugModels</code></dt>
<dt><code>--global-property debugModels</code></dt>
<dd>Prints out the JSON model passed to model templates</dd>
<dt><code>-DdebugOperations</code></dt>
<dt><code>--global-property debugOperations</code></dt>
<dd>Prints out the JSON model passed to operation (api) templates</dd>
<dt><code>-DdebugSupportingFiles</code></dt>
<dt><code>--global-property debugSupportingFiles</code></dt>
<dd>Prints out the JSON model passed to supporting files</dd>
</dl>
@ -94,14 +163,13 @@ One or more of these properties can be passed alongside other command line optio
openapi-generator generate -g go \
-o out \
-i petstore-minimal.yaml \
-DdebugModels \
-DdebugOperations
--global-property debugModels,debugOperations
```
Or you can add these to your `JAVA_OPTS` environment variable (this applies to every invocation of the tool):
```bash
export JAVA_OPTS="${JAVA_OPTS} -DdebugModels -DdebugOperations"
export JAVA_OPTS="${JAVA_OPTS} --global-property debugModels,debugOperations"
```
> NOTE: Globally available system options like these will apply to all invocations of the generator (CLI and plugins)

View File

@ -41,7 +41,7 @@ mvn clean package
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.json \
-l java --library=okhttp-gson \
-D hideGenerationTimestamp=true \
--additional-properties hideGenerationTimestamp=true \
-o /var/tmp/java/okhttp-gson/
```

View File

@ -23,7 +23,7 @@ The minimum set of files required to create a new generator are:
- Should include a README explaining usage
- Must include an `api.mustache`
- Exists under `modules/openapi-generator/src/main/resources/` (plus `embeddedTemplate` dir value, see below)
* Sample scripts under `./bin` and `./bin/windows`
* Sample scripts under `./bin`
- Gives users a "real life" example of generated output
- Samples are used by CI to verify generators and test for regressions in some cases

View File

@ -157,7 +157,7 @@ index a4d0f9f..49b17c7 100644
```
Next, we'll find the code which generates API methods. You'll see `{{#operations}}{{#operation}}` which is a mustache "loop" which executes the template logic if the model applied to the template has an `operations` array, and a non-null `operation` instance in that array. You can pass `-DdebugOpenAPI` when generating via CLI to inspect the full object model.
Next, we'll find the code which generates API methods. You'll see `{{#operations}}{{#operation}}` which is a mustache "loop" which executes the template logic if the model applied to the template has an `operations` array, and a non-null `operation` instance in that array. You can pass `--global-property debugOpenAPI=true` when generating via CLI to inspect the full object model.
Further down in `api.mustache`, find implementation of the method call, and add the `@Loggable` annotation. This template is easy because it has a single method implementation.
@ -467,7 +467,7 @@ java $JAVA_OPTS -cp /your/path/build/libs/pebble-template-adapter-1.0-SNAPSHOT-a
-e pebble \
-o /tmp/pebble-example/out \
-t /tmp/pebble-example/templates \
-Dmodels -DmodelDocs=false -DmodelTests=false -Dapis -DapiTests=false -DapiDocs=false
--global-property models,modelDocs,modelTests,apis,apiTests,apiDocs
```
Notice how we've targeted our custom template engine adapter via `-e pebble`. If you don't include the SPI file under `META-INF/services`, you'll need to specify the exact classpath: `org.openapitools.examples.templating.PebbleTemplateAdapter`. Notice that the target class here matches the Kotlin class name. This is because of the `@file:JvmName` annotation.
@ -531,7 +531,7 @@ Examples for the following structures will be presented using the following spec
### Operations
> Inspect operation structures passed to templates with system property `-DdebugOpenAPI`
> Inspect operation structures passed to templates with system property `--global-property debugOpenAPI=true`
>
> Example:
>
@ -539,7 +539,7 @@ Examples for the following structures will be presented using the following spec
> openapi-generator generate -g go \
> -o out \
> -i petstore-minimal.yaml \
> -DdebugOpenAPI
> --global-property debugOpenAPI=true
> ```
>
@ -563,7 +563,7 @@ Here, an Operation with tag `Pet` will generate two files: `SWGPetApi.h` and `SW
### Models
> Inspect models passed to templates with system property `-DdebugModels`
> Inspect models passed to templates with system property `--global-property debugModels=true`
>
> Execute:
>
@ -571,13 +571,13 @@ Here, an Operation with tag `Pet` will generate two files: `SWGPetApi.h` and `SW
> openapi-generator generate -g go \
> -o out \
> -i petstore-minimal.yaml \
> -DdebugModels
> --global-property debugModels=true
> ```
>
Each model identified inside the generator will be passed into the `Models` data structure and will generate a new model file (or files) for each model.
A `Pet` model with three properties will provide a _lot_ of information about the type and properties. The output from `-DdebugModels` is presented in truncated format here.
A `Pet` model with three properties will provide a _lot_ of information about the type and properties. The output from `--global-property debugModels=true` is presented in truncated format here.
```json
[ {
@ -788,7 +788,7 @@ We expose the same properties in multiple sets because this allows us to conditi
### supportingFiles
> Inspect supportingFiles passed to templates with system property `-DdebugSupportingFiles`
> Inspect supportingFiles passed to templates with system property `--global-property debugSupportingFiles=true`
>
> Execute:
>
@ -796,7 +796,7 @@ We expose the same properties in multiple sets because this allows us to conditi
> openapi-generator generate -g go \
> -o out \
> -i petstore-minimal.yaml \
> -DdebugSupportingFiles
> --global-property debugSupportingFiles=true
> ```
>

View File

@ -399,7 +399,7 @@ OPTIONS
--log-to-stderr
write all log messages (not just errors) to STDOUT. Useful for
piping the JSON output of debug options (e.g. `-DdebugOperations`)
piping the JSON output of debug options (e.g. `--global-property debugOperations=true`)
to an external parser directly while testing a generator.
--minimal-update

View File

@ -126,4 +126,4 @@ org.openapitools.codegen.languages.TypeScriptInversifyClientCodegen
org.openapitools.codegen.languages.TypeScriptJqueryClientCodegen
org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen