diff --git a/.github/workflows/check-supported-versions.yaml b/.github/workflows/check-supported-versions.yaml index 35c95b5b2aa..430b0ea815c 100644 --- a/.github/workflows/check-supported-versions.yaml +++ b/.github/workflows/check-supported-versions.yaml @@ -24,18 +24,18 @@ jobs: uses: actions/checkout@v2 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: ${{ matrix.java }} - - uses: actions/cache@v2.1.4 + - uses: actions/cache@v2.1.5 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - uses: actions/cache@v2.1.4 + - uses: actions/cache@v2.1.5 with: path: | ~/.gradle/caches @@ -49,7 +49,7 @@ jobs: run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }} - name: Upload Maven build artifact - uses: actions/upload-artifact@v2.2.2 + uses: actions/upload-artifact@v2.2.3 if: matrix.java == '8' && matrix.os == 'ubuntu-latest' with: name: artifact diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index bc4992833b7..98f191f2c9c 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: 11 - name: Compile with Maven diff --git a/.travis.yml b/.travis.yml index 9ba0b842f02..cc1f953acaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,14 @@ addons: - petstore.swagger.io before_install: + - sudo rm -rf /var/lib/apt/lists/* + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" + - sudo apt-get update + - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + - mkdir -vp ~/.docker/cli-plugins/ + - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx + - chmod a+x ~/.docker/cli-plugins/docker-buildx # to run petstore server locally via docker - echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true - docker pull swaggerapi/petstore @@ -149,6 +157,8 @@ install: script: # fail fast - set -e + # show docker buildx version + - docker buildx version # fail if the template files contains tabs - /bin/bash ./bin/utils/detect_tab_in_templates.sh # fail if the test files have changes @@ -199,12 +209,14 @@ after_success: echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin; export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); - docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online; + docker buildx create --use; if [ ! -z "$TRAVIS_TAG" ]; then - docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG; + docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online; + echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; fi; - if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then - docker push $DOCKER_GENERATOR_IMAGE_NAME && echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME"; + if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then + docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online; + echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master"; fi; fi; ## docker: build cli image and push to Docker Hub @@ -213,12 +225,14 @@ after_success: cp docker-entrypoint.sh ./modules/openapi-generator-cli; export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); - docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; + docker buildx create --use; + docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; if [ ! -z "$TRAVIS_TAG" ]; then - docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG; + docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; + echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; fi; - if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then - docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; + if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then + docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME"; fi; fi; diff --git a/CI/.drone.yml b/CI/.drone.yml index 49495e43094..037fb654724 100644 --- a/CI/.drone.yml +++ b/CI/.drone.yml @@ -2,6 +2,22 @@ kind: pipeline name: default steps: +# test Java 11 HTTP client +- name: java11-test + image: openjdk:11.0 + commands: + - ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error + - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error + # run ensure up-to-date + - /bin/bash bin/utils/ensure-up-to-date + # test java native client + - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml + - ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml + - ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml + # test all generators with fake petstore spec (2.0, 3.0) + - /bin/bash bin/utils/test-fake-petstore-for-all.sh + # generate test scripts + - /bin/bash bin/tests/run-all-test # test nim client - name: nim-client-test image: nimlang/nim @@ -38,21 +54,3 @@ steps: image: haskell:8.6.5 commands: - (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast) -# test Java 11 HTTP client -- name: java11-test - image: openjdk:11.0 - commands: - - ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error - - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error - # test java native client - - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml - - ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml - - ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml - # test all generators with fake petstore spec (2.0, 3.0) - - /bin/bash bin/utils/test-fake-petstore-for-all.sh - # generate test scripts - - /bin/bash bin/tests/run-all-test - # generate all petstore samples (client, servers, doc) - - /bin/bash bin/generate-samples.sh - # generate all petstore samples (openapi3) - - /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index e66f5524256..b647131c7d7 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -47,7 +47,8 @@ elif [ "$NODE_INDEX" = "2" ]; then git checkout -- . # look for outdated samples - ./bin/utils/ensure-up-to-date + #./bin/utils/ensure-up-to-date + # UPDATE: moved to drone.io fi echo "Running node $NODE_INDEX to test haskell" # install haskell diff --git a/README.md b/README.md index 5b36ced7376..c27f86b1531 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0. Libraries: RestSharp, HttpClient), **C++** (cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) | -| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) | +| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) | | **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** | | **Configuration files** | [**Apache2**](https://httpd.apache.org/) | | **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** | @@ -659,6 +659,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [Stingray](http://www.stingray.com) - [Suva](https://www.suva.ch/) - [Telstra](https://dev.telstra.com) +- [The University of Aizu](https://www.u-aizu.ac.jp/en/) - [TravelTime platform](https://www.traveltimeplatform.com/) - [TribalScale](https://www.tribalscale.com) - [TUI InfoTec GmbH](http://www.tui-infotec.com/) @@ -814,6 +815,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1) - 2021-02-05 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://blog.viadee.de/en/rest-api-roundtrip) by [Benjamin Klatt](https://twitter.com/benklatt) at [viadee](https://www.viadee.de/en/) - 2021-02-17 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://medium.com/nerd-for-tech/rest-api-roundtrip-with-springdoc-and-openapi-generator-30bd27ccf698) by [cloud @viadee](https://cloud-viadee.medium.com/) +- 2021-03-08 - [OpenAPI Generator 工具的躺坑尝试](https://blog.csdn.net/u013019701/article/details/114531975) by [独家雨天](https://blog.csdn.net/u013019701) at [CSDN官方博客](https://blog.csdn.net/) +- 2021-03-16 - [如何基于 Swagger 使用 OpenAPI Generator 生成 JMeter 脚本?](https://cloud.tencent.com/developer/article/1802704) by [高楼Zee](https://cloud.tencent.com/developer/user/5836255) at [腾讯云专栏](https://cloud.tencent.com/developer/column) +- 2021-03-24 - [openapi-generator-cli による TypeScript 型定義](https://zenn.dev/takepepe/articles/openapi-generator-cli-ts) by [Takefumi Yoshii](https://zenn.dev/takepepe) +- 2021-03-28 - [Trying out NestJS part 4: Generate Typescript clients from OpenAPI documents](https://dev.to/arnaudcortisse/trying-out-nestjs-part-4-generate-typescript-clients-from-openapi-documents-28mk) by [Arnaud Cortisse](https://dev.to/arnaudcortisse) +- 2021-03-31 - [Open API Server Implementation Using OpenAPI Generator](https://www.baeldung.com/java-openapi-generator-server) at [Baeldung](https://www.baeldung.com/) +- 2021-03-31 - [使用OpenAPI Generator實現Open API Server](https://www.1ju.org/article/java-openapi-generator-server) at [億聚網](https://www.1ju.org/) +- 2022-04-19 - [Introducing Twilio’s OpenAPI Specification Beta](https://www.twilio.com/blog/introducing-twilio-open-api-specification-beta) by [GARETH PAUL JONES](https://www.twilio.com/blog/author/gpj) at [Twilio Blog](https://www.twilio.com/blog) +- 2022-04-22 - [Leveraging OpenApi strengths in a Micro-Service environment](https://medium.com/unibuddy-technology-blog/leveraging-openapi-strengths-in-a-micro-service-environment-3d7f9e7c26ff) by Nicolas Jellab at [Unibuddy Technology Blog](https://medium.com/unibuddy-technology-blog) ## [6 - About Us](#table-of-contents) @@ -926,6 +935,7 @@ Here is a list of template creators: * Erlang Server: @galaxie * F# (Giraffe) Server: @nmfisher * Go Server: @guohuang + * Go (Echo) Server: @ph4r5h4d * Go (Gin) Server: @kemokemo * GraphQL Express Server: @renepardon * Haskell Servant: @algas @@ -1018,7 +1028,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Elm | @eriktim (2018/09) | | Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) | | F# | @nmfisher (2019/05) | -| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) | +| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) | | GraphQL | @renepardon (2018/12) | | Groovy | | | Haskell | | diff --git a/appveyor.yml b/appveyor.yml index b5fe251f30a..ec69f197198 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,6 +43,8 @@ build_script: - dotnet build samples\server\petstore\aspnetcore-3.0\Org.OpenAPITools.sln # build C# aspnetcore 2.2 server - dotnet build samples\server\petstore\aspnetcore\Org.OpenAPITools.sln + # build C# API client (multiple frameworks) + - dotnet build samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\Org.OpenAPITools.sln # build C# API client (httpclient) - dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\Org.OpenAPITools.sln # build C# API client (netcore) @@ -66,6 +68,8 @@ build_script: # run the locally installed openapi-generator-gradle-plugin - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace test_script: + # test c# API client (multiple frameworks) + - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client (httpclient) - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client (netcore) diff --git a/bin/configs/other/bash.yaml b/bin/configs/bash.yaml similarity index 100% rename from bin/configs/other/bash.yaml rename to bin/configs/bash.yaml diff --git a/bin/configs/csharp-netcore-OpenAPIClientCoreAndNet47.yaml b/bin/configs/csharp-netcore-OpenAPIClientCoreAndNet47.yaml new file mode 100644 index 00000000000..58b30f42acb --- /dev/null +++ b/bin/configs/csharp-netcore-OpenAPIClientCoreAndNet47.yaml @@ -0,0 +1,8 @@ +generatorName: csharp-netcore +outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47 +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp-netcore +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + targetFramework: netstandard2.1;netcoreapp3.0 + useCompareNetObjects: "true" diff --git a/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml index 830b10ebb75..edcc346a19f 100644 --- a/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml +++ b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml @@ -2,5 +2,9 @@ generatorName: dart-dio-next outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" additionalProperties: hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-dio-petstore-client-lib-fake.yaml b/bin/configs/dart-dio-petstore-client-lib-fake.yaml index 2463da464ed..eca85edfd88 100644 --- a/bin/configs/dart-dio-petstore-client-lib-fake.yaml +++ b/bin/configs/dart-dio-petstore-client-lib-fake.yaml @@ -2,5 +2,9 @@ generatorName: dart-dio outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/dart-dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" additionalProperties: hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-dio-petstore-client-lib-oas2.yaml b/bin/configs/dart-dio-petstore-client-lib-oas2.yaml deleted file mode 100644 index 447136518a8..00000000000 --- a/bin/configs/dart-dio-petstore-client-lib-oas2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -generatorName: dart-dio -outputDir: samples/client/petstore/dart-dio/petstore_client_lib -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/dart-dio -additionalProperties: - hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore-client-lib-fake.yaml b/bin/configs/dart-petstore-client-lib-fake.yaml index 8dda4df4b0a..d48cd8038b7 100644 --- a/bin/configs/dart-petstore-client-lib-fake.yaml +++ b/bin/configs/dart-petstore-client-lib-fake.yaml @@ -2,5 +2,8 @@ generatorName: dart outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/dart2 +typeMappings: + Client: "ModelClient" + File: "ModelFile" additionalProperties: hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore-client-lib-oas2.yaml b/bin/configs/dart-petstore-client-lib-oas2.yaml deleted file mode 100644 index 861a829ac4f..00000000000 --- a/bin/configs/dart-petstore-client-lib-oas2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -generatorName: dart -outputDir: samples/client/petstore/dart2/petstore_client_lib -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/dart2 -additionalProperties: - hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml b/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml index cb943d3d957..8582a881d51 100644 --- a/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml +++ b/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml @@ -2,6 +2,9 @@ generatorName: dart outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/dart2 +typeMappings: + Client: "ModelClient" + File: "ModelFile" additionalProperties: hideGenerationTimestamp: "true" serializationLibrary: json_serializable diff --git a/bin/configs/go-echo-server-petstore-new.yaml b/bin/configs/go-echo-server-petstore-new.yaml new file mode 100644 index 00000000000..bfc2e946c58 --- /dev/null +++ b/bin/configs/go-echo-server-petstore-new.yaml @@ -0,0 +1,6 @@ +generatorName: go-echo-server +outputDir: samples/server/petstore/go-echo-server +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/go-echo-server +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/go-server-go-api-server.yaml b/bin/configs/go-server-go-api-server.yaml index 6446d212a35..7fb761639b2 100644 --- a/bin/configs/go-server-go-api-server.yaml +++ b/bin/configs/go-server-go-api-server.yaml @@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/go-server additionalProperties: hideGenerationTimestamp: "true" packageName: petstoreserver + addResponseHeaders: true diff --git a/bin/configs/php-symfony-SymfonyBundle-php.yaml b/bin/configs/php-symfony-SymfonyBundle-php.yaml index c77a71f14b7..f7c6218a50f 100644 --- a/bin/configs/php-symfony-SymfonyBundle-php.yaml +++ b/bin/configs/php-symfony-SymfonyBundle-php.yaml @@ -1,4 +1,4 @@ generatorName: php-symfony outputDir: samples/server/petstore/php-symfony/SymfonyBundle-php -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/php-symfony diff --git a/bin/configs/swift5-default.yaml b/bin/configs/swift5-default.yaml index ede36e7331c..fffd318be1a 100644 --- a/bin/configs/swift5-default.yaml +++ b/bin/configs/swift5-default.yaml @@ -1,6 +1,6 @@ generatorName: swift5 outputDir: samples/client/petstore/swift5/default -inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/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/swift5 generateAliasAsModel: true additionalProperties: diff --git a/bin/configs/swift5-rxswiftLibrary.yaml b/bin/configs/swift5-rxswiftLibrary.yaml index f564ac3340c..49d0e24cca5 100644 --- a/bin/configs/swift5-rxswiftLibrary.yaml +++ b/bin/configs/swift5-rxswiftLibrary.yaml @@ -9,3 +9,4 @@ additionalProperties: podSummary: PetstoreClient projectName: PetstoreClient podHomepage: https://github.com/openapitools/openapi-generator + useBacktickEscapes: true diff --git a/bin/configs/swift5-urlsessionLibrary.yaml b/bin/configs/swift5-urlsessionLibrary.yaml index 2fe5ecca0c7..b260611e602 100644 --- a/bin/configs/swift5-urlsessionLibrary.yaml +++ b/bin/configs/swift5-urlsessionLibrary.yaml @@ -9,3 +9,5 @@ additionalProperties: podSummary: PetstoreClient projectName: PetstoreClient podHomepage: https://github.com/openapitools/openapi-generator + useSPMFileStructure: true + useClasses: true diff --git a/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml new file mode 100644 index 00000000000..1cb364d79ea --- /dev/null +++ b/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -0,0 +1,3 @@ +generatorName: typescript-axios +outputDir: samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml diff --git a/bin/meta-codegen.sh b/bin/meta-codegen.sh index d2a05a0fe6a..5b90f6abc8c 100755 --- a/bin/meta-codegen.sh +++ b/bin/meta-codegen.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + SCRIPT="$0" echo "# START SCRIPT: $SCRIPT" @@ -18,8 +20,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl java $JAVA_OPTS -jar $executable $ags -(cd "$root"/samples/meta-codegen/ && mvn -B package -Djacoco.skip=true -DskipTests=true -f pom.xml) +(./mvnw -B package -Djacoco.skip=true -DskipTests=true -f "$root"/samples/meta-codegen/pom.xml) -ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@" +ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/3_0/petstore.json -o samples/meta-codegen/usage $@" -java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2 \ No newline at end of file +java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2 diff --git a/bin/utils/test-fake-petstore-for-all.sh b/bin/utils/test-fake-petstore-for-all.sh index 6be320d6b99..1ec62890c3b 100755 --- a/bin/utils/test-fake-petstore-for-all.sh +++ b/bin/utils/test-fake-petstore-for-all.sh @@ -11,15 +11,16 @@ logfile="/tmp/generator-fake-petstore-output.log" for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g') do - if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then - echo "[OAS 2.0] Executed ${GENERATOR} successfully!" - else - echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:" - echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}" - echo "ERROR: The output of the command was:" - cat ${logfile} - exit 1 - fi + # no longer test 2.0 spec as we migrated to 3.0 spec + #if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then + # echo "[OAS 2.0] Executed ${GENERATOR} successfully!" + #else + # echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:" + # echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}" + # echo "ERROR: The output of the command was:" + # cat ${logfile} + # exit 1 + #fi if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/3.0/${GENERATOR} > ${logfile} 2>&1; then echo "[OAS 3.0] Executed ${GENERATOR} successfully!" diff --git a/docs/generators.md b/docs/generators.md index e581cc54fb1..521bdc3dbf0 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -86,6 +86,7 @@ The following generators are available: * [erlang-server](generators/erlang-server.md) * [fsharp-functions (beta)](generators/fsharp-functions.md) * [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md) +* [go-echo-server (beta)](generators/go-echo-server.md) * [go-gin-server](generators/go-gin-server.md) * [go-server](generators/go-server.md) * [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md) diff --git a/docs/generators/csharp-netcore.md b/docs/generators/csharp-netcore.md index c7935752d01..0887dcbfeca 100644 --- a/docs/generators/csharp-netcore.md +++ b/docs/generators/csharp-netcore.md @@ -29,7 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src| -|targetFramework|The target .NET framework version.|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
**netcoreapp2.1**
.NET Core 2.1 compatible
**netcoreapp3.0**
.NET Core 3.0 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net5.0**
.NET 5.0 compatible
|netstandard2.0| +|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
**netcoreapp2.1**
.NET Core 2.1 compatible
**netcoreapp3.0**
.NET Core 3.0 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net5.0**
.NET 5.0 compatible
|netstandard2.0| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| |useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false| diff --git a/docs/generators/csharp.md b/docs/generators/csharp.md index ec9c4454ff8..0b3185606ec 100644 --- a/docs/generators/csharp.md +++ b/docs/generators/csharp.md @@ -25,7 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src| -|targetFramework|The target .NET framework version.|
**v3.5**
.NET Framework 3.5 compatible
**v4.0**
.NET Framework 4.0 compatible
**v4.5**
.NET Framework 4.5 compatible
**v4.5.2**
.NET Framework 4.5.2+ compatible
**netstandard1.3**
.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)
**uwp**
Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)
|v4.5| +|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|
**v3.5**
.NET Framework 3.5 compatible
**v4.0**
.NET Framework 4.0 compatible
**v4.5**
.NET Framework 4.5 compatible
**v4.5.2**
.NET Framework 4.5.2+ compatible
**netstandard1.3**
.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)
**uwp**
Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)
|v4.5| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useCompareNetObjects|Use KellermanSoftware.CompareNetObjects for deep recursive object comparison. WARNING: this option incurs potential performance impact.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| diff --git a/docs/generators/dart-dio-next.md b/docs/generators/dart-dio-next.md index da4fbe4f9a8..d644e35b04a 100644 --- a/docs/generators/dart-dio-next.md +++ b/docs/generators/dart-dio-next.md @@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • String
  • bool
  • double
  • -
  • dynamic
  • int
  • num
  • diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index 767884d7eeb..9368dc7e7fc 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -30,11 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Imports | | ---------- | ------- | -|BuiltList|package:built_collection/built_collection.dart| -|BuiltMap|package:built_collection/built_collection.dart| -|BuiltSet|package:built_collection/built_collection.dart| -|JsonObject|package:built_value/json_object.dart| -|Uint8List|dart:typed_data| ## INSTANTIATION TYPES @@ -49,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • String
  • bool
  • double
  • -
  • dynamic
  • int
  • num
  • diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md index d357bae3146..068b5728f02 100644 --- a/docs/generators/dart-jaguar.md +++ b/docs/generators/dart-jaguar.md @@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • String
  • bool
  • double
  • -
  • dynamic
  • int
  • num
  • diff --git a/docs/generators/dart.md b/docs/generators/dart.md index d550256877c..ef805b78451 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -43,7 +43,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • String
  • bool
  • double
  • -
  • dynamic
  • int
  • num
  • diff --git a/docs/generators/go-echo-server.md b/docs/generators/go-echo-server.md new file mode 100644 index 00000000000..53c726fb85e --- /dev/null +++ b/docs/generators/go-echo-server.md @@ -0,0 +1,206 @@ +--- +title: Config Options for go-echo-server +sidebar_label: go-echo-server +--- + +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|packageName|Go package name (convention: lowercase).| |openapi| +|packageVersion|Go package version.| |1.0.0| +|serverPort|The network port the generated server binds to| |8080| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|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 diff --git a/docs/generators/go-server.md b/docs/generators/go-server.md index e0abd3de52c..36ac78aea6d 100644 --- a/docs/generators/go-server.md +++ b/docs/generators/go-server.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|addResponseHeaders|To include response headers in ImplResponse| |false| |enumClassPrefix|Prefix enum with class name| |false| |featureCORS|Enable Cross-Origin Resource Sharing middleware| |false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index ebf6f2b0e86..9774b434f13 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -33,7 +33,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine 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| +|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null| |swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null| +|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false| +|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null| ## IMPORT MAPPING diff --git a/docs/plugins.md b/docs/plugins.md index 224a0d5fa58..691c5fa85d1 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,7 +15,9 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 5.0.0 + + 5.1.0 + diff --git a/docs/templating.md b/docs/templating.md index fa901bc65aa..aba3fd49274 100644 --- a/docs/templating.md +++ b/docs/templating.md @@ -910,9 +910,9 @@ x-content-type: application/json ### Rust-server -#### x-responseId +#### x-response-id -Each response may specify a unique `x-responseId`. `rust-server` will use this to name the corresponding enum variant in the code. e.g. +Each response may specify a unique `x-response-id`. `rust-server` will use this to name the corresponding enum variant in the code. e.g. ```yaml paths: @@ -921,7 +921,7 @@ paths: responses: 200: description: OK - x-responseId: Pong + x-response-id: Pong ``` ### MySQL Schema diff --git a/docs/usage.md b/docs/usage.md index a5719e27761..bad47c90ade 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -10,12 +10,13 @@ This page demonstrates navigating the options via CLI. Commands are presented he The `help` option lists all commands available to the CLI. -```bash +```text openapi-generator-cli help usage: openapi-generator-cli [] The most commonly used openapi-generator-cli commands are: author Utilities for authoring generators or customizing templates. + batch Generate code in batch via external configs. config-help Config help for chosen lang generate Generate code with the specified generator. help Display help information about openapi-generator @@ -30,26 +31,28 @@ command. ## version -The version command provides version information, returning either the semver version by default or the git sha when passed `--sha`. +The version command provides version information, returning either the version by default, the git commit sha when passed `--sha`, or verbose output when passed `--full`. -```bash +```text NAME - openapi-generator-cli version - Show version information + openapi-generator-cli version - Show version information used in tooling SYNOPSIS - openapi-generator-cli version [--sha] + openapi-generator-cli version [--full] [--sha] OPTIONS + --full + Full version details + --sha Git commit SHA version - ``` ## list The `list` command outputs a formatted list of every available generator. Pass the `-s/--short` option if you would like a CSV output for easy parsing. -```bash +```text openapi-generator-cli help list NAME openapi-generator-cli list - Lists the available generators @@ -66,7 +69,6 @@ OPTIONS -s, --short shortened output (suitable for scripting) - ``` Example: @@ -81,26 +83,49 @@ For the full list of generators, refer to the [Generators List](./generators.md) The `config-help` option provides details about -```bash +```text openapi-generator-cli help config-help NAME openapi-generator-cli config-help - Config help for chosen lang SYNOPSIS openapi-generator-cli config-help - [(-f | --format )] + [(-f | --format )] [--feature-set] + [--full-details] [(-g | --generator-name )] - [--markdown-header] [--named-header] - [(-o | --output )] + [--import-mappings] [--instantiation-types] + [--language-specific-primitive] [--markdown-header] [--named-header] + [(-o | --output )] [--reserved-words] OPTIONS -f , --format Write output files in the desired format. Options are 'text', 'markdown' or 'yamlsample'. Default is 'text'. + --feature-set + displays feature set as supported by the generator + + --full-details + displays CLI options as well as other configs/mappings (implies + --instantiation-types, --reserved-words, + --language-specific-primitives, --import-mappings, + --supporting-files) + -g , --generator-name generator to get config help for + --import-mappings + displays the default import mappings (types and aliases, and what + imports they will pull into the template) + + --instantiation-types + displays types used to instantiate simple type/alias names + + --language-specific-primitive + displays the language specific primitives (types which require no + additional imports, or which may conflict with user defined model + names) + --markdown-header When format=markdown, include this option to write out markdown headers (e.g. for docusaurus). @@ -112,6 +137,9 @@ OPTIONS Optionally write help to this location, otherwise default is standard output + --reserved-words + displays the reserved words which may result in renamed model or + property names ``` The option of note is `-g/--generator-name` (other options are exposed for tooling). @@ -153,7 +181,7 @@ To pass these go client generator-specific options to the `generate` command for The `meta` command creates a new Java class and template files, used for creating your own custom templates. -```bash +```text openapi-generator-cli help meta NAME openapi-generator-cli meta - MetaGenerator. Generator for creating a new @@ -161,11 +189,15 @@ NAME the language you specify, and includes default templates to include. SYNOPSIS - openapi-generator-cli meta [(-n | --name )] + openapi-generator-cli meta [(-l | --language )] + [(-n | --name )] [(-o | --output )] [(-p | --package )] [(-t | --type )] OPTIONS + -l , --language + the implementation language for the generator class + -n , --name the human-readable name of the generator @@ -186,7 +218,7 @@ For an in-depth example of using the `meta` command, see [Customization](./custo The `validate` command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements (if available). -```bash +```text openapi-generator-cli help validate NAME openapi-generator-cli validate - Validate specification @@ -200,7 +232,6 @@ OPTIONS location of the OpenAPI spec, as URL or file (required) --recommend - ``` Valid Spec Example (using [petstore-v3.0.yaml](https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml)) @@ -250,7 +281,7 @@ An example bash completion script can be found in the repo at [scripts/openapi-g The `generate` command is the workhorse of the generator toolset. As such, it has _many_ more options available than the previous commands. The abbreviated options are below, but you may expand the full descriptions. -```bash +```text openapi-generator-cli help generate NAME openapi-generator-cli generate - Generate code with the specified @@ -269,23 +300,24 @@ SYNOPSIS [--git-repo-id ] [--git-user-id ] [--global-property ...] [--group-id ] [--http-user-agent ] - (-i | --input-spec ) + [(-i | --input-spec )] [--ignore-file-override ] [--import-mappings ...] [--instantiation-types ...] [--invoker-package ] [--language-specific-primitives ...] - [--library ] [--log-to-stderr] [--minimal-update] + [--legacy-discriminator-behavior] [--library ] + [--log-to-stderr] [--minimal-update] [--model-name-prefix ] [--model-name-suffix ] [--model-package ] - [(-o | --output )] - [(-p | --additional-properties )...] + [(-o | --output )] [(-p | --additional-properties )...] [--package-name ] [--release-note ] [--remove-operation-id-prefix] [--reserved-words-mappings ...] [(-s | --skip-overwrite)] [--server-variables ...] - [--skip-validate-spec] [--strict-spec ] + [--skip-operation-example] [--skip-validate-spec] + [--strict-spec ] [(-t