Compare commits

..

1 Commits

Author SHA1 Message Date
William Cheng
fd111791bb deprecated licenseUrl with license 2020-08-10 12:53:31 +08:00
3990 changed files with 118913 additions and 28929 deletions

View File

@@ -54,7 +54,7 @@ jobs:
- name: Upload Maven build artifact - name: Upload Maven build artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
if: matrix.java == '8' && matrix.os == 'ubuntu-latest' if: matrix.java == '8'
with: with:
name: artifact name: artifact
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
@@ -65,10 +65,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest, windows-latest]
# include:
# - os: windows-latest
# flags: --skip-docs
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -77,11 +74,7 @@ jobs:
with: with:
name: artifact name: artifact
- name: Run Ensures Script - name: Run Ensures Script
shell: bash
run: | run: |
git config --global core.fileMode false
git config --global core.safecrlf false
git config --global core.autocrlf true
mkdir -p modules/openapi-generator-cli/target/ mkdir -p modules/openapi-generator-cli/target/
mv artifact/openapi-generator-cli.jar modules/openapi-generator-cli/target/ mv artifact/openapi-generator-cli.jar modules/openapi-generator-cli/target/
./bin/utils/ensure-up-to-date ${{ matrix.flags }} ./bin/utils/ensure-up-to-date

7
.gitignore vendored
View File

@@ -174,14 +174,7 @@ samples/client/petstore/python-asyncio/.pytest_cache/
samples/client/petstore/python-tornado/.venv/ samples/client/petstore/python-tornado/.venv/
# PHP # PHP
samples/client/petstore/php/OpenAPIClient-php/composer.lock
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/openapi3/server/petstore/php-ze-ph/composer.lock
samples/server/petstore/php-laravel/lib/composer.lock
samples/server/petstore/php-lumen/lib/composer.lock samples/server/petstore/php-lumen/lib/composer.lock
samples/server/petstore/php-slim4/composer.lock
samples/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/server/petstore/php-ze-ph/composer.lock
# ts # ts
samples/client/petstore/typescript-angular2/npm/npm-debug.log samples/client/petstore/typescript-angular2/npm/npm-debug.log

View File

@@ -3,7 +3,10 @@
## ##
## You can build _just_ this part with: ## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.cli.dockerfile . ## docker --target builder -t container-name:builder -f .hub.cli.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -15,10 +18,11 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
## The final (release) image ## The final (release) image
## The resulting container here only needs the target jar ## The resulting container here only needs the target jar
## and ca-certificates (to be able to query HTTPS hosted specs) ## and ca-certificates (to be able to query HTTPS hosted specs)
FROM openjdk:11.0.8-jre-slim-buster FROM openjdk:8-jre-alpine
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
RUN apk --no-cache add ca-certificates bash
RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target
WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target

View File

@@ -3,7 +3,10 @@
## ##
## You can build _just_ this part with: ## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.online.dockerfile . ## docker --target builder -t container-name:builder -f .hub.online.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -14,7 +17,7 @@ RUN mvn -am -pl "modules/openapi-generator-online" package
## The final (release) image ## The final (release) image
## The resulting container here only needs the target jar ## The resulting container here only needs the target jar
FROM openjdk:11.0.8-jre-slim-buster FROM openjdk:8-jre-alpine
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
ENV TARGET_DIR /generator ENV TARGET_DIR /generator

View File

@@ -1,4 +1,7 @@
FROM maven:3.6.3-jdk-11-openj9 FROM jimschubert/8-jdk-alpine-mvn:1.0
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -26,6 +29,6 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["help"] CMD ["help"]

View File

@@ -1,22 +1,22 @@
<h1 align="center">OpenAPI Generator</h1> <h1 align="center">OpenAPI Generator</h1>
<div align="center"> <div align="center">
[![Stable releaases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) ![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator) [Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=master)](https://app.bitrise.io/app/4a2b10a819d12b67)
![Check Supported Java Versions](https://github.com/openapi-generator/openapi-generator/workflows/Check%20Supported%20Java%20Versions/badge.svg)
</div> </div>
<div align="center"> <div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [![Jion the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Stable releaases in the Maven store](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/openapitools/openapi-generator/Check%20Supported%20Java%20Versions/master?label=Check%20Supported%20Java%20Versions&logo=github&logoColor=green)](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
</div> </div>
@@ -627,7 +627,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager) - [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
- [QEDIT](https://qed-it.com) - [QEDIT](https://qed-it.com)
- [Qulix Systems](https://www.qulix.com) - [Qulix Systems](https://www.qulix.com)
- [Raksul](https://corp.raksul.com)
- [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch) - [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch)
- [RedHat](https://www.redhat.com) - [RedHat](https://www.redhat.com)
- [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development) - [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development)
@@ -642,7 +641,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [TUI InfoTec GmbH](http://www.tui-infotec.com/) - [TUI InfoTec GmbH](http://www.tui-infotec.com/)
- [unblu inc.](https://www.unblu.com/) - [unblu inc.](https://www.unblu.com/)
- [Veamly](https://www.veamly.com/) - [Veamly](https://www.veamly.com/)
- [wbt-solutions](https://www.wbt-solutions.de/)
- [Woleet](https://www.woleet.io/) - [Woleet](https://www.woleet.io/)
- [WSO2](https://wso2.com/) - [WSO2](https://wso2.com/)
- [Vouchery.io](https://vouchery.io) - [Vouchery.io](https://vouchery.io)
@@ -771,7 +769,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1) - 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1)
- 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto) - 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto)
- 2020-08-03 - [Criando Bibliotecas para APIs RESTful com OpenAPI, Swagger Editor e OpenAPI Generator](https://medium.com/@everisBrasil/criando-bibliotecas-para-apis-restful-com-openapi-swagger-editor-e-openapi-generator-75349a6420fd) by [everis Brasil (an NTT DATA Company)](https://medium.com/@everisBrasil) - 2020-08-03 - [Criando Bibliotecas para APIs RESTful com OpenAPI, Swagger Editor e OpenAPI Generator](https://medium.com/@everisBrasil/criando-bibliotecas-para-apis-restful-com-openapi-swagger-editor-e-openapi-generator-75349a6420fd) by [everis Brasil (an NTT DATA Company)](https://medium.com/@everisBrasil)
- 2020-08-19 - [マイクロサービスを連携してみよう](https://thinkit.co.jp/article/17704) by [岡井 裕矢(おかい ゆうや)](https://thinkit.co.jp/author/17588), [泉 勝(いずみ まさる)](https://thinkit.co.jp/author/17705) at [Think ITシンクイット](https://thinkit.co.jp/)
## [6 - About Us](#table-of-contents) ## [6 - About Us](#table-of-contents)

View File

@@ -1,5 +1,5 @@
version: '{branch}-{build}' version: '{branch}-{build}'
image: Visual Studio 2019 image: Visual Studio 2017
hosts: hosts:
petstore.swagger.io: 127.0.0.1 petstore.swagger.io: 127.0.0.1
install: install:
@@ -53,8 +53,8 @@ build_script:
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
test_script: test_script:
# test c# API client (netcore) # test c# API client (netcore)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client # test c# API client
- nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor - nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
# test c# API client (with PropertyChanged) # test c# API client (with PropertyChanged)

View File

@@ -1,5 +1,5 @@
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient outputDir: samples/client/petstore/csharp/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,6 +1,6 @@
generatorName: csharp-netcore generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,8 +1,9 @@
generatorName: csharp-netcore generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCore outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCore
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
targetFramework: netcoreapp2.0 targetFramework: netcoreapp2.0
useCompareNetObjects: "true" useCompareNetObjects: true
license: BSD-2-Clause OR MIT

View File

@@ -0,0 +1,7 @@
generatorName: flash
outputDir: samples/client/petstore/flash
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/flash
additionalProperties:
invokerPackage: org.openapitools
packageName: org.openapitools

View File

@@ -4,7 +4,7 @@ library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
java8: true java8: "false"
useBeanValidation: true useBeanValidation: true
artifactId: spring-boot-beanvalidation artifactId: spring-boot-beanvalidation
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"

View File

@@ -5,5 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
artifactId: springboot-delegate artifactId: springboot-delegate
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
java8: true java8: "false"
delegatePattern: "true" delegatePattern: "true"

View File

@@ -4,9 +4,8 @@ library: spring-mvc
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
java8: true java8: "false"
booleanGetterPrefix: get booleanGetterPrefix: get
artifactId: spring-mvc-server artifactId: spring-mvc-server
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
serverPort: "8002" serverPort: "8002"
additionalModelTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFilter(value = "filter-name");@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = "id")'

View File

@@ -19,13 +19,6 @@ if [ $status -ne 0 ]; then
exit $status exit $status
fi fi
if [[ "--skip-docs" == "${1}" ]]; then
# We export here rather than modify our iterable so that:
# - the scripts can show they ran and echo meaningfully
# - the scripts can do cleanup (if necessary) when skipped
export SKIP_EXPORT_DOCS=true
fi
# Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath) # Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath)
# Docs should always be run, regardless of batch or operation. # Docs should always be run, regardless of batch or operation.
declare -a always_iterate=( declare -a always_iterate=(

View File

@@ -5,11 +5,6 @@ echo "# START SCRIPT: ${SCRIPT}"
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [[ "true" == "${SKIP_EXPORT_DOCS}" ]]; then
echo "Skipping doc exports. Note that docs generated by Windows may break paths as they have not yet been normalized to OS-specific paths."
exit 0
fi
for GENERATOR in $(java -jar ${executable} list --short --include all | sed -e 's/,/\'$'\n''/g') for GENERATOR in $(java -jar ${executable} list --short --include all | sed -e 's/,/\'$'\n''/g')
do do
./bin/utils/export_generator.sh ${GENERATOR} ./bin/utils/export_generator.sh ${GENERATOR}

View File

@@ -1,70 +0,0 @@
---
id: file-post-processing
title: File post-processing
---
Each tool (CLI and plugins) supports enabling file post-processing at a high-level. Enabling this option allows for generators which support post-processing to call some external process for each generated file, passing the file path to that tool. The external tool must be defined in an environment variable supported by the generator.
Note that:
* this option is `--enable-post-process-file` in the CLI and `enablePostProcessFile` in plugins
* we require _both_ specifying the environment variable _and_ enabling the option at the tooling level; this feature is opt-in for security
* file processing occurs one at a time
* the external tool may be a custom script which invokes multiple tools
Also refer to the relevant documentation for [CLI](./usage.md), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.md), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc), or [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md).
## Supported Environment Variables
The following environment variables are supported by their respective generators:
<!-- query with: grep -Rn '_POST_PROCESS_FILE"' modules | grep -Eo '[^"]+_POST_PROCESS_FILE' | sort -u -->
* `CPP_POST_PROCESS_FILE`
* `CSHARP_POST_PROCESS_FILE`
* `C_POST_PROCESS_FILE`
* `DART_POST_PROCESS_FILE`
* `FSHARP_POST_PROCESS_FILE`
* `GO_POST_PROCESS_FILE`
* `HASKELL_POST_PROCESS_FILE`
* `JAVA_POST_PROCESS_FILE`
* `JS_POST_PROCESS_FILE`
* `KOTLIN_POST_PROCESS_FILE`
* `OCAML_POST_PROCESS_FILE`
* `PERL_POST_PROCESS_FILE`
* `PHP_POST_PROCESS_FILE`
* `POWERSHELL_POST_PROCESS_FILE`
* `PYTHON_POST_PROCESS_FILE`
* `RUBY_POST_PROCESS_FILE`
* `RUST_POST_PROCESS_FILE`
* `SCALA_POST_PROCESS_FILE`
* `SWIFT_POST_PROCESS_FILE`
* `TS_POST_PROCESS_FILE`
## Example
Let's see how to pass Ruby generated files to Rubocop, a static code analysis/linter/formatter tool.
```
# First, export the required environment variable
export RUBY_POST_PROCESS_FILE="/usr/local/bin/rubocop -a"
export OPENAPI_DOC="https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
# Invoke the generator with --enable-post-process-file
openapi-generator generate --enable-post-process-file -i $OPENAPI_DOC -g ruby -o .out-ruby/
```
You will now see messages logged about which files have been processed:
```
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.rspec
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/spec_helper.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/spec_helper.rb
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/configuration_spec.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/configuration_spec.rb
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/api_client_spec.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/api_client_spec.rb
[main] INFO o.o.codegen.TemplateManager - Skipped /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.)
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator/VERSION
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator/FILES
```

View File

@@ -27,7 +27,7 @@ The following generators are available:
* [elm](generators/elm.md) * [elm](generators/elm.md)
* [erlang-client](generators/erlang-client.md) * [erlang-client](generators/erlang-client.md)
* [erlang-proper](generators/erlang-proper.md) * [erlang-proper](generators/erlang-proper.md)
* [flash-deprecated (deprecated)](generators/flash-deprecated.md) * [flash](generators/flash.md)
* [go](generators/go.md) * [go](generators/go.md)
* [go-experimental (experimental)](generators/go-experimental.md) * [go-experimental (experimental)](generators/go-experimental.md)
* [groovy](generators/groovy.md) * [groovy](generators/groovy.md)

View File

@@ -7,7 +7,7 @@ sidebar_label: aspnetcore
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|aspnetCoreVersion|ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)| |2.2| |aspnetCoreVersion|ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)| |2.2|
|buildTarget|Target to build an application or library| |program| |buildTarget|Target to build an application or library| |program|
|classModifier|Class Modifier for controller classes: Empty string or abstract.| || |classModifier|Class Modifier can be empty, abstract| ||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2| |compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum| |enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumValueSuffix|Suffix that will be appended to all enum values.| |Enum| |enumValueSuffix|Suffix that will be appended to all enum values.| |Enum|

View File

@@ -1,6 +1,6 @@
--- ---
title: Config Options for flash-deprecated title: Config Options for flash
sidebar_label: flash-deprecated sidebar_label: flash
--- ---
| Option | Description | Values | Default | | Option | Description | Values | Default |

View File

@@ -5,11 +5,9 @@ sidebar_label: go-gin-server
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|apiPath|Name of the folder that contains the Go source code| |go|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi| |packageName|Go package name (convention: lowercase).| |openapi|
|packageVersion|Go package version.| |1.0.0| |packageVersion|Go package version.| |1.0.0|
|serverPort|The network port the generated server binds to| |8080|
## IMPORT MAPPING ## IMPORT MAPPING

View File

@@ -34,7 +34,6 @@ sidebar_label: java
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null|
|modelPackage|package for generated models| |org.openapitools.client.model| |modelPackage|package for generated models| |org.openapitools.client.model|
|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| |parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|

View File

@@ -33,7 +33,7 @@ sidebar_label: jaxrs-cxf-cdi
|invokerPackage|root package for generated code| |org.openapitools.api| |invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dt>**kumuluzee**</dt><dd>Server using KumuluzEE</dd></dl>|&lt;default&gt;| |library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|&lt;default&gt;|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model| |modelPackage|package for generated models| |org.openapitools.model|

View File

@@ -33,7 +33,7 @@ sidebar_label: jaxrs-spec
|invokerPackage|root package for generated code| |org.openapitools.api| |invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dt>**kumuluzee**</dt><dd>Server using KumuluzEE</dd></dl>|&lt;default&gt;| |library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|&lt;default&gt;|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model| |modelPackage|package for generated models| |org.openapitools.model|

View File

@@ -0,0 +1,199 @@
---
title: Config Options for nodejs-server-deprecated
sidebar_label: nodejs-server-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null|
|googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|serverPort|TCP port to listen on.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>debugger</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>instanceof</li>
<li>let</li>
<li>new</li>
<li>return</li>
<li>super</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>try</li>
<li>typeof</li>
<li>var</li>
<li>void</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,248 @@
---
title: Config Options for powershell-experimental
sidebar_label: powershell-experimental
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null|
|commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools|
|packageVersion|Package version (e.g. 0.1.2).| |0.1.2|
|powershellGalleryUrl|URL to the module in PowerShell Gallery (e.g. https://www.powershellgallery.com/packages/PSTwitter/).| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Byte</li>
<li>Byte[]</li>
<li>Char</li>
<li>Decimal</li>
<li>Double</li>
<li>Guid</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>ProgressRecord</li>
<li>SByte</li>
<li>SecureString</li>
<li>Single</li>
<li>String</li>
<li>System.DateTime</li>
<li>System.IO.FileInfo</li>
<li>TimeSpan</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>Uri</li>
<li>Version</li>
<li>XmlDocument</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>args</li>
<li>begin</li>
<li>break</li>
<li>catch</li>
<li>consolefilename</li>
<li>continue</li>
<li>data</li>
<li>do</li>
<li>dynamicparam</li>
<li>else</li>
<li>elseif</li>
<li>end</li>
<li>error</li>
<li>event</li>
<li>eventargs</li>
<li>eventsubscriber</li>
<li>executioncontext</li>
<li>exit</li>
<li>false</li>
<li>filter</li>
<li>finally</li>
<li>for</li>
<li>foreach</li>
<li>from</li>
<li>function</li>
<li>home</li>
<li>host</li>
<li>if</li>
<li>in</li>
<li>input</li>
<li>lastexitcode</li>
<li>local</li>
<li>matches</li>
<li>myinvocation</li>
<li>nestedpromptlevel</li>
<li>null</li>
<li>param</li>
<li>pid</li>
<li>private</li>
<li>process</li>
<li>profile</li>
<li>pscmdlet</li>
<li>pscommandpath</li>
<li>psculture</li>
<li>psdebugcontext</li>
<li>pshome</li>
<li>psitem</li>
<li>psscriptroot</li>
<li>pssenderinfo</li>
<li>psuiculture</li>
<li>psversiontable</li>
<li>return</li>
<li>sender</li>
<li>shellid</li>
<li>stacktrace</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>trap</li>
<li>true</li>
<li>try</li>
<li>until</li>
<li>where</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,221 @@
---
title: Config Options for scala-akka-http
sidebar_label: scala-akka-http
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|akkaHttpVersion|The version of akka-http| |10.1.10|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|artifactId|artifactId| |openapi-scala-akka-http-server|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|invokerPackage|root package for generated code| |org.openapitools.server|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|ListBuffer|scala.collection.mutable.ListBuffer|
|ListSet|scala.collection.immutable.ListSet|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|ListBuffer|
|map|Map|
|set|Set|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>List</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>Seq</li>
<li>String</li>
<li>boolean</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>def</li>
<li>do</li>
<li>else</li>
<li>extends</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>for</li>
<li>forsome</li>
<li>if</li>
<li>implicit</li>
<li>import</li>
<li>lazy</li>
<li>match</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>override</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>return</li>
<li>sealed</li>
<li>super</li>
<li>this</li>
<li>throw</li>
<li>trait</li>
<li>true</li>
<li>try</li>
<li>type</li>
<li>val</li>
<li>var</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@@ -0,0 +1,265 @@
---
title: Config Options for swift2-deprecated
sidebar_label: swift2-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>Data</li>
<li>Double</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>LINE</li>
<li>Protocol</li>
<li>Self</li>
<li>String</li>
<li>Type</li>
<li>Void</li>
<li>as</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>defer</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>fileprivate</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>guard</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>indirect</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>open</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>repeat</li>
<li>required</li>
<li>rethrows</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>throw</li>
<li>throws</li>
<li>true</li>
<li>try</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
<li>willSet</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,259 @@
---
title: Config Options for swift3-deprecated
sidebar_label: swift3-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>Data</li>
<li>Double</li>
<li>Error</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>LINE</li>
<li>Protocol</li>
<li>Response</li>
<li>Self</li>
<li>String</li>
<li>Type</li>
<li>URL</li>
<li>Void</li>
<li>as</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>required</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>true</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

317
docs/generators/swift4.md Normal file
View File

@@ -0,0 +1,317 @@
---
title: Config Options for swift4
sidebar_label: swift4
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Data</li>
<li>Date</li>
<li>Decimal</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>URL</li>
<li>UUID</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>#available</li>
<li>#colorLiteral</li>
<li>#column</li>
<li>#else</li>
<li>#elseif</li>
<li>#endif</li>
<li>#file</li>
<li>#fileLiteral</li>
<li>#function</li>
<li>#if</li>
<li>#imageLiteral</li>
<li>#line</li>
<li>#selector</li>
<li>#sourceLocation</li>
<li>Any</li>
<li>AnyObject</li>
<li>Array</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>ClosedRange</li>
<li>Codable</li>
<li>CountableClosedRange</li>
<li>CountableRange</li>
<li>Data</li>
<li>Decodable</li>
<li>Dictionary</li>
<li>Double</li>
<li>Encodable</li>
<li>Error</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Float32</li>
<li>Float64</li>
<li>Float80</li>
<li>Int</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>Int8</li>
<li>LINE</li>
<li>OptionSet</li>
<li>Optional</li>
<li>Protocol</li>
<li>Range</li>
<li>Response</li>
<li>Self</li>
<li>Set</li>
<li>StaticString</li>
<li>String</li>
<li>Type</li>
<li>UInt</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>UInt8</li>
<li>URL</li>
<li>Unicode</li>
<li>Void</li>
<li>_</li>
<li>as</li>
<li>associatedtype</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>defer</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>fileprivate</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>guard</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>indirect</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>open</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>repeat</li>
<li>required</li>
<li>rethrows</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>throw</li>
<li>throws</li>
<li>true</li>
<li>try</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
<li>willSet</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,237 @@
---
title: Config Options for typescript-angularjs
sidebar_label: typescript-angularjs
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|supportsES6|Generate code that conforms to ES6.| |false|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Array</li>
<li>Boolean</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>File</li>
<li>Float</li>
<li>Integer</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>ReadonlyArray</li>
<li>String</li>
<li>Set</li>
<li>any</li>
<li>boolean</li>
<li>number</li>
<li>object</li>
<li>string</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>await</li>
<li>boolean</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>debugger</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>formParams</li>
<li>function</li>
<li>goto</li>
<li>headerParams</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>in</li>
<li>instanceof</li>
<li>int</li>
<li>interface</li>
<li>let</li>
<li>long</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>queryParameters</li>
<li>requestOptions</li>
<li>return</li>
<li>short</li>
<li>static</li>
<li>super</li>
<li>switch</li>
<li>synchronized</li>
<li>this</li>
<li>throw</li>
<li>transient</li>
<li>true</li>
<li>try</li>
<li>typeof</li>
<li>useFormData</li>
<li>var</li>
<li>varLocalDeferred</li>
<li>varLocalPath</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -522,12 +522,6 @@ openapi-generator generate \
> NOTE: mappings are applied to `DateTime`, as this is the representation of the primitive type. See [DefaultCodegen](https://github.com/OpenAPITools/openapi-generator/blob/7cee999543fcc00b7c1eb9f70f0456b707c7f9e2/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L1431). > NOTE: mappings are applied to `DateTime`, as this is the representation of the primitive type. See [DefaultCodegen](https://github.com/OpenAPITools/openapi-generator/blob/7cee999543fcc00b7c1eb9f70f0456b707c7f9e2/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L1431).
#### File Post-Processing
The `--enable-post-process-file` option enables specific generators to invoke some external language-specific formatting script. Each filename is passed _individually_ to this external script, allowing for linting, formatting, or other custom clean-up.
For more details, see [File Post-Processing](./file-post-processing.md).
### Target External Models ### Target External Models
Sometimes you don't want the codegen to make a model for you--you might want to just include one that already exists in your codebase. Say you already have a `User` object and want to reuse that, which has a different model package from the other generated files: Sometimes you don't want the codegen to make a model for you--you might want to just include one that already exists in your codebase. Say you already have a `User` object and want to reuse that, which has a different model package from the other generated files:

View File

@@ -234,7 +234,7 @@ public class Generate extends OpenApiGeneratorCommand {
+ " Useful for piping the JSON output of debug options (e.g. `--global-property debugOperations`) to an external parser directly while testing a generator.") + " Useful for piping the JSON output of debug options (e.g. `--global-property debugOperations`) to an external parser directly while testing a generator.")
private Boolean logToStderr; private Boolean logToStderr;
@Option(name = {"--enable-post-process-file"}, title = "enable post-processing of files (in generators supporting it)", description = CodegenConstants.ENABLE_POST_PROCESS_FILE_DESC) @Option(name = {"--enable-post-process-file"}, title = "enable post-process file", description = CodegenConstants.ENABLE_POST_PROCESS_FILE_DESC)
private Boolean enablePostProcessFile; private Boolean enablePostProcessFile;
@Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC) @Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC)

View File

@@ -72,7 +72,7 @@
</profiles> </profiles>
<properties> <properties>
<slf4j-version>1.7.29</slf4j-version> <slf4j-version>1.7.12</slf4j-version>
<guava-version>26.0-jre</guava-version> <guava-version>26.0-jre</guava-version>
</properties> </properties>
</project> </project>

View File

@@ -110,6 +110,9 @@ hs_err_pid*
.AppleDouble .AppleDouble
.LSOverride .LSOverride
# Icon must end with two \r
Icon
# Thumbnails # Thumbnails
._* ._*

View File

@@ -258,7 +258,6 @@
<diffutils-version>1.3.0</diffutils-version> <diffutils-version>1.3.0</diffutils-version>
<guava-version>26.0-jre</guava-version> <guava-version>26.0-jre</guava-version>
<generex-version>1.0.2</generex-version> <generex-version>1.0.2</generex-version>
<rxgen-version>1.1</rxgen-version>
<jackson-version>2.10.1</jackson-version> <jackson-version>2.10.1</jackson-version>
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version> <jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
<kotlin-version>1.3.60</kotlin-version> <kotlin-version>1.3.60</kotlin-version>
@@ -374,11 +373,6 @@
<artifactId>generex</artifactId> <artifactId>generex</artifactId>
<version>${generex-version}</version> <version>${generex-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.curious-odd-man</groupId>
<artifactId>rgxgen</artifactId>
<version>${rxgen-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>

View File

@@ -174,8 +174,6 @@ public interface CodegenConfig {
String toModelImport(String name); String toModelImport(String name);
Map<String,String> toModelImportMap(String name);
String toApiImport(String name); String toApiImport(String name);
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations); void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);

View File

@@ -22,7 +22,6 @@ import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Ticker; import com.github.benmanes.caffeine.cache.Ticker;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Mustache.Compiler; import com.samskivert.mustache.Mustache.Compiler;
import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Mustache.Lambda;
@@ -1368,16 +1367,6 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
/**
* Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.
* In case of union types this method has a key for each separate model and import.
* @param name the name of the "Model"
* @return Map of fully-qualified models.
*/
public Map<String,String> toModelImportMap(String name){
return Collections.singletonMap(this.toModelImport(name),name);
}
/** /**
* Return the fully-qualified "Api" name for import * Return the fully-qualified "Api" name for import
* *
@@ -1971,10 +1960,6 @@ public class DefaultCodegen implements CodegenConfig {
return "oneOf<" + String.join(",", names) + ">"; return "oneOf<" + String.join(",", names) + ">";
} }
protected Schema unaliasSchema(Schema schema, Map<String, String> usedImportMappings) {
return ModelUtils.unaliasSchema(this.openAPI, schema, usedImportMappings);
}
/** /**
* Return a string representation of the schema type, resolving aliasing and references if necessary. * Return a string representation of the schema type, resolving aliasing and references if necessary.
* *
@@ -1982,7 +1967,7 @@ public class DefaultCodegen implements CodegenConfig {
* @return the string representation of the schema type. * @return the string representation of the schema type.
*/ */
protected String getSingleSchemaType(Schema schema) { protected String getSingleSchemaType(Schema schema) {
Schema unaliasSchema = unaliasSchema(schema, importMapping); Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema
// get the schema/model name from $ref // get the schema/model name from $ref
@@ -2080,9 +2065,7 @@ public class DefaultCodegen implements CodegenConfig {
} else if (isAnyTypeSchema(schema)) { } else if (isAnyTypeSchema(schema)) {
return "AnyType"; return "AnyType";
} else if (StringUtils.isNotEmpty(schema.getType())) { } else if (StringUtils.isNotEmpty(schema.getType())) {
if (!importMapping.containsKey(schema.getType())) {
LOGGER.warn("Unknown type found in the schema: " + schema.getType()); LOGGER.warn("Unknown type found in the schema: " + schema.getType());
}
return schema.getType(); return schema.getType();
} }
// The 'type' attribute has not been set in the OAS schema, which means the value // The 'type' attribute has not been set in the OAS schema, which means the value
@@ -2220,7 +2203,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
// unalias schema // unalias schema
schema = unaliasSchema(schema, importMapping); schema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
if (schema == null) { if (schema == null) {
LOGGER.warn("Schema {} not found", name); LOGGER.warn("Schema {} not found", name);
return null; return null;
@@ -2334,7 +2317,7 @@ public class DefaultCodegen implements CodegenConfig {
m.interfaces = new ArrayList<String>(); m.interfaces = new ArrayList<String>();
for (Schema interfaceSchema : interfaces) { for (Schema interfaceSchema : interfaces) {
interfaceSchema = unaliasSchema(interfaceSchema, importMapping); interfaceSchema = ModelUtils.unaliasSchema(this.openAPI, interfaceSchema, importMapping);
if (StringUtils.isBlank(interfaceSchema.get$ref())) { if (StringUtils.isBlank(interfaceSchema.get$ref())) {
// primitive type // primitive type
@@ -2995,7 +2978,7 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("debugging fromProperty for " + name + " : " + p); LOGGER.debug("debugging fromProperty for " + name + " : " + p);
// unalias schema // unalias schema
p = unaliasSchema(p, importMapping); p = ModelUtils.unaliasSchema(this.openAPI, p, importMapping);
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
@@ -3172,9 +3155,10 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(p)) {
// default to string if inner item is undefined // default to string if inner item is undefined
ArraySchema arraySchema = (ArraySchema) p; ArraySchema arraySchema = (ArraySchema) p;
Schema innerSchema = unaliasSchema(getSchemaItems(arraySchema), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema), importMapping);
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
Schema innerSchema = unaliasSchema(getAdditionalProperties(p), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getAdditionalProperties(p),
importMapping);
if (innerSchema == null) { if (innerSchema == null) {
LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName()); LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName());
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type"); innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
@@ -3254,7 +3238,7 @@ public class DefaultCodegen implements CodegenConfig {
itemName = property.name; itemName = property.name;
} }
ArraySchema arraySchema = (ArraySchema) p; ArraySchema arraySchema = (ArraySchema) p;
Schema innerSchema = unaliasSchema(getSchemaItems(arraySchema), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema), importMapping);
CodegenProperty cp = fromProperty(itemName, innerSchema); CodegenProperty cp = fromProperty(itemName, innerSchema);
updatePropertyForArray(property, cp); updatePropertyForArray(property, cp);
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
@@ -3266,7 +3250,8 @@ public class DefaultCodegen implements CodegenConfig {
property.maxItems = p.getMaxProperties(); property.maxItems = p.getMaxProperties();
// handle inner property // handle inner property
Schema innerSchema = unaliasSchema(getAdditionalProperties(p), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getAdditionalProperties(p),
importMapping);
if (innerSchema == null) { if (innerSchema == null) {
LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName()); LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName());
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type"); innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
@@ -3506,7 +3491,7 @@ public class DefaultCodegen implements CodegenConfig {
CodegenOperation op, CodegenOperation op,
ApiResponse methodResponse, ApiResponse methodResponse,
Map<String, String> importMappings) { Map<String, String> importMappings) {
Schema responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(methodResponse), importMapping); Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse), importMappings);
if (responseSchema != null) { if (responseSchema != null) {
CodegenProperty cm = fromProperty("response", responseSchema); CodegenProperty cm = fromProperty("response", responseSchema);
@@ -3910,7 +3895,8 @@ public class DefaultCodegen implements CodegenConfig {
} }
Schema responseSchema; Schema responseSchema;
if (this.openAPI != null && this.openAPI.getComponents() != null) { if (this.openAPI != null && this.openAPI.getComponents() != null) {
responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(response), importMapping); responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(response),
importMapping);
} else { // no model/alias defined } else { // no model/alias defined
responseSchema = ModelUtils.getSchemaFromResponse(response); responseSchema = ModelUtils.getSchemaFromResponse(response);
} }
@@ -4151,7 +4137,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
if (parameterSchema != null) { if (parameterSchema != null) {
parameterSchema = unaliasSchema(parameterSchema, Collections.<String, String>emptyMap()); parameterSchema = ModelUtils.unaliasSchema(this.openAPI, parameterSchema);
if (parameterSchema == null) { if (parameterSchema == null) {
LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String"); LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String");
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
@@ -4691,7 +4677,7 @@ public class DefaultCodegen implements CodegenConfig {
private Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properties) { private Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properties) {
if (properties != null) { if (properties != null) {
for (String key : properties.keySet()) { for (String key : properties.keySet()) {
properties.put(key, unaliasSchema(properties.get(key), importMapping())); properties.put(key, ModelUtils.unaliasSchema(this.openAPI, properties.get(key), importMapping()));
} }
} }
@@ -5816,7 +5802,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter; return codegenParameter;
} }
protected void addBodyModelSchema(CodegenParameter codegenParameter, String name, Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef) { private void addBodyModelSchema(CodegenParameter codegenParameter, String name, Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef) {
CodegenModel codegenModel = null; CodegenModel codegenModel = null;
if (StringUtils.isNotBlank(name)) { if (StringUtils.isNotBlank(name)) {
schema.setName(name); schema.setName(name);
@@ -6205,7 +6191,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenServerVariables; return codegenServerVariables;
} }
protected void setParameterNullable(CodegenParameter parameter, CodegenProperty property) { private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) {
if (parameter == null || property == null) { if (parameter == null || property == null) {
return; return;
} }
@@ -6508,33 +6494,4 @@ public class DefaultCodegen implements CodegenConfig {
return ModelUtils.getAdditionalProperties(openAPI, schema); return ModelUtils.getAdditionalProperties(openAPI, schema);
} }
final protected static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?");
final protected static Pattern JSON_VENDOR_MIME_PATTERN = Pattern.compile("(?i)application\\/vnd.(.*)+json(;.*)?");
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
*
* @param mime MIME string
* @return true if the input matches the JSON MIME
*/
protected static boolean isJsonMimeType(String mime) {
return mime != null && (JSON_MIME_PATTERN.matcher(mime).matches());
}
/**
* Check if the given MIME is a JSON Vendor MIME.
* JSON MIME examples:
* application/vnd.mycompany+json
* application/vnd.mycompany.resourceA.version1+json
*
* @param mime MIME string
* @return true if the input matches the JSON vendor MIME
*/
protected static boolean isJsonVendorMimeType(String mime) {
return mime != null && JSON_VENDOR_MIME_PATTERN.matcher(mime).matches();
}
} }

View File

@@ -58,9 +58,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.removeStart;
import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.OnceLogger.once;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@@ -1079,11 +1077,26 @@ public class DefaultGenerator implements Generator {
allImports.addAll(op.imports); allImports.addAll(op.imports);
} }
Map<String,String> mappings = getAllImportsMappings(allImports); List<Map<String, String>> imports = new ArrayList<>();
Set<Map<String, String>> imports = toImportsObjects(mappings); Set<String> mappingSet = new TreeSet<>();
for (String nextImport : allImports) {
Map<String, String> im = new LinkedHashMap<>();
String mapping = config.importMapping().get(nextImport);
if (mapping == null) {
mapping = config.toModelImport(nextImport);
}
//Some codegen implementations rely on a list interface for the imports if (mapping != null && !mappingSet.contains(mapping)) { // ensure import (mapping) is unique
operations.put("imports", imports.stream().collect(Collectors.toList())); mappingSet.add(mapping);
im.put("import", mapping);
im.put("classname", nextImport);
if (!imports.contains(im)) { // avoid duplicates
imports.add(im);
}
}
}
operations.put("imports", imports);
// add a flag to indicate whether there's any {{import}} // add a flag to indicate whether there's any {{import}}
if (imports.size() > 0) { if (imports.size() > 0) {
@@ -1102,49 +1115,6 @@ public class DefaultGenerator implements Generator {
return operations; return operations;
} }
/**
* Transforms a set of imports to a map with key config.toModelImport(import) and value the import string.
* @param allImports - Set of imports
* @return Map of fully qualified import path and initial import.
*/
private Map<String,String> getAllImportsMappings(Set<String> allImports){
Map<String,String> result = new HashMap<>();
allImports.forEach(nextImport->{
String mapping = config.importMapping().get(nextImport);
if(mapping!= null){
result.put(mapping,nextImport);
}else{
result.putAll(config.toModelImportMap(nextImport));
}
});
return result;
}
/**
* Using an import map created via {@link #getAllImportsMappings(Set)} to build a list import objects.
* The import objects have two keys: import and classname which hold the key and value of the initial map entry.
*
* @param mappedImports Map of fully qualified import and import
* @return The set of unique imports
*/
private Set<Map<String,String>> toImportsObjects(Map<String,String> mappedImports){
Set<Map<String, String>> result = new TreeSet<Map<String,String>>(
(Comparator<Map<String, String>>) (o1, o2) -> {
String s1 = o1.get("classname");
String s2 = o2.get("classname");
return s1.compareTo(s2);
}
);
mappedImports.entrySet().forEach(mapping->{
Map<String, String> im = new LinkedHashMap<>();
im.put("import", mapping.getKey());
im.put("classname", mapping.getValue());
result.add(im);
});
return result;
}
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) { private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) {
Map<String, Object> objs = new HashMap<>(); Map<String, Object> objs = new HashMap<>();
objs.put("package", config.modelPackage()); objs.put("package", config.modelPackage());
@@ -1352,23 +1322,10 @@ public class DefaultGenerator implements Generator {
} }
}); });
// NOTE: Don't use File.separator here as we write linux-style paths to FILES, and File.separator will
// result in incorrect match on Windows machines.
String relativeMeta = METADATA_DIR + "/VERSION";
filesToSort.sort(PathFileComparator.PATH_COMPARATOR); filesToSort.sort(PathFileComparator.PATH_COMPARATOR);
filesToSort.forEach(f -> { filesToSort.forEach(f -> {
String tmp = outDir.toPath().relativize(f.toPath()).normalize().toString(); String relativePath = outDir.toPath().relativize(f.toPath()).toString();
// some Java implementations don't honor .relativize documentation fully. if (!relativePath.equals(METADATA_DIR + File.separator + "VERSION")) {
// When outDir is /a/b and the input is /a/b/c/d, the result should be c/d.
// Some implementations make the output ./c/d which seems to mix the logic
// as documented for symlinks. So we need to trim any / or ./ from the start,
// as nobody should be generating into system root and our expectation is no ./
String relativePath = removeStart(removeStart(tmp, "." + File.separator), File.separator);
if (File.separator.equals("\\")) {
// ensure that windows outputs same FILES format
relativePath = relativePath.replace(File.separator, "/");
}
if (!relativePath.equals(relativeMeta)) {
sb.append(relativePath).append(System.lineSeparator()); sb.append(relativePath).append(System.lineSeparator());
} }
}); });

View File

@@ -657,19 +657,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
} }
} }
// check if the payload is json and set x-is-json accordingly
if (operation.consumes != null) {
for (Map<String, String> consume : operation.consumes) {
if (consume.containsKey("mediaType")) {
if (isJsonMimeType(consume.get("mediaType"))) {
operation.vendorExtensions.put("x-is-json", true);
break;
}
}
}
}
if (operation.examples != null) { if (operation.examples != null) {
for (Map<String, String> example : operation.examples) { for (Map<String, String> example : operation.examples) {
for (Map.Entry<String, String> entry : example.entrySet()) { for (Map.Entry<String, String> entry : example.entrySet()) {

View File

@@ -809,13 +809,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return String.format(Locale.ROOT, pattern, typeDeclaration); return String.format(Locale.ROOT, pattern, typeDeclaration);
} else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) { } else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) {
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
// object is complex object with free-form additional properties
if (schema.getDefault() != null) {
return super.toDefaultValue(schema);
}
return null;
}
final String pattern; final String pattern;
if (fullJavaUtil) { if (fullJavaUtil) {
pattern = "new java.util.HashMap<%s>()"; pattern = "new java.util.HashMap<%s>()";

View File

@@ -17,8 +17,6 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.ComposedSchema; import io.swagger.v3.oas.models.media.ComposedSchema;
@@ -37,7 +35,6 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -227,47 +224,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
} }
} }
@Override
public String toModelImport( String name){
if(isUnionType(name)){
LOGGER.warn("The import is a union type. Consider using the toModelImportMap method.");
return toModelImportMap(name).values().stream().collect(Collectors.joining("|"));
}
return super.toModelImport(name);
}
/**
* Maps the fully qualified model import to the initial given name. In case of union types the map will have multiple entries.
* For example for "classA | classB" the map will two entries have ["model.classA","classA"] and ["model.classB","classB"].
*
* @param name the name of the "Model"
* @return Map between the fully qualified model import and the initial given name.
*/
@Override
public Map<String,String> toModelImportMap( String name){
if(isUnionType(name)){
String[] names = splitUnionType(name);
return toImportMap(names);
}
return toImportMap(name);
}
private boolean isUnionType(String name){
return name.contains("|");
}
private String[] splitUnionType(String name){
return name.replace(" ","").split("\\|");
}
private Map<String,String> toImportMap(String... names){
Map<String,String> result = Maps.newHashMap();
for(String name: names){
result.put(toModelImport(name),name);
}
return result;
}
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {

View File

@@ -69,7 +69,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
protected String serverHost = "0.0.0.0"; protected String serverHost = "0.0.0.0";
protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0"); protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0");
protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)"); protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)");
private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier for controller classes: Empty string or abstract."); private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract");
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual or abstract"); private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual or abstract");
private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial"); private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial");
private boolean generateBody = true; private boolean generateBody = true;

View File

@@ -604,7 +604,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
} }
for (final CodegenProperty property : codegenModel.readWriteVars) { for (final CodegenProperty property : codegenModel.readWriteVars) {
if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.name.equals(parentCodegenModel.discriminator.getPropertyName())) { if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\""; property.defaultValue = "\"" + name + "\"";
} }
} }

View File

@@ -299,7 +299,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
} }
for (final CodegenProperty property : codegenModel.readWriteVars) { for (final CodegenProperty property : codegenModel.readWriteVars) {
if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.name.equals(parentCodegenModel.discriminator.getPropertyName())) { if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\""; property.defaultValue = "\"" + name + "\"";
} }
} }
@@ -343,6 +343,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
return "Generates a C# client library (.NET Standard, .NET Core)."; return "Generates a C# client library (.NET Standard, .NET Core).";
} }
// private void syncStringProperty(Map<String, Object> properties, String key)
public String getModelPropertyNaming() { public String getModelPropertyNaming() {
return this.modelPropertyNaming; return this.modelPropertyNaming;
} }
@@ -610,13 +612,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs")); supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs"));
supportingFiles.add(new SupportingFile("ClientUtils.mustache", clientPackageDir, "ClientUtils.cs")); supportingFiles.add(new SupportingFile("ClientUtils.mustache", clientPackageDir, "ClientUtils.cs"));
supportingFiles.add(new SupportingFile("HttpMethod.mustache", clientPackageDir, "HttpMethod.cs")); supportingFiles.add(new SupportingFile("HttpMethod.mustache", clientPackageDir, "HttpMethod.cs"));
if (supportsAsync) {
supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", clientPackageDir, "IAsynchronousClient.cs")); supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", clientPackageDir, "IAsynchronousClient.cs"));
}
supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", clientPackageDir, "ISynchronousClient.cs")); supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", clientPackageDir, "ISynchronousClient.cs"));
supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs")); supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs"));
supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs")); supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs"));
supportingFiles.add(new SupportingFile("RetryConfiguration.mustache", clientPackageDir, "RetryConfiguration.cs"));
supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache", supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache",
clientPackageDir, "IReadableConfiguration.cs")); clientPackageDir, "IReadableConfiguration.cs"));
@@ -640,8 +639,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj")); supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
} }
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath); additionalProperties.put("modelDocPath", modelDocPath);
} }

View File

@@ -20,8 +20,6 @@ package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -48,8 +46,6 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig
public FlashClientCodegen() { public FlashClientCodegen() {
super(); super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.DEPRECATED).build();
modifyFeatureSet(features -> features modifyFeatureSet(features -> features
.includeDocumentationFeatures(DocumentationFeature.Readme) .includeDocumentationFeatures(DocumentationFeature.Readme)
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML))
@@ -205,12 +201,12 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig
@Override @Override
public String getName() { public String getName() {
return "flash-deprecated"; return "flash";
} }
@Override @Override
public String getHelp() { public String getHelp() {
return "Generates a Flash (ActionScript) client library (beta). IMPORTANT: this generator has been deprecated in v5.x"; return "Generates a Flash (ActionScript) client library (beta).";
} }
@Override @Override

View File

@@ -16,7 +16,6 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.CodegenType;
@@ -108,14 +107,6 @@ public class GoGinServerCodegen extends AbstractGoCodegen {
"continue", "for", "import", "return", "var", "error", "nil") "continue", "for", "import", "return", "var", "error", "nil")
// Added "error" as it's used so frequently that it may as well be a keyword // Added "error" as it's used so frequently that it may as well be a keyword
); );
cliOptions.add(new CliOption("apiPath", "Name of the folder that contains the Go source code")
.defaultValue(apiPath));
CliOption optServerPort = new CliOption("serverPort", "The network port the generated server binds to");
optServerPort.setType("int");
optServerPort.defaultValue(Integer.toString(serverPort));
cliOptions.add(optServerPort);
} }
@Override @Override

View File

@@ -1239,6 +1239,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
return name; return name;
} }
static boolean isJsonMimeType(String mime) {
return mime != null && JSON_MIME_PATTERN.matcher(mime).matches();
}
static boolean isWildcardMimeType(String mime) { static boolean isWildcardMimeType(String mime) {
return mime != null && mime.equals("*/*"); return mime != null && mime.equals("*/*");
} }

View File

@@ -39,6 +39,7 @@ import java.util.regex.Pattern;
import static com.google.common.base.CaseFormat.LOWER_CAMEL; import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static java.util.Collections.sort; import static java.util.Collections.sort;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
public class JavaClientCodegen extends AbstractJavaCodegen public class JavaClientCodegen extends AbstractJavaCodegen
@@ -59,16 +60,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException";
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework";
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles"; public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
public static final String PLAY_24 = "play24"; public static final String PLAY_24 = "play24";
public static final String PLAY_25 = "play25"; public static final String PLAY_25 = "play25";
public static final String PLAY_26 = "play26"; public static final String PLAY_26 = "play26";
public static final String MICROPROFILE_DEFAULT = "default";
public static final String MICROPROFILE_KUMULUZEE = "kumuluzee";
public static final String FEIGN = "feign"; public static final String FEIGN = "feign";
public static final String GOOGLE_API_CLIENT = "google-api-client"; public static final String GOOGLE_API_CLIENT = "google-api-client";
public static final String JERSEY1 = "jersey1"; public static final String JERSEY1 = "jersey1";
@@ -95,8 +92,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean doNotUseRx = true; protected boolean doNotUseRx = true;
protected boolean usePlayWS = false; protected boolean usePlayWS = false;
protected String playVersion = PLAY_26; protected String playVersion = PLAY_26;
protected String microprofileFramework = MICROPROFILE_DEFAULT;
protected boolean asyncNative = false; protected boolean asyncNative = false;
protected boolean parcelableModel = false; protected boolean parcelableModel = false;
protected boolean useBeanValidation = false; protected boolean useBeanValidation = false;
@@ -147,7 +142,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version")); cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version"));
cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact."));
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\""));
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library")); cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library"));
supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.");
@@ -164,7 +158,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+");
supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x"); supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
libraryOption.setEnum(supportedLibraries); libraryOption.setEnum(supportedLibraries);
// set okhttp-gson as the default // set okhttp-gson as the default
@@ -216,30 +209,31 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} else if (MICROPROFILE.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) { } else if (MICROPROFILE.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) {
dateLibrary = "legacy"; dateLibrary = "legacy";
} }
super.processOpts(); super.processOpts();
// RxJava // RxJava
if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2) && additionalProperties.containsKey(USE_RX_JAVA3)) { if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2) && additionalProperties.containsKey(USE_RX_JAVA3)){
LOGGER.warn("You specified all RxJava versions 1, 2 and 3 but they are mutually exclusive. Defaulting to v3."); LOGGER.warn("You specified all RxJava versions 1, 2 and 3 but they are mutually exclusive. Defaulting to v3.");
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString())); this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
} else { }else {
if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2)) { if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2)){
LOGGER.warn("You specified both RxJava versions 1 and 2 but they are mutually exclusive. Defaulting to v2."); LOGGER.warn("You specified both RxJava versions 1 and 2 but they are mutually exclusive. Defaulting to v2.");
this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString())); this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString()));
} else if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA3)) { }else if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA3)) {
LOGGER.warn("You specified both RxJava versions 1 and 3 but they are mutually exclusive. Defaulting to v3."); LOGGER.warn("You specified both RxJava versions 1 and 3 but they are mutually exclusive. Defaulting to v3.");
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString())); this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
} else if (additionalProperties.containsKey(USE_RX_JAVA2) && additionalProperties.containsKey(USE_RX_JAVA3)) { }else if(additionalProperties.containsKey(USE_RX_JAVA2) && additionalProperties.containsKey(USE_RX_JAVA3)){
LOGGER.warn("You specified both RxJava versions 2 and 3 but they are mutually exclusive. Defaulting to v3."); LOGGER.warn("You specified both RxJava versions 2 and 3 but they are mutually exclusive. Defaulting to v3.");
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString())); this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
} else { }else{
if (additionalProperties.containsKey(USE_RX_JAVA)) { if(additionalProperties.containsKey(USE_RX_JAVA)){
this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString())); this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString()));
} }
if (additionalProperties.containsKey(USE_RX_JAVA2)) { if(additionalProperties.containsKey(USE_RX_JAVA2)){
this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString())); this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString()));
} }
if (additionalProperties.containsKey(USE_RX_JAVA3)) { if(additionalProperties.containsKey(USE_RX_JAVA3)){
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString())); this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
} }
} }
@@ -260,15 +254,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} }
additionalProperties.put(PLAY_VERSION, playVersion); additionalProperties.put(PLAY_VERSION, playVersion);
// Microprofile framework
if (additionalProperties.containsKey(MICROPROFILE_FRAMEWORK)) {
if (!MICROPROFILE_KUMULUZEE.equals(microprofileFramework)) {
throw new RuntimeException("Invalid microprofileFramework '" + microprofileFramework + "'. Must be 'kumuluzee' or none.");
}
this.setMicroprofileFramework(additionalProperties.get(MICROPROFILE_FRAMEWORK).toString());
}
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
if (additionalProperties.containsKey(ASYNC_NATIVE)) { if (additionalProperties.containsKey(ASYNC_NATIVE)) {
this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE)); this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE));
} }
@@ -463,12 +448,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java"));
supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java")); supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java"));
serializationLibrary = "none"; serializationLibrary = "none";
if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)) {
supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("kumuluzee.config.yaml.mustache", "src/main/resources", "config.yaml"));
supportingFiles.add(new SupportingFile("kumuluzee.beans.xml.mustache", "src/main/resources/META-INF", "beans.xml"));
}
} else { } else {
LOGGER.error("Unknown library option (-l/--library): " + getLibrary()); LOGGER.error("Unknown library option (-l/--library): " + getLibrary());
} }
@@ -784,32 +763,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
// only add JsonNullable and related imports to optional and nullable values // only add JsonNullable and related imports to optional and nullable values
addImports |= isOptionalNullable; addImports |= isOptionalNullable;
var.getVendorExtensions().put("x-is-jackson-optional-nullable", isOptionalNullable); var.getVendorExtensions().put("x-is-jackson-optional-nullable", isOptionalNullable);
if (Boolean.TRUE.equals(var.getVendorExtensions().get("x-enum-as-string"))) {
// treat enum string as just string
var.datatypeWithEnum = var.dataType;
if (StringUtils.isNotEmpty(var.defaultValue)) { // has default value
String defaultValue = var.defaultValue.substring(var.defaultValue.lastIndexOf('.') + 1);
for (Map<String, Object> enumVars : (List<Map<String, Object>>) var.getAllowableValues().get("enumVars")) {
if (defaultValue.equals(enumVars.get("name"))) {
// update default to use the string directly instead of enum string
var.defaultValue = (String) enumVars.get("value");
} }
}
}
// add import for Set, HashSet
cm.imports.add("Set");
Map<String, String> importsSet = new HashMap<String, String>();
importsSet.put("import", "java.util.Set");
imports.add(importsSet);
Map<String, String> importsHashSet = new HashMap<String, String>();
importsHashSet.put("import", "java.util.HashSet");
imports.add(importsHashSet);
}
}
if (addImports) { if (addImports) {
Map<String, String> imports2Classnames = new HashMap<String, String>() {{ Map<String, String> imports2Classnames = new HashMap<String, String>() {{
put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable"); put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
@@ -889,10 +843,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.asyncNative = asyncNative; this.asyncNative = asyncNative;
} }
public void setMicroprofileFramework(String microprofileFramework) {
this.microprofileFramework = microprofileFramework;
}
public void setParcelableModel(boolean parcelableModel) { public void setParcelableModel(boolean parcelableModel) {
this.parcelableModel = parcelableModel; this.parcelableModel = parcelableModel;
} }
@@ -951,7 +901,29 @@ public class JavaClientCodegen extends AbstractJavaCodegen
setSerializationLibrary(serializationLibrary); setSerializationLibrary(serializationLibrary);
} }
final private static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?");
final private static Pattern JSON_VENDOR_MIME_PATTERN = Pattern.compile("(?i)application\\/vnd.(.*)+json(;.*)?");
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
*/
static boolean isJsonMimeType(String mime) {
return mime != null && (JSON_MIME_PATTERN.matcher(mime).matches());
}
/**
* Check if the given MIME is a JSON Vendor MIME.
* JSON MIME examples:
* application/vnd.mycompany+json
* application/vnd.mycompany.resourceA.version1+json
*/
static boolean isJsonVendorMimeType(String mime) {
return mime != null && JSON_VENDOR_MIME_PATTERN.matcher(mime).matches();
}
@Override @Override
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) { public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {

View File

@@ -44,7 +44,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String THORNTAIL_LIBRARY = "thorntail"; public static final String THORNTAIL_LIBRARY = "thorntail";
public static final String OPEN_LIBERTY_LIBRARY = "openliberty"; public static final String OPEN_LIBERTY_LIBRARY = "openliberty";
public static final String HELIDON_LIBRARY = "helidon"; public static final String HELIDON_LIBRARY = "helidon";
public static final String KUMULUZEE_LIBRARY = "kumuluzee";
private boolean interfaceOnly = false; private boolean interfaceOnly = false;
private boolean returnResponse = false; private boolean returnResponse = false;
@@ -100,7 +99,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
supportedLibraries.put(THORNTAIL_LIBRARY, "Server using Thorntail"); supportedLibraries.put(THORNTAIL_LIBRARY, "Server using Thorntail");
supportedLibraries.put(OPEN_LIBERTY_LIBRARY, "Server using Open Liberty"); supportedLibraries.put(OPEN_LIBERTY_LIBRARY, "Server using Open Liberty");
supportedLibraries.put(HELIDON_LIBRARY, "Server using Helidon"); supportedLibraries.put(HELIDON_LIBRARY, "Server using Helidon");
supportedLibraries.put(KUMULUZEE_LIBRARY, "Server using KumuluzEE");
library.setEnum(supportedLibraries); library.setEnum(supportedLibraries);
cliOptions.add(library); cliOptions.add(library);
@@ -129,16 +127,13 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
additionalProperties.remove(RETURN_RESPONSE); additionalProperties.remove(RETURN_RESPONSE);
} }
} }
if (QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { if (QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library)) {
useSwaggerAnnotations = false; useSwaggerAnnotations = false;
} else { } else {
if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) { if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) {
useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString()); useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString());
} }
} }
if (KUMULUZEE_LIBRARY.equals(library)){
super.setSourceFolder("src/main/java");
}
writePropertyBack(USE_SWAGGER_ANNOTATIONS, useSwaggerAnnotations); writePropertyBack(USE_SWAGGER_ANNOTATIONS, useSwaggerAnnotations);
if (additionalProperties.containsKey(GENERATE_BUILDERS)) { if (additionalProperties.containsKey(GENERATE_BUILDERS)) {
@@ -148,7 +143,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
if (additionalProperties.containsKey(OPEN_API_SPEC_FILE_LOCATION)) { if (additionalProperties.containsKey(OPEN_API_SPEC_FILE_LOCATION)) {
openApiSpecFileLocation = additionalProperties.get(OPEN_API_SPEC_FILE_LOCATION).toString(); openApiSpecFileLocation = additionalProperties.get(OPEN_API_SPEC_FILE_LOCATION).toString();
} else if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { } else if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library)) {
openApiSpecFileLocation = "src/main/resources/META-INF/openapi.yaml"; openApiSpecFileLocation = "src/main/resources/META-INF/openapi.yaml";
} else if(OPEN_LIBERTY_LIBRARY.equals(library)) { } else if(OPEN_LIBERTY_LIBRARY.equals(library)) {
openApiSpecFileLocation = "src/main/webapp/META-INF/openapi.yaml"; openApiSpecFileLocation = "src/main/webapp/META-INF/openapi.yaml";
@@ -218,8 +213,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
.doNotOverwrite()); .doNotOverwrite());
supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml") supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml")
.doNotOverwrite()); .doNotOverwrite());
} else if(KUMULUZEE_LIBRARY.equals(library)) {
supportingFiles.add(new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml"));
} }
} }

View File

@@ -16,7 +16,7 @@ import static org.openapitools.codegen.utils.StringUtils.escape;
public class MarkdownDocumentationCodegen extends DefaultCodegen implements CodegenConfig { public class MarkdownDocumentationCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PROJECT_NAME = "projectName"; public static final String PROJECT_NAME = "projectName";
private static final Logger LOGGER = LoggerFactory.getLogger(MarkdownDocumentationCodegen.class); static Logger LOGGER = LoggerFactory.getLogger(MarkdownDocumentationCodegen.class);
public CodegenType getTag() { public CodegenType getTag() {
return CodegenType.DOCUMENTATION; return CodegenType.DOCUMENTATION;
@@ -42,7 +42,7 @@ public class MarkdownDocumentationCodegen extends DefaultCodegen implements Code
apiTemplateFiles.put("api.mustache", ".md"); apiTemplateFiles.put("api.mustache", ".md");
embeddedTemplateDir = templateDir = "markdown-documentation"; embeddedTemplateDir = templateDir = "markdown-documentation";
apiPackage = File.separator + "Apis"; apiPackage = File.separator + "Apis";
modelPackage = "Models"; modelPackage = File.separator + "Models";
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
// TODO: Fill this out. // TODO: Fill this out.
} }

View File

@@ -46,7 +46,6 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
private static final Logger LOGGER = LoggerFactory.getLogger(NodeJSExpressServerCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(NodeJSExpressServerCodegen.class);
public static final String EXPORTED_NAME = "exportedName"; public static final String EXPORTED_NAME = "exportedName";
public static final String SERVER_HOST = "serverHost";
public static final String SERVER_PORT = "serverPort"; public static final String SERVER_PORT = "serverPort";
protected String apiVersion = "1.0.0"; protected String apiVersion = "1.0.0";
@@ -335,11 +334,6 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
String port = URLPathUtils.getPort(url, defaultServerPort); String port = URLPathUtils.getPort(url, defaultServerPort);
String basePath = url.getPath(); String basePath = url.getPath();
if (additionalProperties.containsKey(SERVER_HOST)) {
host = additionalProperties.get(SERVER_HOST).toString();
}
this.additionalProperties.put(SERVER_HOST, host);
if (additionalProperties.containsKey(SERVER_PORT)) { if (additionalProperties.containsKey(SERVER_PORT)) {
port = additionalProperties.get(SERVER_PORT).toString(); port = additionalProperties.get(SERVER_PORT).toString();
} }

View File

@@ -437,7 +437,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
if (StringUtils.isEmpty(System.getenv("OCAML_POST_PROCESS_FILE"))) { if (StringUtils.isEmpty(System.getenv("OCAML_POST_PROCESS_FILE"))) {
LOGGER.info("Hint: Environment variable 'OCAML_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export OCAML_POST_PROCESS_FILE=\"ocamlformat -i --enable-outside-detected-project\"' (Linux/Mac)"); LOGGER.info("Hint: Environment variable 'OCAML_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export OCAML_POST_PROCESS_FILE=\"ocamlformat -i --enable-outside-detected-project\"' (Linux/Mac)");
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); LOGGER.info("Note: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
} else if (!this.isEnablePostProcessFile()) { } else if (!this.isEnablePostProcessFile()) {
LOGGER.info("Warning: Environment variable 'OCAML_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); LOGGER.info("Warning: Environment variable 'OCAML_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
} }

View File

@@ -123,9 +123,6 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
// Slim 4 doesn't parse JSON body anymore we need to add suggested middleware // Slim 4 doesn't parse JSON body anymore we need to add suggested middleware
// ref: https://www.slimframework.com/docs/v4/objects/request.html#the-request-body // ref: https://www.slimframework.com/docs/v4/objects/request.html#the-request-body
supportingFiles.add(new SupportingFile("htaccess_deny_all", "config", ".htaccess"));
supportingFiles.add(new SupportingFile("config_example.mustache", "config" + File.separator + "dev", "example.inc.php"));
supportingFiles.add(new SupportingFile("config_example.mustache", "config" + File.separator + "prod", "example.inc.php"));
supportingFiles.add(new SupportingFile("json_body_parser_middleware.mustache", toSrcPath(invokerPackage + "\\Middleware", srcBasePath), "JsonBodyParserMiddleware.php")); supportingFiles.add(new SupportingFile("json_body_parser_middleware.mustache", toSrcPath(invokerPackage + "\\Middleware", srcBasePath), "JsonBodyParserMiddleware.php"));
supportingFiles.add(new SupportingFile("base_model.mustache", toSrcPath(invokerPackage, srcBasePath), "BaseModel.php")); supportingFiles.add(new SupportingFile("base_model.mustache", toSrcPath(invokerPackage, srcBasePath), "BaseModel.php"));
supportingFiles.add(new SupportingFile("base_model_test.mustache", toSrcPath(invokerPackage, testBasePath), "BaseModelTest.php")); supportingFiles.add(new SupportingFile("base_model_test.mustache", toSrcPath(invokerPackage, testBasePath), "BaseModelTest.php"));

View File

@@ -197,7 +197,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("array", "Array"); typeMapping.put("array", "Array");
typeMapping.put("List", "Array"); typeMapping.put("List", "Array");
typeMapping.put("map", "Dictionary"); typeMapping.put("map", "Dictionary");
typeMapping.put("set", "Set");
typeMapping.put("date", "Date"); typeMapping.put("date", "Date");
typeMapping.put("Date", "Date"); typeMapping.put("Date", "Date");
typeMapping.put("DateTime", "Date"); typeMapping.put("DateTime", "Date");

View File

@@ -295,7 +295,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
// Add additional filename information for model imports in the apis // Add additional filename information for model imports in the apis
List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports"); List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
for (Map<String, Object> im : imports) { for (Map<String, Object> im : imports) {
im.put("filename", ((String) im.get("import")).replace(".", "/")); im.put("filename", ((String) im.get("import")).replace(".", File.separator));
im.put("classname", getModelnameFromModelFilename(im.get("import").toString())); im.put("classname", getModelnameFromModelFilename(im.get("import").toString()));
} }

View File

@@ -65,8 +65,6 @@ public class ModelUtils {
// A vendor extension to track the value of the 'disallowAdditionalPropertiesIfNotPresent' CLI // A vendor extension to track the value of the 'disallowAdditionalPropertiesIfNotPresent' CLI
private static final String disallowAdditionalPropertiesIfNotPresent = "x-disallow-additional-properties-if-not-present"; private static final String disallowAdditionalPropertiesIfNotPresent = "x-disallow-additional-properties-if-not-present";
private static final String freeFormExplicit = "x-is-free-form";
private static ObjectMapper JSON_MAPPER, YAML_MAPPER; private static ObjectMapper JSON_MAPPER, YAML_MAPPER;
static { static {
@@ -674,23 +672,25 @@ public class ModelUtils {
} }
/** /**
* Check to see if the schema is a model * Check to see if the schema is a model with at least one property.
* *
* @param schema potentially containing a '$ref' * @param schema potentially containing a '$ref'
* @return true if it's a model with at least one properties * @return true if it's a model with at least one properties
*/ */
public static boolean isModel(Schema schema) { public static boolean isModel(Schema schema) {
if (schema == null) { if (schema == null) {
// TODO: Is this message necessary? A null schema is not a model, so the result is correct.
once(LOGGER).error("Schema cannot be null in isModel check");
return false; return false;
} }
// has properties // has at least one property
if (null != schema.getProperties()) { if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
return true; return true;
} }
// composed schema is a model, consider very simple ObjectSchema a model // composed schema is a model
return schema instanceof ComposedSchema || schema instanceof ObjectSchema; return schema instanceof ComposedSchema;
} }
/** /**
@@ -745,16 +745,6 @@ public class ModelUtils {
// no properties // no properties
if ((schema.getProperties() == null || schema.getProperties().isEmpty())) { if ((schema.getProperties() == null || schema.getProperties().isEmpty())) {
Schema addlProps = getAdditionalProperties(openAPI, schema); Schema addlProps = getAdditionalProperties(openAPI, schema);
if (schema.getExtensions() != null && schema.getExtensions().containsKey(freeFormExplicit)) {
// User has hard-coded vendor extension to handle free-form evaluation.
boolean isFreeFormExplicit = Boolean.parseBoolean(String.valueOf(schema.getExtensions().get(freeFormExplicit)));
if (!isFreeFormExplicit && addlProps != null && addlProps.getProperties() != null && !addlProps.getProperties().isEmpty()) {
once(LOGGER).error(String.format(Locale.ROOT, "Potentially confusing usage of %s within model which defines additional properties", freeFormExplicit));
}
return isFreeFormExplicit;
}
// additionalProperties not defined // additionalProperties not defined
if (addlProps == null) { if (addlProps == null) {
return true; return true;

View File

@@ -210,7 +210,7 @@ public class URLPathUtils {
once(LOGGER).warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url); once(LOGGER).warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
} else if (url.startsWith("/")) { } else if (url.startsWith("/")) {
url = LOCAL_HOST + url; url = LOCAL_HOST + url;
once(LOGGER).info("'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [{}] for server URL [{}]", LOCAL_HOST, url); once(LOGGER).warn("'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [{}] for server URL [{}]", LOCAL_HOST, url);
} else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) { } else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) {
// Add http scheme for urls without a scheme. // Add http scheme for urls without a scheme.
// 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss" // 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"

View File

@@ -193,7 +193,7 @@ end:
{{#headerParams}} {{#headerParams}}
// header parameters // header parameters
char *keyHeader_{{{paramName}}} = NULL; char *keyHeader_{{{paramName}}};
{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueHeader_{{{paramName}}}; {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueHeader_{{{paramName}}};
keyValuePair_t *keyPairHeader_{{paramName}} = 0; keyValuePair_t *keyPairHeader_{{paramName}} = 0;
if ({{paramName}}) { if ({{paramName}}) {
@@ -242,12 +242,12 @@ end:
// form parameters // form parameters
{{#isFile}} {{#isFile}}
char *keyForm_{{paramName}} = NULL; char *keyForm_{{paramName}};
{{{dataType}}} valueForm_{{paramName}}; {{{dataType}}} valueForm_{{paramName}};
keyValuePair_t *keyPairForm_{{paramName}} = 0; keyValuePair_t *keyPairForm_{{paramName}} = 0;
{{/isFile}} {{/isFile}}
{{^isFile}} {{^isFile}}
char *keyForm_{{paramName}} = NULL; char *keyForm_{{paramName}};
{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueForm_{{paramName}}; {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueForm_{{paramName}};
keyValuePair_t *keyPairForm_{{paramName}} = 0; keyValuePair_t *keyPairForm_{{paramName}} = 0;
{{/isFile}} {{/isFile}}
@@ -272,9 +272,9 @@ end:
// Body Param // Body Param
{{#isListContainer}} {{#isListContainer}}
//notstring //notstring
cJSON *localVar_{{paramName}} = NULL; cJSON *localVar_{{paramName}};
cJSON *localVarItemJSON_{{paramName}} = NULL; cJSON *localVarItemJSON_{{paramName}};
cJSON *localVarSingleItemJSON_{{paramName}} = NULL; cJSON *localVarSingleItemJSON_{{paramName}};
if ({{paramName}} != NULL) if ({{paramName}} != NULL)
{ {
localVarItemJSON_{{paramName}} = cJSON_CreateObject(); localVarItemJSON_{{paramName}} = cJSON_CreateObject();
@@ -300,7 +300,7 @@ end:
} }
{{/isListContainer}} {{/isListContainer}}
{{^isListContainer}} {{^isListContainer}}
cJSON *localVarSingleItemJSON_{{paramName}} = NULL; cJSON *localVarSingleItemJSON_{{paramName}};
if ({{paramName}} != NULL) if ({{paramName}} != NULL)
{ {
//string //string
@@ -399,41 +399,23 @@ end:
{{/pathParams}} {{/pathParams}}
{{#headerParams}} {{#headerParams}}
{{#isString}} {{#isString}}
if (keyHeader_{{{paramName}}}) {
free(keyHeader_{{{paramName}}}); free(keyHeader_{{{paramName}}});
keyHeader_{{{paramName}}} = NULL;
}
free(valueHeader_{{{paramName}}}); free(valueHeader_{{{paramName}}});
{{/isString}} {{/isString}}
{{^isString}} {{^isString}}
if (keyHeader_{{{paramName}}}) {
free(keyHeader_{{{paramName}}}); free(keyHeader_{{{paramName}}});
keyHeader_{{{paramName}}} = NULL;
}
{{/isString}} {{/isString}}
free(keyPairHeader_{{paramName}}); free(keyPairHeader_{{paramName}});
{{/headerParams}} {{/headerParams}}
{{#bodyParams}} {{#bodyParams}}
{{#isListContainer}} {{#isListContainer}}
if (localVarItemJSON_{{paramName}}) {
cJSON_Delete(localVarItemJSON_{{paramName}}); cJSON_Delete(localVarItemJSON_{{paramName}});
localVarItemJSON_{{paramName}} = NULL;
}
if (localVarSingleItemJSON_{{paramName}}) {
cJSON_Delete(localVarSingleItemJSON_{{paramName}}); cJSON_Delete(localVarSingleItemJSON_{{paramName}});
localVarSingleItemJSON_{{paramName}} = NULL;
}
if (localVar_{{paramName}}) {
cJSON_Delete(localVar_{{paramName}}); cJSON_Delete(localVar_{{paramName}});
localVar_{{paramName}} = NULL;
}
free(localVarBodyParameters); free(localVarBodyParameters);
{{/isListContainer}} {{/isListContainer}}
{{^isListContainer}} {{^isListContainer}}
if (localVarSingleItemJSON_{{paramName}}) {
cJSON_Delete(localVarSingleItemJSON_{{paramName}}); cJSON_Delete(localVarSingleItemJSON_{{paramName}});
localVarSingleItemJSON_{{paramName}} = NULL;
}
free(localVarBodyParameters); free(localVarBodyParameters);
{{/isListContainer}} {{/isListContainer}}
{{/bodyParams}} {{/bodyParams}}
@@ -469,35 +451,25 @@ end:
{{/queryParams}} {{/queryParams}}
{{#formParams}} {{#formParams}}
{{#isFile}} {{#isFile}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
// free(fileVar_{{paramName}}->data); // free(fileVar_{{paramName}}->data);
// free(fileVar_{{paramName}}); // free(fileVar_{{paramName}});
free(keyPairForm_{{paramName}}); free(keyPairForm_{{paramName}});
{{/isFile}} {{/isFile}}
{{^isFile}} {{^isFile}}
{{#isString}} {{#isString}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
free(valueForm_{{{paramName}}}); free(valueForm_{{{paramName}}});
free(keyPairForm_{{paramName}}); free(keyPairForm_{{paramName}});
{{/isString}} {{/isString}}
{{^isString}} {{^isString}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
free(keyPairForm_{{paramName}}); free(keyPairForm_{{paramName}});
{{/isString}} {{/isString}}
{{/isFile}} {{/isFile}}
{{/formParams}} {{/formParams}}
return elementToReturn; return elementToReturn;
end: end:
free(localVarPath);
return NULL; return NULL;
{{/returnType}} {{/returnType}}
{{^returnType}} {{^returnType}}
@@ -519,41 +491,23 @@ end:
{{/pathParams}} {{/pathParams}}
{{#headerParams}} {{#headerParams}}
{{#isString}} {{#isString}}
if (keyHeader_{{{paramName}}}) {
free(keyHeader_{{{paramName}}}); free(keyHeader_{{{paramName}}});
keyHeader_{{{paramName}}} = NULL;
}
free(valueHeader_{{{paramName}}}); free(valueHeader_{{{paramName}}});
{{/isString}} {{/isString}}
{{^isString}} {{^isString}}
if (keyHeader_{{{paramName}}}) {
free(keyHeader_{{{paramName}}}); free(keyHeader_{{{paramName}}});
keyHeader_{{{paramName}}} = NULL;
}
{{/isString}} {{/isString}}
free(keyPairHeader_{{paramName}}); free(keyPairHeader_{{paramName}});
{{/headerParams}} {{/headerParams}}
{{#bodyParams}} {{#bodyParams}}
{{#isListContainer}} {{#isListContainer}}
if (localVarItemJSON_{{paramName}}) {
cJSON_Delete(localVarItemJSON_{{paramName}}); cJSON_Delete(localVarItemJSON_{{paramName}});
localVarItemJSON_{{paramName}} = NULL;
}
if (localVarSingleItemJSON_{{paramName}}) {
cJSON_Delete(localVarSingleItemJSON_{{paramName}}); cJSON_Delete(localVarSingleItemJSON_{{paramName}});
localVarSingleItemJSON_{{paramName}} = NULL;
}
if (localVar_{{paramName}}) {
cJSON_Delete(localVar_{{paramName}}); cJSON_Delete(localVar_{{paramName}});
localVar_{{paramName}} = NULL;
}
free(localVarBodyParameters); free(localVarBodyParameters);
{{/isListContainer}} {{/isListContainer}}
{{^isListContainer}} {{^isListContainer}}
if (localVarSingleItemJSON_{{paramName}}) {
cJSON_Delete(localVarSingleItemJSON_{{paramName}}); cJSON_Delete(localVarSingleItemJSON_{{paramName}});
localVarSingleItemJSON_{{paramName}} = NULL;
}
free(localVarBodyParameters); free(localVarBodyParameters);
{{/isListContainer}} {{/isListContainer}}
{{/bodyParams}} {{/bodyParams}}
@@ -587,27 +541,18 @@ end:
{{/queryParams}} {{/queryParams}}
{{#formParams}} {{#formParams}}
{{#isFile}} {{#isFile}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
// free(fileVar_{{paramName}}->data); // free(fileVar_{{paramName}}->data);
// free(fileVar_{{paramName}}); // free(fileVar_{{paramName}});
{{/isFile}} {{/isFile}}
{{^isFile}} {{^isFile}}
{{#isString}} {{#isString}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
free(valueForm_{{{paramName}}}); free(valueForm_{{{paramName}}});
keyValuePair_free(keyPairForm_{{{paramName}}}); keyValuePair_free(keyPairForm_{{{paramName}}});
{{/isString}} {{/isString}}
{{^isString}} {{^isString}}
if (keyForm_{{{paramName}}}) {
free(keyForm_{{{paramName}}}); free(keyForm_{{{paramName}}});
keyForm_{{{paramName}}} = NULL;
}
free(keyPairForm_{{paramName}}); free(keyPairForm_{{paramName}});
{{/isString}} {{/isString}}
{{/isFile}} {{/isFile}}

View File

@@ -140,7 +140,6 @@ sslConfig_t *sslConfig_create(const char *clientCertFile, const char *clientKeyF
sslConfig->CACertFile = strdup(CACertFile); sslConfig->CACertFile = strdup(CACertFile);
} }
sslConfig->insecureSkipTlsVerify = insecureSkipTlsVerify; sslConfig->insecureSkipTlsVerify = insecureSkipTlsVerify;
return sslConfig;
} }
void sslConfig_free(sslConfig_t *sslConfig) { void sslConfig_free(sslConfig_t *sslConfig) {
@@ -183,10 +182,15 @@ char *assembleTargetUrl(char *basePath,
int operationParameterLength = 0; int operationParameterLength = 0;
int basePathLength = strlen(basePath); int basePathLength = strlen(basePath);
bool slashNeedsToBeAppendedToBasePath = false;
if(operationParameter != NULL) { if(operationParameter != NULL) {
operationParameterLength = (1 + strlen(operationParameter)); operationParameterLength = (1 + strlen(operationParameter));
} }
if(basePath[strlen(basePath) - 1] != '/') {
slashNeedsToBeAppendedToBasePath = true;
basePathLength++;
}
char *targetUrl = char *targetUrl =
malloc( malloc(
@@ -300,8 +304,6 @@ void apiClient_invoke(apiClient_t *apiClient,
(char *) listEntry->data); (char *) listEntry->data);
headers = curl_slist_append(headers, headers = curl_slist_append(headers,
buffContent); buffContent);
free(buffContent);
buffContent = NULL;
} }
} }
} else { } else {
@@ -315,8 +317,8 @@ void apiClient_invoke(apiClient_t *apiClient,
} }
if(formParameters != NULL) { if(formParameters != NULL) {
if(contentType && if(strstr(buffContent,
findStrInStrList(contentType, "application/x-www-form-urlencoded") != NULL) "application/x-www-form-urlencoded") != NULL)
{ {
long parameterLength = 0; long parameterLength = 0;
long keyPairLength = 0; long keyPairLength = 0;
@@ -358,8 +360,7 @@ void apiClient_invoke(apiClient_t *apiClient,
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, curl_easy_setopt(handle, CURLOPT_POSTFIELDS,
formString); formString);
} }
if(contentType && if(strstr(buffContent, "multipart/form-data") != NULL) {
findStrInStrList(contentType, "multipart/form-data") != NULL) {
mime = curl_mime_init(handle); mime = curl_mime_init(handle);
list_ForEach(listEntry, formParameters) { list_ForEach(listEntry, formParameters) {
keyValuePair_t *keyValuePair = keyValuePair_t *keyValuePair =
@@ -520,6 +521,10 @@ void apiClient_invoke(apiClient_t *apiClient,
free(targetUrl); free(targetUrl);
if(contentType != NULL) {
free(buffContent);
}
if(res == CURLE_OK) { if(res == CURLE_OK) {
curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &apiClient->response_code); curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &apiClient->response_code);
} else { } else {

View File

@@ -1,7 +1,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "../include/list.h" #include "../include/list.h"
static listEntry_t *listEntry_create(void *data) { static listEntry_t *listEntry_create(void *data) {
@@ -167,19 +166,3 @@ listEntry_t *list_getElementAt(list_t *list, long indexOfElement) {
return currentListEntry; return currentListEntry;
} }
} }
char* findStrInStrList(list_t *strList, const char *str)
{
if (!strList || !str) {
return NULL;
}
listEntry_t* listEntry = NULL;
list_ForEach(listEntry, strList) {
if (strstr((char*)listEntry->data, str) != NULL) {
return (char*)listEntry->data;
}
}
return NULL;
}

View File

@@ -36,6 +36,4 @@ void list_iterateThroughListBackward(list_t* list, void (*operationToPerform)(li
void listEntry_printAsInt(listEntry_t* listEntry, void *additionalData); void listEntry_printAsInt(listEntry_t* listEntry, void *additionalData);
void listEntry_free(listEntry_t *listEntry, void *additionalData); void listEntry_free(listEntry_t *listEntry, void *additionalData);
char* findStrInStrList(list_t* strList, const char* str);
#endif // INCLUDE_LIST_H #endif // INCLUDE_LIST_H

View File

@@ -48,8 +48,8 @@ fail:
return NULL; return NULL;
} }
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classFilename}}_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON) { {{classFilename}}_{{classname}}_e {{classFilename}}_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON) {
{{projectName}}_{{classVarName}}_{{enumName}}_e *{{classname}} = NULL; {{classFilename}}_{{classname}}_e *{{classname}} = NULL;
{{#isEnum}} {{#isEnum}}
{{#isNumeric}} {{#isNumeric}}
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}"); cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
@@ -59,7 +59,7 @@ fail:
} }
{{/isNumeric}} {{/isNumeric}}
{{#isString}} {{#isString}}
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classname}}Variable; {{classFilename}}_{{{classname}}}_e {{classname}}Variable;
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}"); cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
if(!cJSON_IsString({{{classname}}}Var) || ({{{classname}}}Var->valuestring == NULL)){ if(!cJSON_IsString({{{classname}}}Var) || ({{{classname}}}Var->valuestring == NULL)){
goto end; goto end;

View File

@@ -1,44 +1,21 @@
{{>licenseInfo}} {{>licenseInfo}}
package {{invokerPackage}}; package {{invokerPackage}};
import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.DateFormat;
import java.text.FieldPosition; import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat() public class RFC3339DateFormat extends ISO8601DateFormat {
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source) {
return parse(source, new ParsePosition(0));
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
// Same as ISO8601DateFormat but serializing milliseconds.
@Override @Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition); String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
} }
@Override
public Object clone() {
return this;
}
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -95,7 +95,7 @@ public abstract class AbstractOpenApiSchema {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -146,7 +146,6 @@ dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.findbugs:jsr305:3.0.2" compile "com.google.code.findbugs:jsr305:3.0.2"
compile "org.glassfish.jersey.core:jersey-client:$jersey_version" compile "org.glassfish.jersey.core:jersey-client:$jersey_version"
compile "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"

View File

@@ -10,10 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal, resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.22", "io.swagger" % "swagger-annotations" % "1.5.22",
"org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}},{{^supportJava6}} "org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
"org.glassfish.jersey.inject" % "jersey-hk2" % "2.27",{{/supportJava6}} "org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
"org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}}, "org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}},
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile",

View File

@@ -18,9 +18,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{#vars}} {{#vars}}
{{#isEnum}} {{#isEnum}}
{{^isContainer}} {{^isContainer}}
{{^vendorExtensions.x-enum-as-string}}
{{>modelInnerEnum}} {{>modelInnerEnum}}
{{/vendorExtensions.x-enum-as-string}}
{{/isContainer}} {{/isContainer}}
{{#isContainer}} {{#isContainer}}
{{#mostInnerItems}} {{#mostInnerItems}}
@@ -100,19 +98,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{#vars}} {{#vars}}
{{^isReadOnly}} {{^isReadOnly}}
{{#vendorExtensions.x-enum-as-string}}
public static final Set<String> {{{nameInSnakeCase}}}_VALUES = new HashSet<>(Arrays.asList(
{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}
));
{{/vendorExtensions.x-enum-as-string}}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-enum-as-string}}
if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) {
throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES));
}
{{/vendorExtensions.x-enum-as-string}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
{{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vendorExtensions.x-is-jackson-optional-nullable}}
@@ -234,12 +220,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{^isReadOnly}} {{^isReadOnly}}
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-enum-as-string}}
if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) {
throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES));
}
{{/vendorExtensions.x-enum-as-string}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
{{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vendorExtensions.x-is-jackson-optional-nullable}}
@@ -256,7 +236,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
* Return true if this {{name}} object is equal to o. * Return true if this {{name}} object is equal to o.
*/ */
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
{{#useReflectionEqualsHashCode}} {{#useReflectionEqualsHashCode}}
return EqualsBuilder.reflectionEquals(this, o, false, null, true); return EqualsBuilder.reflectionEquals(this, o, false, null, true);
{{/useReflectionEqualsHashCode}} {{/useReflectionEqualsHashCode}}
@@ -289,7 +269,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{/supportJava6}} {{/supportJava6}}
{{#supportJava6}} {{#supportJava6}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -331,7 +311,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
bean-discovery-mode="annotated">
</beans>

View File

@@ -1,10 +0,0 @@
kumuluzee:
server:
http:
port: 8081
rest-client:
registrations:
{{#apiInfo}}{{#apis}}{{#operations}}- class: {{{invokerPackage}}}.{{{classname}}}
url: http://localhost:8080/v2
{{/operations}}{{/apis}}{{/apiInfo}}

View File

@@ -1,98 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kumuluzee.version>3.9.0</kumuluzee.version>
<kumuluzee-rest.version>1.2.3</kumuluzee-rest.version>
<kumuluzee-rest-client.version>1.4.1</kumuluzee-rest-client.version>
<cxf-rt-rs-extension-providers.version>3.2.6</cxf-rt-rs-extension-providers.version>
<junit-version>4.13</junit-version>
<jersey-version>2.28</jersey-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-bom</artifactId>
<version>${kumuluzee.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-core</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-servlet-jetty</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-jax-rs-jersey</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-cdi-weld</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-json-p-jsonp</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-json-b-yasson</artifactId>
</dependency>
<dependency>
<groupId>com.kumuluz.ee.rest-client</groupId>
<artifactId>kumuluzee-rest-client</artifactId>
<version>${kumuluzee-rest-client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>${cxf-rt-rs-extension-providers.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-maven-plugin</artifactId>
<version>${kumuluzee.version}</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -138,7 +138,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private static String toIndentedString(Object o) { private static String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -5,7 +5,8 @@ import {{invokerPackage}}.ApiClient;
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
{{^fullJavaUtil}}import java.util.Collections; {{^fullJavaUtil}}import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@@ -18,6 +19,7 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@@ -115,7 +117,7 @@ public class {{classname}} {
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders(); final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();{{#hasQueryParams}} final MultiValueMap formParams = new LinkedMultiValueMap();{{#hasQueryParams}}
{{#queryParams}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{#hasMore}} {{#queryParams}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{#hasMore}}
{{/hasMore}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} {{/hasMore}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
@@ -129,7 +131,7 @@ public class {{classname}} {
{{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}} {{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}}
{{#formParams}}if ({{paramName}} != null) {{#formParams}}if ({{paramName}} != null)
formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}addAll{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}} formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
{{/hasMore}}{{/formParams}}{{/hasFormParams}} {{/hasMore}}{{/formParams}}{{/hasFormParams}}
final String[] localVarAccepts = { {{#hasProduces}} final String[] localVarAccepts = { {{#hasProduces}}

View File

@@ -123,7 +123,7 @@ ext {
jackson_version = "2.10.4" jackson_version = "2.10.4"
jackson_databind_version = "2.10.4" jackson_databind_version = "2.10.4"
jackson_databind_nullable_version = "0.2.1" jackson_databind_nullable_version = "0.2.1"
spring_web_version = "5.2.5.RELEASE" spring_web_version = "4.3.9.RELEASE"
jodatime_version = "2.9.9" jodatime_version = "2.9.9"
junit_version = "4.13" junit_version = "4.13"
{{#threetenbp}} {{#threetenbp}}
@@ -135,7 +135,6 @@ dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.findbugs:jsr305:3.0.2" compile "com.google.code.findbugs:jsr305:3.0.2"
compile "org.springframework:spring-web:$spring_web_version" compile "org.springframework:spring-web:$spring_web_version"
compile "org.springframework:spring-context:$spring_web_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"

View File

@@ -236,11 +236,6 @@
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
<version>${spring-web-version}</version> <version>${spring-web-version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-web-version}</version>
</dependency>
<!-- JSON processing: jackson --> <!-- JSON processing: jackson -->
<dependency> <dependency>
@@ -322,7 +317,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.22</swagger-annotations-version> <swagger-annotations-version>1.5.22</swagger-annotations-version>
<spring-web-version>5.2.5.RELEASE</spring-web-version> <spring-web-version>4.3.9.RELEASE</spring-web-version>
<jackson-version>2.10.4</jackson-version> <jackson-version>2.10.4</jackson-version>
<jackson-databind-version>2.10.4</jackson-databind-version> <jackson-databind-version>2.10.4</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>

View File

@@ -492,7 +492,7 @@ public class ApiClient {
*/ */
protected BodyInserter<?, ? super ClientHttpRequest> selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) { protected BodyInserter<?, ? super ClientHttpRequest> selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
if(MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) { if(MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); MultiValueMap<String, String> map = new LinkedMultiValueMap();
formParams formParams
.toSingleValueMap() .toSingleValueMap()

View File

@@ -230,7 +230,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{^supportJava6}} {{^supportJava6}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
{{#useReflectionEqualsHashCode}} {{#useReflectionEqualsHashCode}}
return EqualsBuilder.reflectionEquals(this, o, false, null, true); return EqualsBuilder.reflectionEquals(this, o, false, null, true);
{{/useReflectionEqualsHashCode}} {{/useReflectionEqualsHashCode}}
@@ -262,7 +262,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{/supportJava6}} {{/supportJava6}}
{{#supportJava6}} {{#supportJava6}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -301,7 +301,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -50,7 +50,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/vars}} {{/vars}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -82,7 +82,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,38 +1,19 @@
package {{apiPackage}}; package {{apiPackage}};
import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.DateFormat;
import java.text.FieldPosition; import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat { public class RFC3339DateFormat extends ISO8601DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
// Same as ISO8601DateFormat but serializing milliseconds.
@Override @Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition); String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
} }
@Override
public Object clone() {
return this;
}
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -72,7 +72,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/vars}} {{/vars}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -105,7 +105,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -143,7 +143,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private static String toIndentedString(Object o) { private static String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -109,7 +109,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private static String toIndentedString(Object o) { private static String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -103,7 +103,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{^supportJava6}} {{^supportJava6}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -125,7 +125,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/supportJava6}} {{/supportJava6}}
{{#supportJava6}} {{#supportJava6}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -160,7 +160,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@@ -1,38 +1,19 @@
package {{invokerPackage}}; package {{invokerPackage}};
import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.DateFormat;
import java.text.FieldPosition; import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat { public class RFC3339DateFormat extends ISO8601DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
// Same as ISO8601DateFormat but serializing milliseconds.
@Override @Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition); String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
} }
@Override
public Object clone() {
return this;
}
} }

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -1,4 +1,4 @@
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}"){{/isByteArray}}{{/pattern}}{{! {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not

View File

@@ -1,2 +1,2 @@
{{#additionalModelTypeAnnotations}}{{{.}}} {{#additionalModelTypeAnnotations}}{{.}}
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}

View File

@@ -37,7 +37,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/vars}} {{/vars}}
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@@ -69,7 +69,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

Some files were not shown because too many files have changed in this diff Show More