forked from loafle/openapi-generator-original
Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9662e0eff | ||
|
|
c0e11ec01b | ||
|
|
030a7a848d | ||
|
|
a9bbd9334d | ||
|
|
f6b4e18ac4 | ||
|
|
18b950cdc3 | ||
|
|
52554af454 | ||
|
|
6f86830e0c | ||
|
|
af3d862c5b | ||
|
|
8cc7befbf3 | ||
|
|
df682aba99 | ||
|
|
df7b9b53f1 | ||
|
|
538fdeafb5 | ||
|
|
a839203e0d | ||
|
|
3626aaf8fa | ||
|
|
e3dbd82e79 | ||
|
|
bee2671243 | ||
|
|
e2df6c32e0 | ||
|
|
fac83ce760 | ||
|
|
d13d05955b | ||
|
|
2dc0220874 | ||
|
|
96c1bda608 | ||
|
|
e09417d25c | ||
|
|
8991168518 | ||
|
|
cd6986d9be | ||
|
|
c104821d6e | ||
|
|
37a8b56a2b | ||
|
|
6bf5741fd1 | ||
|
|
2f26812982 | ||
|
|
2d22ae90fc | ||
|
|
498c9b8a47 | ||
|
|
006ec182ef | ||
|
|
a9a131ac51 | ||
|
|
d5c7c9c9b7 | ||
|
|
d0e838ee02 | ||
|
|
40799937fb | ||
|
|
eff94da9c9 | ||
|
|
dc4296819a | ||
|
|
ab98833f7d | ||
|
|
d9bde12ebb | ||
|
|
3084fe5937 | ||
|
|
bfb82f1a91 | ||
|
|
8cf34ca80f | ||
|
|
6a828d55df | ||
|
|
d70adae0e3 | ||
|
|
dd6257917d | ||
|
|
2f01053680 | ||
|
|
56c38904fb | ||
|
|
87a9fa3808 | ||
|
|
a1fc114efa | ||
|
|
70954cabde | ||
|
|
5c275bccd2 | ||
|
|
de69eac316 | ||
|
|
c89d21a903 | ||
|
|
80064d8411 | ||
|
|
51aeb6c833 | ||
|
|
f434b5fa13 | ||
|
|
b0d6110686 | ||
|
|
52384badd2 | ||
|
|
1de71a9e16 | ||
|
|
47473401ec | ||
|
|
3adfdfafea | ||
|
|
db77e070d1 | ||
|
|
eebad5c9aa | ||
|
|
96bbab98a4 | ||
|
|
e4364b612f | ||
|
|
2838db2052 | ||
|
|
23479b30e4 | ||
|
|
1ccf4b9cb3 | ||
|
|
8ff1aca4f8 | ||
|
|
5238597f95 | ||
|
|
6e2e542f83 | ||
|
|
518c33a209 | ||
|
|
964260101b | ||
|
|
8ca1788a75 | ||
|
|
244c6e358c | ||
|
|
2daa89a326 | ||
|
|
6af9131d2f | ||
|
|
c649203270 | ||
|
|
83a4616ba7 | ||
|
|
389be8180a | ||
|
|
40d7b58666 | ||
|
|
8766531c56 | ||
|
|
47ac49ff99 | ||
|
|
a0d68baa24 | ||
|
|
10f17877f1 | ||
|
|
bf6db1c2d1 | ||
|
|
2f428e7763 | ||
|
|
78d7ffbce7 | ||
|
|
d175673077 | ||
|
|
3cd0e13a46 | ||
|
|
60958b78d9 | ||
|
|
5181ddcbb0 | ||
|
|
a1a9e70fe4 | ||
|
|
2b36383308 | ||
|
|
f07b3e0521 |
@@ -62,7 +62,7 @@ before_install:
|
||||
- gem install bundler
|
||||
- npm install -g typescript
|
||||
- npm install -g npm
|
||||
- npm install -g elm@0.18.0-exp5
|
||||
#- npm install -g elm@0.18.0-exp5
|
||||
- npm config set registry http://registry.npmjs.org/
|
||||
# set python 3.6.3 as default
|
||||
- source ~/virtualenv/python3.6/bin/activate
|
||||
@@ -139,6 +139,7 @@ script:
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml
|
||||
# test gradle plugin
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
||||
|
||||
@@ -2,6 +2,17 @@ kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
# test ocaml petstore client
|
||||
- name: ocaml-test
|
||||
image: ocaml/opam2:4.07
|
||||
commands:
|
||||
- sudo apt-get -y install m4
|
||||
- cd samples/client/petstore/ocaml
|
||||
- opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
|
||||
- opam pin add ocaml-migrate-parsetree 1.3.1
|
||||
- eval $(opam env)
|
||||
- sudo chmod -R 777 .
|
||||
- dune build --build-dir=./_build
|
||||
# test haskell client
|
||||
- name: haskell-client-test
|
||||
image: haskell:8.6.5
|
||||
@@ -28,13 +39,3 @@ steps:
|
||||
- /bin/bash bin/run-all-petstore
|
||||
# generate all petstore samples (openapi3)
|
||||
- /bin/bash bin/openapi3/run-all-petstore
|
||||
# test ocaml petstore client
|
||||
- name: ocaml-test
|
||||
image: ocaml/opam2:4.07
|
||||
commands:
|
||||
- sudo apt-get -y install m4
|
||||
- cd samples/client/petstore/ocaml
|
||||
- opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
|
||||
- eval $(opam env)
|
||||
- sudo chmod -R 777 .
|
||||
- dune build --build-dir=./_build
|
||||
|
||||
@@ -1,55 +1,25 @@
|
||||
sudo: required
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
- $HOME/.ivy2
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
- $HOME/.stack
|
||||
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
|
||||
- $HOME/samples/client/petstore/ruby/venodr/bundle
|
||||
- $HOME/samples/client/petstore/python/.venv/
|
||||
- $HOME/samples/client/petstore/typescript-node/npm/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-node/npm/typings/
|
||||
- $HOME/samples/client/petstore/typescript-fetch/tests/default/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-fetch/tests/default/typings
|
||||
- $HOME/samples/client/petstore/typescript-fetch/builds/default/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-fetch/builds/default/typings
|
||||
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/typings
|
||||
- $HOME/samples/client/petstore/typescript-fetch/builds/with-npm-version/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings
|
||||
- $HOME/samples/client/petstore/typescript-angularjs/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-angularjs/typings
|
||||
- $HOME/.cocoapods/repos/master
|
||||
timeout: 1000
|
||||
|
||||
# comment out the host table change to use the public petstore server
|
||||
addons:
|
||||
hosts:
|
||||
- petstore.swagger.io
|
||||
|
||||
osx_image: xcode10.3
|
||||
before_install:
|
||||
- export SW=`pwd`
|
||||
- rvm list
|
||||
- rvm use 2.3.3
|
||||
#- rvm use 2.3.3
|
||||
- gem environment
|
||||
- gem install bundler -N --no-ri --no-rdoc
|
||||
- gem install cocoapods -v 1.2.1 -N --no-ri --no-rdoc
|
||||
- gem install xcpretty -N --no-ri --no-rdoc
|
||||
- gem install bundler -N
|
||||
- gem install cocoapods -v 1.2.1 -N
|
||||
- gem install xcpretty -N
|
||||
- pod --version
|
||||
# comment out below to avoid errors
|
||||
#- pod repo update
|
||||
- pod setup --silent > /dev/null
|
||||
- mkdir -p ~/.local/bin
|
||||
- export PATH=$HOME/.local/bin:$PATH
|
||||
# start local petstore server
|
||||
- git clone -b docker --single-branch https://github.com/wing328/swagger-samples
|
||||
- cd swagger-samples/java/java-jersey-jaxrs
|
||||
- sudo mvn jetty:run &
|
||||
- cd $SW
|
||||
#- pod setup --silent > /dev/null
|
||||
#- mkdir -p ~/.local/bin
|
||||
#- export PATH=$HOME/.local/bin:$PATH
|
||||
## start local petstore server
|
||||
#- git clone -b docker --single-branch https://github.com/wing328/swagger-samples
|
||||
#- cd swagger-samples/java/java-jersey-jaxrs
|
||||
#- sudo mvn jetty:run &
|
||||
#- cd $SW
|
||||
|
||||
# show host table to confirm petstore.swagger.io is mapped to localhost
|
||||
- cat /etc/hosts
|
||||
@@ -64,4 +34,4 @@ before_install:
|
||||
|
||||
script:
|
||||
# run integration tests defined in maven pom.xml
|
||||
- mvn -q --batch-mode verify -Psamples
|
||||
- mvn -q --batch-mode verify -Psamples.ios -Dmaven.javadoc.skip=true
|
||||
|
||||
51
CI/bitrise.yml
Normal file
51
CI/bitrise.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
format_version: '8'
|
||||
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
|
||||
project_type: other
|
||||
trigger_map:
|
||||
- push_branch: "*"
|
||||
workflow: primary
|
||||
- pull_request_source_branch: "*"
|
||||
workflow: primary
|
||||
workflows:
|
||||
primary:
|
||||
steps:
|
||||
- git-clone@4.0.17: {}
|
||||
- brew-install@0.10.2:
|
||||
inputs:
|
||||
- packages: maven
|
||||
- script@1.1.5:
|
||||
title: Install Cocoapods
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo gem install cocoapods
|
||||
- script@1.1.5:
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
mvn package
|
||||
title: Build openapi-generator
|
||||
- script@1.1.5:
|
||||
title: Update Swift4 samples
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sh bin/swift4-all.sh
|
||||
- script@1.1.5:
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
./samples/client/petstore/swift4/swift4_test_all.sh && ./samples/client/test/swift4/swift4_test_all.sh && exit ${PIPESTATUS[0]}
|
||||
title: Run Swift4 tests
|
||||
|
||||
@@ -28,7 +28,7 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
git checkout -- .
|
||||
|
||||
# look for outdated samples
|
||||
./bin/utils/ensure-up-to-date --batch
|
||||
./bin/utils/ensure-up-to-date
|
||||
fi
|
||||
#elif [ "$NODE_INDEX" = "3" ]; then
|
||||
echo "Running node $NODE_INDEX to test haskell"
|
||||
|
||||
@@ -27,6 +27,7 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
|
||||
|
||||
# This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh.
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
|
||||
42
README.md
42
README.md
@@ -2,23 +2,26 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.2.1`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.2.2`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
[`4.3.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.3.x) branch: [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
[`5.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/5.0.x) branch: [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
@@ -109,8 +112,8 @@ OpenAPI Generator Version | Release Date | Notes
|
||||
---------------------------- | ------------ | -----
|
||||
5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback)
|
||||
4.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.3.0-SNAPSHOT/)| 29.02.2020 | Minor release (breaking changes with fallbacks)
|
||||
4.2.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.1/)| 15.11.2019 | Patch release
|
||||
[4.2.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.2.0) (latest stable release) | 31.10.2019 | Minor release (bug fixes, enhancements, breaking chanages with fallbacks)
|
||||
4.2.2 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.2/)| 02.12.2019 | Patch release
|
||||
[4.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.2.1) (latest stable release) | 15.11.2019 | Patch release
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
|
||||
@@ -166,16 +169,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.0/openapi-generator-cli-4.2.0.jar`
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.1/openapi-generator-cli-4.2.1.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.0/openapi-generator-cli-4.2.0.jar -O openapi-generator-cli.jar
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.1/openapi-generator-cli-4.2.1.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.0/openapi-generator-cli-4.2.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.1/openapi-generator-cli-4.2.1.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -390,10 +393,10 @@ openapi-generator version
|
||||
```
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.2.0):
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.1.2):
|
||||
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.2.0 -g
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.1.2 -g
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -417,7 +420,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.0/openapi-generator-cli-4.2.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.2.1/openapi-generator-cli-4.2.1.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@@ -577,6 +580,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Camptocamp](https://www.camptocamp.com/en)
|
||||
- [codecentric AG](https://www.codecentric.de/)
|
||||
- [Commencis](https://www.commencis.com/)
|
||||
- [Crossover Health](https://crossoverhealth.com/)
|
||||
- [Cupix](https://www.cupix.com/)
|
||||
- [DB Systel](https://www.dbsystel.de)
|
||||
- [dwango](https://dwango.co.jp/)
|
||||
@@ -588,6 +592,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Fuse](https://www.fuse.no/)
|
||||
- [Gantner](https://www.gantner.com)
|
||||
- [GenFlow](https://github.com/RepreZen/GenFlow)
|
||||
- [GetYourGuide](https://www.getyourguide.com/)
|
||||
- [GMO Pepabo](https://pepabo.com/en/)
|
||||
- [GoDaddy](https://godaddy.com)
|
||||
- [Here](https://developer.here.com/)
|
||||
@@ -610,6 +615,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [RedHat](https://www.redhat.com)
|
||||
- [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development)
|
||||
- [REST United](https://restunited.com)
|
||||
- [Sony Interactive Entertainment](https://www.sie.com/en/index.html)
|
||||
- [Stingray](http://www.stingray.com)
|
||||
- [Suva](https://www.suva.ch/)
|
||||
- [Telstra](https://dev.telstra.com)
|
||||
@@ -620,6 +626,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [WSO2](https://wso2.com/)
|
||||
- [Vouchery.io](https://vouchery.io)
|
||||
- [Xero](https://www.xero.com/)
|
||||
- [Yahoo Japan](https://www.yahoo.co.jp/)
|
||||
- [Yelp](https://www.yelp.com/)
|
||||
- [Zalando](https://www.zalando.com)
|
||||
|
||||
@@ -690,7 +697,15 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2019-10-24 - [Microprofile OpenAPI - Code First or Design First?](https://github.com/pe-st/apidocs/blob/master/MicroProfile-OpenAPI-all-slides.pdf) by [Peter [pɛʃə] Steiner](https://twitter.com/pesche) at [eclipsecon Europe 2019](https://www.eclipsecon.org/europe2019/sessions/microprofile-openapi-code-first-or-design-first)
|
||||
- 2019-11-06 - [Generating API clients based on OpenAPI v3 specifications](https://98elements.com/blog/generating-api-clients-based-on-openapi-v3-specifications) by [Dominik Jastrzębski @ 98elements](https://98elements.com)
|
||||
- 2019-11-06 - [OpenAPIを利用して自前のAPIサーバー(Sinatra)を移植した時のメモ](https://qiita.com/YasuhiroABE/items/c73920eab2d9d6e97fd9) by [Yasuhiro ABE](https://twitter.com/YasuhiroABE)
|
||||
- 2019-11-07 - [API First development with OpenAPI - You should you practise it !?](https://www.youtube.com/watch?v=F9iF3a1Z8Y8) by [Nick Van Hoof](https://www.nickvanhoof.com/) at [Devoxx Belgium 2019](https://devoxx.be/)
|
||||
- 2019-11-08 - [JHipster beyond CRUD - API-First for Enterprises by Enrico Costanzi](https://www.youtube.com/watch?v=m28JFovKQ20) by [Enrico Costanzi](https://twitter.com/enricocostanzi) at [JHipster Conf 2019 in Paris](https://jhipster-conf.github.io/)
|
||||
- 2019-11-11 - [TypeScript REST APIクライアント](https://qiita.com/unhurried/items/7b74f7d3c43545dadd2b) by [@unhurried](https://qiita.com/unhurried)
|
||||
- 2019-11-11 - [One Spec to Rule them all - OpenAPI in Action](https://www.youtube.com/watch?v=MMay_nht8ec) by [Andreas Litt](https://github.com/littldr) at [code.talks 2019](https://www.codetalks.com/)
|
||||
- 2019-11-17 - [OpenAPI Generator YouTube playlist](https://www.youtube.com/playlist?list=PLtJyHVMdzfF6fBkOUV5VDVErP23CGgHIy) at [YouTube](https://www.youtube.com)
|
||||
- 2019-11-20 - [Introduction to OpenAPI](https://noti.st/lornajane/HvDH7U/introduction-to-openapi) by [Lorna Mitchell](https://twitter.com/lornajane) at [GOTO Copenhagen 2019](https://gotocph.com/2019/)
|
||||
- 2019/11/23 - [Swagger ではない OpenAPI Specification 3.0 による API サーバー開発](https://www.slideshare.net/techblogyahoo/swagger-openapi-specification-30-api) by [Tetsuya Morimoto](https://github.com/t2y) at [JJUG CCC 2019 Fall](https://ccc2019fall.java-users.jp/)
|
||||
- 2019-11-25 - [openapi-generatorで手軽にスタブサーバとクライアントの生成](https://qiita.com/pochopocho13/items/8db662e1934fb2b408b8) by [@pochopocho13](https://twitter.com/pochopocho13)
|
||||
- 2019-11-26 - [CordaCon 2019 Highlights: Braid Server and OpenAPI Generator for Corda Client API’s](https://blog.b9lab.com/cordacon-2019-highlights-braid-server-and-openapi-generator-for-corda-flows-api-s-d24179ccb27c) by [Adel Rustum](https://blog.b9lab.com/@adelrestom) at [B9lab](https://blog.b9lab.com/)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -780,6 +795,7 @@ Here is a list of template creators:
|
||||
* TypeScript (Node): @mhardorf
|
||||
* TypeScript (Rxjs): @denyo
|
||||
* TypeScript (Inversify): @gualtierim
|
||||
* TypeSCript (redux-query): @petejohansonxo
|
||||
* Server Stubs
|
||||
* Ada: @stcarrez
|
||||
* C# ASP.NET 5: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
@@ -884,7 +900,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
| Nim | |
|
||||
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
|
||||
@@ -893,13 +909,13 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
||||
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ackintosh (2017/09) [:heart:](https://www.patreon.com/ackintosh/overview), @ybelenko (2018/07), @renepardon (2018/12) |
|
||||
| PowerShell | |
|
||||
| Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @slash-arun (2019/11) |
|
||||
| Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @slash-arun (2019/11) @spacether (2019/11)|
|
||||
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
||||
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) @richardwhiuk (2019/07) |
|
||||
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @d-date (2018/03) |
|
||||
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @d-date (2018/03) @4brunu (2019/11) |
|
||||
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) |
|
||||
|
||||
:heart: = Link to support the contributor directly
|
||||
|
||||
|
||||
6
bin/ci/php-slim4-server-petstore.json
Normal file
6
bin/ci/php-slim4-server-petstore.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"generatorName": "php-slim4",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/3_0/petstore.yaml",
|
||||
"outputDir": "samples/server/petstore/php-slim4",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/php-slim4-server"
|
||||
}
|
||||
9
bin/ci/python-experimental.json
Normal file
9
bin/ci/python-experimental.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"generatorName": "python-experimental",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/python-experimental",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/python",
|
||||
"additionalProperties": {
|
||||
"packageName": "petstore_api"
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
"outputDir": "samples/server/petstore/springboot",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/JavaSpring",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true
|
||||
"hideGenerationTimestamp": true,
|
||||
"snapshotVersion": true
|
||||
}
|
||||
}
|
||||
8
bin/cpp-qt5-petstore.json
Normal file
8
bin/cpp-qt5-petstore.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/cpp-qt5",
|
||||
"additionalProperties": {
|
||||
"cppNamespace": "test_namespace",
|
||||
"modelNamePrefix": "PFX"
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client \
|
||||
-i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
|
||||
-g cpp-qt5-client \
|
||||
--additional-properties=cppNamespace=test_namespace \
|
||||
--additional-properties=modelNamePrefix=PFX \
|
||||
-o samples/client/petstore/cpp-qt5 $@"
|
||||
-c bin/cpp-qt5-petstore.json \
|
||||
$@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/kotlin-springboot-petstore-server.sh
|
||||
./bin/kotlin-springboot-petstore-server-reactive.sh
|
||||
./bin/kotlin-springboot-petstore-server-reactive.sh
|
||||
./bin/kotlin-springboot-petstore-server-model-mutable.sh
|
||||
|
||||
35
bin/kotlin-springboot-petstore-server-model-mutable.sh
Executable file
35
bin/kotlin-springboot-petstore-server-model-mutable.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot-modelMutable --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,serializableModel=true,modelMutable=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot"
|
||||
rm -rf samples/server/petstore/kotlin-springboot-modelMutable
|
||||
|
||||
echo "Generating Kotling Spring Boot server..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin-vertx -o samples/server/petstore/kotlin/vertx"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin-vertx -o samples/server/petstore/kotlin/vertx --additional-properties=modelMutable=false"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
|
||||
@@ -1,52 +1,40 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
declare cwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
declare root="$(cd "$cwd" && cd ../ && pwd)"
|
||||
|
||||
if ! command -v gradle > /dev/null; then
|
||||
echo "[WARN] This script requires a system gradle to be installed. Not treating this as an error."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
executable="${root}/modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
./mvnw -B clean package
|
||||
(cd "$root" && ./mvnw -B clean package)
|
||||
fi
|
||||
|
||||
\rm -rf "samples/meta-codegen-kotlin/lib"
|
||||
\rm -rf "${root}/samples/meta-codegen-kotlin/lib"
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o samples/meta-codegen-kotlin/lib -l kotlin $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if [ ! -f samples/meta-codegen-kotlin/gradle/wrapper/gradle-wrapper.jar ]; then
|
||||
(cd samples/meta-codegen-kotlin/ && gradle wrapper --gradle-version 5.6.2 --distribution-type bin)
|
||||
if [ ! -f "${root}"samples/meta-codegen-kotlin/gradle/wrapper/gradle-wrapper.jar ]; then
|
||||
(cd "${root}"/samples/meta-codegen-kotlin/ && gradle wrapper --gradle-version 5.6.2 --distribution-type bin)
|
||||
fi
|
||||
|
||||
|
||||
(cp samples/meta-codegen-kotlin/gradlew samples/meta-codegen-kotlin/lib/ && \
|
||||
cp -R samples/meta-codegen-kotlin/gradle samples/meta-codegen-kotlin/lib/ && \
|
||||
cd samples/meta-codegen-kotlin/lib && \
|
||||
(cp "${root}"/samples/meta-codegen-kotlin/gradlew "${root}"/samples/meta-codegen-kotlin/lib/ && \
|
||||
cp -R "${root}"/samples/meta-codegen-kotlin/gradle "${root}"/samples/meta-codegen-kotlin/lib/ && \
|
||||
cd "${root}"/samples/meta-codegen-kotlin/lib && \
|
||||
./gradlew shadowJar)
|
||||
|
||||
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen-kotlin/usage $@"
|
||||
|
||||
java $JAVA_OPTS -cp samples/meta-codegen-kotlin/lib/build/libs/my-client-codegen-openapi-generator-1.0-SNAPSHOT-all.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
||||
java $JAVA_OPTS -cp ${root}/samples/meta-codegen-kotlin/lib/build/libs/my-client-codegen-openapi-generator-1.0-SNAPSHOT-all.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
declare cwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
declare root="$(cd "$cwd" && cd ../ && pwd)"
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
executable="${root}/modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
./mvnw -B clean package
|
||||
if [ ! -f "$executable" ]; then
|
||||
(cd "$root" && ./mvnw -B clean package)
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
@@ -30,8 +17,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
./mvnw clean package -f samples/meta-codegen/pom.xml
|
||||
(cd "$root" && ./mvnw clean package -f 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 $@"
|
||||
|
||||
java $JAVA_OPTS -cp samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
||||
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/3_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
|
||||
5
bin/openapi3/elm-all.sh
Executable file
5
bin/openapi3/elm-all.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/openapi3/elm-petstore.sh
|
||||
./bin/openapi3/elm-composition.sh
|
||||
|
||||
35
bin/openapi3/elm-composition.sh
Executable file
35
bin/openapi3/elm-composition.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# auto format elm code using elm-format
|
||||
export ELM_POST_PROCESS_FILE="/usr/bin/env elm-format --elm-version=0.19 --yes"
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/composition.yaml -g elm -t modules/openapi-generator/src/main/resources/elm -o samples/openapi3/client/composition/elm --enable-post-process-file $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -3,4 +3,5 @@
|
||||
|
||||
./bin/python-asyncio-petstore.sh
|
||||
./bin/python-petstore.sh
|
||||
./bin/python-experimental-petstore.sh
|
||||
./bin/python-tornado-petstore.sh
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot --additional-properties hideGenerationTimestamp=true $@"
|
||||
ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot --additional-properties hideGenerationTimestamp=true,snapshotVersion=true $@"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/springboot/src/main"
|
||||
rm -rf samples/server/petstore/springboot/src/main
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
./bin/swift4-petstore.sh
|
||||
./bin/swift4-petstore-promisekit.sh
|
||||
./bin/swift4-petstore-result.sh
|
||||
./bin/swift4-petstore-rxswift.sh
|
||||
./bin/swift4-petstore-objcCompatible.sh
|
||||
./bin/swift4-petstore-unwrapRequired.sh
|
||||
./bin/swift4-petstore-nonPublicApi.sh
|
||||
|
||||
7
bin/swift4-petstore-nonPublicApi.json
Normal file
7
bin/swift4-petstore-nonPublicApi.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"podSummary": "PetstoreClient",
|
||||
"podHomepage": "https://github.com/openapitools/openapi-generator",
|
||||
"podAuthors": "",
|
||||
"projectName": "PetstoreClient",
|
||||
"nonPublicApi": true
|
||||
}
|
||||
42
bin/swift4-petstore-nonPublicApi.sh
Executable file
42
bin/swift4-petstore-nonPublicApi.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-nonPublicApi.json -o samples/client/petstore/swift4/nonPublicApi --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/nonPublicApi
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/nonPublicApi
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-objcCompatible.json -o samples/client/petstore/swift4/objcCompatible $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-objcCompatible.json -o samples/client/petstore/swift4/objcCompatible --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekit --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekitLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
7
bin/swift4-petstore-result.json
Normal file
7
bin/swift4-petstore-result.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"podSummary": "PetstoreClient",
|
||||
"podHomepage": "https://github.com/openapitools/openapi-generator",
|
||||
"podAuthors": "",
|
||||
"projectName": "PetstoreClient",
|
||||
"responseAs": "Result"
|
||||
}
|
||||
42
bin/swift4-petstore-result.sh
Executable file
42
bin/swift4-petstore-result.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-result.json -o samples/client/petstore/swift4/resultLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/resultLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/resultLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
@@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswift --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswiftLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift4Test.json -g swift4 -c ./bin/swift4-test.json -o samples/client/test/swift4/default $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift4Test.json -g swift4 -c ./bin/swift4-test.json -o samples/client/test/swift4/default --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"npmName": "@openapitools/typescript-redux-query-petstore",
|
||||
"npmVersion": "1.0.0",
|
||||
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||
"snapshot" : false
|
||||
}
|
||||
32
bin/typescript-redux-query-petstore-with-npm-version.sh
Executable file
32
bin/typescript-redux-query-petstore-with-npm-version.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/typescript-redux-query -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-redux-query -c bin/typescript-redux-query-petstore-with-npm-version.json -o samples/client/petstore/typescript-redux-query/builds/with-npm-version $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
32
bin/typescript-redux-query-petstore.sh
Executable file
32
bin/typescript-redux-query-petstore.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/typescript-redux-query -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-redux-query -o samples/client/petstore/typescript-redux-query/builds/default $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -21,9 +21,7 @@ echo "Please press CTRL+C to stop or the script will continue in 5 seconds."
|
||||
|
||||
sleep 5
|
||||
|
||||
# LIST OF SCRIPTS:
|
||||
declare -a scripts=(
|
||||
# SAMPLES
|
||||
declare -a samples=(
|
||||
"${root}/bin/ruby-client-petstore.sh"
|
||||
"${root}/bin/ruby-client-petstore-faraday.sh"
|
||||
"${root}/bin/openapi3/ruby-client-petstore.sh"
|
||||
@@ -80,11 +78,17 @@ declare -a scripts=(
|
||||
"${root}/bin/dart2-petstore.sh"
|
||||
"${root}/bin/java-play-framework-petstore-server-all.sh"
|
||||
#"${root}/bin/elm-petstore-all.sh"
|
||||
"${root}/bin/typescript-redux-query-petstore-with-npm-version.sh"
|
||||
)
|
||||
|
||||
# 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.
|
||||
declare -a always_iterate=(
|
||||
"${root}/bin/meta-codegen.sh"
|
||||
# OTHERS
|
||||
"${root}/bin/utils/export_docs_generators.sh"
|
||||
"${root}/bin/utils/copy-to-website.sh"
|
||||
"${root}/bin/utils/export_generators_readme.sh")
|
||||
"${root}/bin/utils/export_generators_readme.sh"
|
||||
)
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
|
||||
|
||||
@@ -96,7 +100,7 @@ if [ "true" = "$batch_mode" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
java $JAVA_OPTS -jar "$executable" batch --includes-base-dir "${root}" --fail-fast -- "${root}"/bin/ci/*
|
||||
else
|
||||
for script in "${scripts[@]}"; do
|
||||
for script in "${samples[@]}"; do
|
||||
if eval "$script" > /dev/null 2>&1; then
|
||||
echo "Executed $script successfully!"
|
||||
else
|
||||
@@ -106,6 +110,15 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
for i in "${always_iterate[@]}"; do
|
||||
if eval "$i" > /dev/null 2>&1; then
|
||||
echo "Executed $i successfully!"
|
||||
else
|
||||
echo "ERROR: Failed to run $i"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check:
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "UNCOMMITTED CHANGES ERROR"
|
||||
@@ -119,3 +132,4 @@ if [ -n "$(git status --porcelain)" ]; then
|
||||
else
|
||||
echo "Git working tree is clean"
|
||||
fi
|
||||
|
||||
|
||||
10
bin/windows/typescript-redux-query-petstore-with-npm.bat
Executable file
10
bin/windows/typescript-redux-query-petstore-with-npm.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-redux-query-petstore-with-npm-version.json -g typescript-redux-query -o samples\client\petstore\typescript-redux-query\builds\with-npm-version
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
14
bin/windows/typescript-redux-query-petstore.bat
Normal file
14
bin/windows/typescript-redux-query-petstore.bat
Normal file
@@ -0,0 +1,14 @@
|
||||
@ECHO OFF
|
||||
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
|
||||
echo
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-redux-query -o samples\client\petstore\typescript-redux-query\builds\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -65,6 +65,7 @@ The following generators are available:
|
||||
* [typescript-inversify](generators/typescript-inversify.md)
|
||||
* [typescript-jquery](generators/typescript-jquery.md)
|
||||
* [typescript-node](generators/typescript-node.md)
|
||||
* [typescript-redux-query](generators/typescript-redux-query.md)
|
||||
* [typescript-rxjs](generators/typescript-rxjs.md)
|
||||
|
||||
|
||||
|
||||
@@ -12,4 +12,5 @@ sidebar_label: go-experimental
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|
||||
@@ -12,4 +12,5 @@ sidebar_label: go
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|
||||
@@ -15,6 +15,7 @@ sidebar_label: kotlin-server
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dl>|ktor|
|
||||
|featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true|
|
||||
|featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false|
|
||||
|
||||
@@ -15,6 +15,7 @@ sidebar_label: kotlin-spring
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
@@ -28,4 +29,5 @@ sidebar_label: kotlin-spring
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dl>|spring-boot|
|
||||
|
||||
@@ -15,3 +15,4 @@ sidebar_label: kotlin-vertx
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|
||||
@@ -15,6 +15,7 @@ sidebar_label: kotlin
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only)</dd><dt>**threetenbp**</dt><dd>Threetenbp (jvm only)</dd><dl>|java8|
|
||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd><dl>|array|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd><dl>|jvm-okhttp4|
|
||||
|
||||
@@ -10,7 +10,8 @@ sidebar_label: swift4
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|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|
|
||||
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result are available.| |null|
|
||||
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |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|
|
||||
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|
||||
|podSource|Source information used for Podspec| |null|
|
||||
|
||||
19
docs/generators/typescript-redux-query.md
Normal file
19
docs/generators/typescript-redux-query.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Config Options for typescript-redux-query
|
||||
sidebar_label: typescript-redux-query
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|
||||
@@ -557,3 +557,85 @@ The name of the file should be `config.yml` or `config.yaml` (in our example it
|
||||
openapi-generator generate -i petstore.yaml -g typescript-fetch -o out \
|
||||
-c config.yaml
|
||||
```
|
||||
|
||||
|
||||
## batch
|
||||
|
||||
The `batch` command allows you to move all CLI arguments supported by the `generate` command into a YAML or JSON file.
|
||||
|
||||
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
|
||||
modified by `--includes-base-dir`.
|
||||
|
||||
```bash
|
||||
openapi-generator help batch
|
||||
NAME
|
||||
openapi-generator-cli batch - Generate code in batch via external
|
||||
configs.
|
||||
|
||||
SYNOPSIS
|
||||
openapi-generator-cli batch [--fail-fast]
|
||||
[--includes-base-dir <includes>] [(-r <threads> | --threads <threads>)]
|
||||
[--root-dir <root>] [--timeout <timeout>] [(-v | --verbose)] [--]
|
||||
<configs>...
|
||||
|
||||
OPTIONS
|
||||
--fail-fast
|
||||
fail fast on any errors
|
||||
|
||||
--includes-base-dir <includes>
|
||||
base directory used for includes
|
||||
|
||||
-r <threads>, --threads <threads>
|
||||
thread count
|
||||
|
||||
--root-dir <root>
|
||||
root directory used output/includes (includes can be overridden)
|
||||
|
||||
--timeout <timeout>
|
||||
execution timeout (minutes)
|
||||
|
||||
-v, --verbose
|
||||
verbose mode
|
||||
|
||||
--
|
||||
This option can be used to separate command-line options from the
|
||||
list of argument, (useful when arguments might be mistaken for
|
||||
command-line options
|
||||
|
||||
<configs>
|
||||
Generator configuration files.
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
# create "shared" config
|
||||
mkdir shared && cat > shared/common.yaml <<EOF
|
||||
inputSpec: https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
additionalProperties:
|
||||
x-ext-name: "Your Name"
|
||||
EOF
|
||||
|
||||
# create "standard" configs
|
||||
cat > kotlin.yaml <<EOF
|
||||
'!include': 'shared/common.yaml'
|
||||
outputDir: out/kotlin
|
||||
generatorName: kotlin
|
||||
artifactId: kotlin-petstore-string
|
||||
additionalProperties:
|
||||
dateLibrary: string
|
||||
serializableModel: "true"
|
||||
EOF
|
||||
|
||||
cat > csharp.yaml <<EOF
|
||||
'!include': 'shared/common.yaml'
|
||||
outputDir: out/csharp-netcore
|
||||
generatorName: csharp-netcore
|
||||
additionalProperties:
|
||||
packageGuid: "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
|
||||
useCompareNetObjects: "true"
|
||||
EOF
|
||||
|
||||
# Generate them
|
||||
openapi-generator batch *.yaml
|
||||
```
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
@@ -100,16 +101,6 @@ public class GenerateBatch implements Runnable {
|
||||
numThreads = threads;
|
||||
}
|
||||
|
||||
// This allows us to put meta-configs in a different file from referenced configs.
|
||||
// If not specified, we'll assume it's the parent directory of the first file.
|
||||
File includesDir;
|
||||
if (includes != null) {
|
||||
includesDir = new File(includes);
|
||||
} else {
|
||||
Path first = Paths.get(configs.get(0));
|
||||
includesDir = first.getParent().toFile();
|
||||
}
|
||||
|
||||
Path rootDir;
|
||||
if (root != null) {
|
||||
rootDir = Paths.get(root);
|
||||
@@ -117,7 +108,23 @@ public class GenerateBatch implements Runnable {
|
||||
rootDir = Paths.get(System.getProperty("user.dir"));
|
||||
}
|
||||
|
||||
LOGGER.info(String.format(Locale.ROOT, "Batch generation using %d threads.\nIncludes: %s\nRoot: %s", numThreads, includesDir.getAbsolutePath(), rootDir.toAbsolutePath().toString()));
|
||||
// This allows us to put meta-configs in a different file from referenced configs.
|
||||
// If not specified, we'll assume it's the parent directory of the first file.
|
||||
File includesDir;
|
||||
if (includes != null) {
|
||||
includesDir = new File(includes);
|
||||
} else {
|
||||
Path first = Paths.get(configs.get(0));
|
||||
if (Files.isRegularFile(first) && !Files.isSymbolicLink(first)) {
|
||||
includesDir = first.toAbsolutePath().getParent().toFile();
|
||||
} else {
|
||||
// Not traversing symbolic links for includes. Falling back to rooted working directory.
|
||||
includesDir = rootDir.toFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOGGER.info(String.format(Locale.ROOT, "Batch generation using up to %d threads.\nIncludes: %s\nRoot: %s", numThreads, includesDir.getAbsolutePath(), rootDir.toAbsolutePath().toString()));
|
||||
|
||||
// Create a module which loads our config files, but supports a special "!include" key which can point to an existing config file.
|
||||
// This allows us to create a sort of meta-config which holds configs which are otherwise required at CLI time (via generate task).
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -45,7 +45,7 @@ compileJava.dependsOn tasks.openApiGenerate
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "4.2.1"
|
||||
id "org.openapi.generator" version "4.2.2"
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=4.2.1
|
||||
openApiGeneratorVersion=4.2.2
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -18,5 +18,5 @@ gradle generateGoWithInvalidSpec
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=4.2.1 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=4.2.2 openApiValidate
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
126
modules/openapi-generator-maven-plugin/examples/spring.xml
Normal file
126
modules/openapi-generator-maven-plugin/examples/spring.xml
Normal file
@@ -0,0 +1,126 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>sample-project</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>sample-project</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.1.RELEASE</version>
|
||||
</parent>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- activate the plugin -->
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.2-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>spring-server</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- specify the swagger yaml -->
|
||||
<inputSpec>${project.basedir}/swagger.yaml</inputSpec>
|
||||
|
||||
<!-- target to generate java client code -->
|
||||
<generatorName>spring</generatorName>
|
||||
|
||||
<!-- hint: if you want to generate java server code, e.g. based on Spring Boot,
|
||||
you can use the following target: <generatorName>spring</generatorName> -->
|
||||
|
||||
<!-- pass any necessary config options -->
|
||||
<configOptions>
|
||||
<serializableModel>true</serializableModel>
|
||||
<snapshotVersion>true</snapshotVersion>
|
||||
</configOptions>
|
||||
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<dependencies>
|
||||
<!-- dependencies are needed for the client being generated -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- You can find the dependencies for the library configuation you chose by looking in JavaClientCodegen.
|
||||
Then find the corresponding dependency on Maven Central, and set the versions in the property section below -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--SpringFox dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.8</swagger-annotations-version>
|
||||
|
||||
<spring-boot-starter-web.version>2.2.1.RELEASE</spring-boot-starter-web.version>
|
||||
<springfox-version>2.8.0</springfox-version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.2.1</version>
|
||||
<version>4.2.2</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
@@ -200,6 +200,7 @@
|
||||
<generex-version>1.0.2</generex-version>
|
||||
<jackson-version>2.9.10</jackson-version>
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
<kotlin-version>1.3.60</kotlin-version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -328,6 +329,29 @@
|
||||
<artifactId>openapi-generator-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler-embeddable</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-util</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CodegenModel {
|
||||
.append("hasMoreModels", hasMoreModels)
|
||||
.append("hasEnums", hasEnums)
|
||||
.append("isEnum", isEnum)
|
||||
.append("isNullable", isEnum)
|
||||
.append("isNullable", isNullable)
|
||||
.append("hasRequired", hasRequired)
|
||||
.append("hasOptional", hasOptional)
|
||||
.append("isArrayModel", isArrayModel)
|
||||
|
||||
@@ -174,6 +174,7 @@ public class CodegenParameter {
|
||||
output.isListContainer = this.isListContainer;
|
||||
output.isMapContainer = this.isMapContainer;
|
||||
output.isExplode = this.isExplode;
|
||||
output.style = this.style;
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -249,7 +250,8 @@ public class CodegenParameter {
|
||||
Objects.equals(minItems, that.minItems) &&
|
||||
Objects.equals(uniqueItems, that.uniqueItems) &&
|
||||
Objects.equals(multipleOf, that.multipleOf) &&
|
||||
Objects.equals(isExplode, that.isExplode);
|
||||
Objects.equals(isExplode, that.isExplode) &&
|
||||
Objects.equals(style, that.style);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,7 +321,8 @@ public class CodegenParameter {
|
||||
minItems,
|
||||
uniqueItems,
|
||||
multipleOf,
|
||||
isExplode);
|
||||
isExplode,
|
||||
style);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@@ -390,6 +393,7 @@ public class CodegenParameter {
|
||||
", uniqueItems=" + uniqueItems +
|
||||
", multipleOf=" + multipleOf +
|
||||
", isExplode=" + isExplode +
|
||||
", style='" + style + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1086,6 +1086,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
reservedWords = new HashSet<String>();
|
||||
|
||||
// TODO: Move Java specific import mappings out of DefaultCodegen.
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping.put("BigDecimal", "java.math.BigDecimal");
|
||||
importMapping.put("UUID", "java.util.UUID");
|
||||
@@ -1895,6 +1896,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (composed.getRequired() != null) {
|
||||
required.addAll(composed.getRequired());
|
||||
allRequired.addAll(composed.getRequired());
|
||||
}
|
||||
addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired);
|
||||
|
||||
@@ -4401,14 +4403,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return property value as boolean
|
||||
*/
|
||||
public boolean convertPropertyToBooleanAndWriteBack(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = convertPropertyToBoolean(propertyKey);
|
||||
// write back as boolean
|
||||
writePropertyBack(propertyKey, booleanValue);
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
boolean result = convertPropertyToBoolean(propertyKey);
|
||||
writePropertyBack(propertyKey, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4432,12 +4429,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
final Object booleanValue = additionalProperties.get(propertyKey);
|
||||
Boolean result = Boolean.FALSE;
|
||||
if (booleanValue instanceof Boolean) {
|
||||
result = (Boolean) booleanValue;
|
||||
} else if (booleanValue instanceof String) {
|
||||
result = Boolean.parseBoolean((String) booleanValue);
|
||||
} else {
|
||||
LOGGER.warn("The value (generator's option) must be either boolean or string. Default to `false`.");
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void writePropertyBack(String propertyKey, boolean value) {
|
||||
|
||||
@@ -1295,6 +1295,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
// We have to create a new auth method instance because the original object must
|
||||
// not be modified.
|
||||
CodegenSecurity opSecurity = security.filterByScopeNames(opScopes);
|
||||
opSecurity.hasMore = security.hasMore;
|
||||
result.add(opSecurity);
|
||||
filtered = true;
|
||||
break;
|
||||
|
||||
@@ -135,7 +135,8 @@ public class CodegenConfigurator {
|
||||
|
||||
return configurator;
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Unable to deserialize config file: " + configFile, ex);
|
||||
LOGGER.error(ex.getMessage());
|
||||
throw new RuntimeException("Unable to deserialize config file: " + configFile);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
protected boolean withGoCodegenComment = false;
|
||||
protected boolean withXml = false;
|
||||
protected boolean enumClassPrefix = false;
|
||||
protected boolean structPrefix = false;
|
||||
|
||||
protected String packageName = "openapi";
|
||||
protected Set<String> numberTypes;
|
||||
@@ -113,10 +114,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
typeMapping.put("object", "map[string]interface{}");
|
||||
|
||||
numberTypes = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16","int32", "int64",
|
||||
"float32", "float64")
|
||||
Arrays.asList(
|
||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16", "int32", "int64",
|
||||
"float32", "float64")
|
||||
);
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
@@ -278,10 +279,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
return "[]" + getTypeDeclaration(inner);
|
||||
return "[]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner));
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(p);
|
||||
return getSchemaType(p) + "[string]" + getTypeDeclaration(inner);
|
||||
return getSchemaType(p) + "[string]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner));
|
||||
}
|
||||
//return super.getTypeDeclaration(p);
|
||||
|
||||
@@ -505,7 +506,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
CodegenModel model = (CodegenModel) v;
|
||||
for (CodegenProperty param : model.vars) {
|
||||
if (!addedTimeImport
|
||||
&& ("time.Time".equals(param.dataType) || ("[]time.Time".equals(param.dataType)))) {
|
||||
&& ("time.Time".equals(param.dataType) || ("[]time.Time".equals(param.dataType)))) {
|
||||
imports.add(createMapping("import", "time"));
|
||||
addedTimeImport = true;
|
||||
}
|
||||
@@ -641,6 +642,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
this.enumClassPrefix = enumClassPrefix;
|
||||
}
|
||||
|
||||
public void setStructPrefix(boolean structPrefix) {
|
||||
this.structPrefix = structPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
if (schema.getDefault() != null) {
|
||||
|
||||
@@ -689,7 +689,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
Schema<?> items = getSchemaItems((ArraySchema) p);
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(items) + ">";
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, items)) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(p);
|
||||
if (inner == null) {
|
||||
@@ -697,7 +697,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
p.setAdditionalProperties(inner);
|
||||
}
|
||||
return getSchemaType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||
return getSchemaType(p) + "<String, " + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + ">";
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
@@ -1040,23 +1040,22 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Setting additionalProperties is not the responsibility of this method. These side-effects should be moved elsewhere to prevent unexpected behaviors.
|
||||
if(artifactVersion == null) {
|
||||
// If no artifactVersion is provided in additional properties, version from API specification is used.
|
||||
// If none of them is provided then fallbacks to default version
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) {
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION) && additionalProperties.get(CodegenConstants.ARTIFACT_VERSION) != null) {
|
||||
this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION));
|
||||
} else if (openAPI.getInfo() != null && openAPI.getInfo().getVersion() != null) {
|
||||
this.setArtifactVersion(openAPI.getInfo().getVersion());
|
||||
} else {
|
||||
this.setArtifactVersion(ARTIFACT_VERSION_DEFAULT_VALUE);
|
||||
}
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) {
|
||||
Boolean useSnapshotVersion = Boolean.valueOf((String) additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION));
|
||||
if (useSnapshotVersion) {
|
||||
if (convertPropertyToBooleanAndWriteBack(CodegenConstants.SNAPSHOT_VERSION)) {
|
||||
this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson}
|
||||
|
||||
public static final String MODEL_MUTABLE = "modelMutable";
|
||||
public static final String MODEL_MUTABLE_DESC = "Create mutable models";
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
|
||||
protected String artifactId;
|
||||
@@ -225,6 +228,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(MODEL_MUTABLE, MODEL_MUTABLE_DESC, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -434,19 +439,19 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) {
|
||||
this.setSerializableModel(getBooleanOption(CodegenConstants.SERIALIZABLE_MODEL));
|
||||
this.setSerializableModel(convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.PARCELIZE_MODELS)) {
|
||||
this.setParcelizeModels(getBooleanOption(CodegenConstants.PARCELIZE_MODELS));
|
||||
this.setParcelizeModels(convertPropertyToBooleanAndWriteBack(CodegenConstants.PARCELIZE_MODELS));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.PARCELIZE_MODELS, parcelizeModels);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) {
|
||||
this.setNonPublicApi(getBooleanOption(CodegenConstants.NON_PUBLIC_API));
|
||||
this.setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.NON_PUBLIC_API, nonPublicApi);
|
||||
}
|
||||
@@ -458,18 +463,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
}
|
||||
|
||||
private boolean getBooleanOption(String key) {
|
||||
final Object booleanValue = additionalProperties.get(key);
|
||||
Boolean result = Boolean.FALSE;
|
||||
if (booleanValue instanceof Boolean) {
|
||||
result = (Boolean) booleanValue;
|
||||
} else if (booleanValue instanceof String) {
|
||||
result = Boolean.parseBoolean((String) booleanValue);
|
||||
}
|
||||
additionalProperties.put(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
|
||||
importMapping.put("BuiltList", "package:built_collection/built_collection.dart");
|
||||
importMapping.put("BuiltMap", "package:built_collection/built_collection.dart");
|
||||
importMapping.put("JsonObject", "package:built_value/json_object.dart");
|
||||
importMapping.put("Uint8List", "dart:typed_data");
|
||||
}
|
||||
|
||||
@@ -129,6 +130,13 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
//super.addAdditionPropertiesToCodeGenModel(codegenModel, schema);
|
||||
codegenModel.additionalPropertiesType = getSchemaType(ModelUtils.getAdditionalProperties(schema));
|
||||
addImport(codegenModel, codegenModel.additionalPropertiesType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) {
|
||||
@@ -230,9 +238,16 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
//Updates any List properties on a model to a BuiltList. This happens in post processing rather
|
||||
//than type mapping as we only want this to apply to models, not every other class.
|
||||
if ("List".equals(property.baseType)) {
|
||||
property.setDatatype(property.dataType.replaceAll(property.baseType, "BuiltList"));
|
||||
property.setDatatype(
|
||||
property.dataType.replaceAll(property.baseType, "BuiltList"));
|
||||
property.setBaseType("BuiltList");
|
||||
model.imports.add("BuiltList");
|
||||
if ("Object".equals(property.items.baseType)) {
|
||||
property.setDatatype(
|
||||
property.dataType.replaceAll("Object", "JsonObject"));
|
||||
property.items.setDatatype("JsonObject");
|
||||
model.imports.add("JsonObject");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (property.isMapContainer) {
|
||||
@@ -242,6 +257,11 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
property.setDatatype(property.dataType.replaceAll(property.baseType, "BuiltMap"));
|
||||
property.setBaseType("BuiltMap");
|
||||
model.imports.add("BuiltMap");
|
||||
if ("Object".equals(property.items.baseType)) {
|
||||
property.setDatatype(property.dataType.replaceAll("Object", "JsonObject"));
|
||||
property.items.setDatatype("JsonObject");
|
||||
model.imports.add("JsonObject");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,13 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
elmImports.add(elmImport);
|
||||
}
|
||||
}
|
||||
if (cm.discriminator != null) {
|
||||
if (cm.oneOf != null) {
|
||||
for (String variant : cm.oneOf) {
|
||||
final ElmImport elmImport = createImport(variant);
|
||||
elmImports.add(elmImport);
|
||||
}
|
||||
}
|
||||
if (cm.discriminator != null && cm.children != null) {
|
||||
for (CodegenModel child : cm.children) {
|
||||
// add child imports
|
||||
final ElmImport elmImport = createImport(child.classname);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
protected boolean isGoSubmodule = false;
|
||||
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
|
||||
public static final String WITH_XML = "withXml";
|
||||
public static final String STRUCT_PREFIX = "structPrefix";
|
||||
|
||||
public GoClientCodegen() {
|
||||
super();
|
||||
@@ -56,6 +57,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs"));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC));
|
||||
cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts"));
|
||||
|
||||
// option to change the order of form/body parameter
|
||||
cliOptions.add(CliOption.newBoolean(
|
||||
@@ -127,6 +129,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(STRUCT_PREFIX)) {
|
||||
setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString()));
|
||||
if (structPrefix) {
|
||||
additionalProperties.put(STRUCT_PREFIX, "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,6 +165,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml"));
|
||||
supportingFiles.add(new SupportingFile("main.mustache", "", "main.go"));
|
||||
supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));
|
||||
supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod"));
|
||||
supportingFiles.add(new SupportingFile("routers.mustache", sourceFolder, "routers.go"));
|
||||
supportingFiles.add(new SupportingFile("logger.mustache", sourceFolder, "logger.go"));
|
||||
supportingFiles.add(new SupportingFile("api.mustache", sourceFolder, "api.go"));
|
||||
|
||||
@@ -380,6 +380,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||
supportingFiles.add(new SupportingFile("GsonObjectMapper.mustache", invokerFolder, "GsonObjectMapper.java"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("Oper.mustache", apiFolder, "Oper.java"));
|
||||
additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE));
|
||||
apiTemplateFiles.put("api.mustache", ".java");
|
||||
supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java"));
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.samskivert.mustache.Template;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
@@ -63,6 +64,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String SERVICE_IMPLEMENTATION = "serviceImplementation";
|
||||
public static final String REACTIVE = "reactive";
|
||||
public static final String INTERFACE_ONLY = "interfaceOnly";
|
||||
public static final String DELEGATE_PATTERN = "delegatePattern";
|
||||
|
||||
private String basePackage;
|
||||
private String invokerPackage;
|
||||
@@ -77,6 +79,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
private boolean serviceImplementation = false;
|
||||
private boolean reactive = false;
|
||||
private boolean interfaceOnly = false;
|
||||
private boolean delegatePattern = false;
|
||||
|
||||
public KotlinSpringServerCodegen() {
|
||||
super();
|
||||
@@ -125,6 +128,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation);
|
||||
addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive);
|
||||
addSwitch(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.", interfaceOnly);
|
||||
addSwitch(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern", delegatePattern);
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
setLibrary(SPRING_BOOT);
|
||||
|
||||
@@ -214,6 +218,10 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.interfaceOnly = interfaceOnly;
|
||||
}
|
||||
|
||||
public void setDelegatePattern(boolean delegatePattern) {
|
||||
this.delegatePattern = delegatePattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
@@ -331,15 +339,30 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.setInterfaceOnly(Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(DELEGATE_PATTERN)) {
|
||||
this.setDelegatePattern(Boolean.valueOf(additionalProperties.get(DELEGATE_PATTERN).toString()));
|
||||
if (!this.interfaceOnly) {
|
||||
this.setSwaggerAnnotations(true);
|
||||
}
|
||||
}
|
||||
|
||||
modelTemplateFiles.put("model.mustache", ".kt");
|
||||
|
||||
if (interfaceOnly) {
|
||||
if (!this.interfaceOnly && this.delegatePattern) {
|
||||
apiTemplateFiles.put("apiInterface.mustache", ".kt");
|
||||
apiTemplateFiles.put("apiController.mustache", "Controller.kt");
|
||||
} else if (interfaceOnly) {
|
||||
apiTemplateFiles.put("apiInterface.mustache", ".kt");
|
||||
} else {
|
||||
apiTemplateFiles.put("api.mustache", ".kt");
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".kt");
|
||||
}
|
||||
|
||||
if (SPRING_BOOT.equals(library)) {
|
||||
supportingFiles.add(new SupportingFile("apiUtil.mustache",
|
||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.kt"));
|
||||
}
|
||||
|
||||
if (this.serviceInterface) {
|
||||
apiTemplateFiles.put("service.mustache", "Service.kt");
|
||||
} else if (this.serviceImplementation) {
|
||||
@@ -349,6 +372,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
apiTemplateFiles.put("serviceImpl.mustache", "ServiceImpl.kt");
|
||||
}
|
||||
|
||||
if (this.delegatePattern) {
|
||||
additionalProperties.put("isDelegate", "true");
|
||||
apiTemplateFiles.put("apiDelegate.mustache", "Delegate.kt");
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
||||
|
||||
@@ -373,6 +401,12 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
|
||||
// spring uses the jackson lib, and we disallow configuration.
|
||||
additionalProperties.put("jackson", "true");
|
||||
|
||||
// add lambda for mustache templates
|
||||
additionalProperties.put("lambdaEscapeDoubleQuote",
|
||||
(Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("\\\""))));
|
||||
additionalProperties.put("lambdaRemoveLineBreak",
|
||||
(Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\\r|\\n", "")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -381,6 +415,31 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
.put("escapeDoubleQuote", new EscapeLambda("\"", "\\\""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||
if (library.equals(SPRING_BOOT) && this.delegatePattern) {
|
||||
String basePath = resourcePath;
|
||||
if (basePath.startsWith("/")) {
|
||||
basePath = basePath.substring(1);
|
||||
}
|
||||
int pos = basePath.indexOf("/");
|
||||
if (pos > 0) {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath.equals("")) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
List<CodegenOperation> opList = operations.computeIfAbsent(basePath, k -> new ArrayList<>());
|
||||
opList.add(co);
|
||||
co.baseName = basePath;
|
||||
} else {
|
||||
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
super.preprocessOpenAPI(openAPI);
|
||||
|
||||
@@ -19,8 +19,11 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -63,6 +66,8 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
||||
|
||||
additionalProperties.put("apiPackage", apiPackage);
|
||||
|
||||
// Explicitly defining bulid.properties helps guarantee our sample remains compilable against the embedded target 2.11 scala
|
||||
supportingFiles.add(new SupportingFile("build.properties.mustache", "", "project/build.properties"));
|
||||
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
|
||||
supportingFiles.add(new SupportingFile("dateTimeCodecs.mustache", (sourceFolder + File.separator + apiPackage).replace(".", File.separator), "DateTimeCodecs.scala"));
|
||||
supportingFiles.add(new SupportingFile("HelperCodecs.mustache", (sourceFolder + File.separator + apiPackage).replace(".", File.separator), "HelperCodecs.scala"));
|
||||
@@ -71,10 +76,16 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
||||
importMapping.remove("List");
|
||||
importMapping.remove("Set");
|
||||
importMapping.remove("Map");
|
||||
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
|
||||
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
|
||||
|
||||
// Overrides defaults applied in DefaultCodegen which don't apply cleanly to Scala.
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
importMapping.put("DateTime", "org.joda.time.DateTime");
|
||||
importMapping.put("LocalDateTime", "org.joda.time.LocalDateTime");
|
||||
importMapping.put("LocalDate", "org.joda.time.LocalDate");
|
||||
importMapping.put("LocalTime", "org.joda.time.LocalTime");
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("enum", "NSString");
|
||||
typeMapping.put("array", "List");
|
||||
@@ -179,6 +190,42 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema p) {
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
|
||||
// comment out the following as the default value is no handled differently
|
||||
if (ModelUtils.isBooleanSchema(p)) {
|
||||
return null;
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
return null;
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
return null;
|
||||
} else if (ModelUtils.isNumberSchema(p)) {
|
||||
return null;
|
||||
} else if (ModelUtils.isIntegerSchema(p)) {
|
||||
return null;
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
String inner = getSchemaType(ModelUtils.getAdditionalProperties(p));
|
||||
|
||||
return "Map.empty[String, " + inner + "] ";
|
||||
} else if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
String inner = getSchemaType(ap.getItems());
|
||||
String collectionType = typeMapping.get("array");
|
||||
|
||||
// We assume that users would map these collections to a monoid with an identity function
|
||||
// There's no reason to assume mutable structure here (which may make consumption more difficult)
|
||||
return collectionType + ".empty[" + inner + "] ";
|
||||
} else if (ModelUtils.isStringSchema(p)) {
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
|
||||
@@ -305,9 +305,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
|
||||
if (additionalProperties.containsKey(UNHANDLED_EXCEPTION_HANDLING)) {
|
||||
this.setUnhandledException(Boolean.valueOf(additionalProperties.get(UNHANDLED_EXCEPTION_HANDLING).toString()));
|
||||
} else {
|
||||
additionalProperties.put(UNHANDLED_EXCEPTION_HANDLING, this.isUnhandledException());
|
||||
}
|
||||
additionalProperties.put(UNHANDLED_EXCEPTION_HANDLING, this.isUnhandledException());
|
||||
|
||||
typeMapping.put("file", "Resource");
|
||||
importMapping.put("Resource", "org.springframework.core.io.Resource");
|
||||
|
||||
@@ -57,8 +57,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
|
||||
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
|
||||
protected static final String LIBRARY_RX_SWIFT = "RxSwift";
|
||||
protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT};
|
||||
protected static final String LIBRARY_RESULT = "Result";
|
||||
protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT, LIBRARY_RESULT};
|
||||
protected String projectName = "OpenAPIClient";
|
||||
protected boolean nonPublicApi = false;
|
||||
protected boolean unwrapRequired;
|
||||
protected boolean objcCompatible = false;
|
||||
protected boolean lenientTypeCast = false;
|
||||
@@ -208,6 +210,9 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
"Optionally use libraries to manage response. Currently "
|
||||
+ StringUtils.join(RESPONSE_LIBRARIES, ", ")
|
||||
+ " are available."));
|
||||
cliOptions.add(new CliOption(CodegenConstants.NON_PUBLIC_API,
|
||||
CodegenConstants.NON_PUBLIC_API_DESC
|
||||
+ "(default: false)"));
|
||||
cliOptions.add(new CliOption(UNWRAP_REQUIRED,
|
||||
"Treat 'required' properties in response as non-optional "
|
||||
+ "(which would crash the app if api returns null as opposed "
|
||||
@@ -329,6 +334,14 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
sourceFolder = projectName + File.separator + sourceFolder;
|
||||
|
||||
// Setup nonPublicApi option, which generates code with reduced access
|
||||
// modifiers; allows embedding elsewhere without exposing non-public API calls
|
||||
// to consumers
|
||||
if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) {
|
||||
setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API));
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.NON_PUBLIC_API, nonPublicApi);
|
||||
|
||||
// Setup unwrapRequired option, which makes all the
|
||||
// properties with "required" non-optional
|
||||
if (additionalProperties.containsKey(UNWRAP_REQUIRED)) {
|
||||
@@ -364,6 +377,9 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (ArrayUtils.contains(responseAs, LIBRARY_RX_SWIFT)) {
|
||||
additionalProperties.put("useRxSwift", true);
|
||||
}
|
||||
if (ArrayUtils.contains(responseAs, LIBRARY_RESULT)) {
|
||||
additionalProperties.put("useResult", true);
|
||||
}
|
||||
|
||||
// Setup swiftUseApiNamespace option, which makes all the API
|
||||
// classes inner-class of {{projectName}}API
|
||||
@@ -417,6 +433,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("JSONEncodingHelper.mustache",
|
||||
sourceFolder,
|
||||
"JSONEncodingHelper.swift"));
|
||||
if (ArrayUtils.contains(responseAs, LIBRARY_RESULT)) {
|
||||
supportingFiles.add(new SupportingFile("Result.mustache",
|
||||
sourceFolder,
|
||||
"Result.swift"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache",
|
||||
"",
|
||||
"git_push.sh"));
|
||||
@@ -555,7 +576,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
public String toDefaultValue(Schema p) {
|
||||
if (p.getEnum() != null && !p.getEnum().isEmpty()) {
|
||||
if (p.getDefault() != null) {
|
||||
return "." + escapeText((String) p.getDefault());
|
||||
if (ModelUtils.isStringSchema(p)) {
|
||||
return "." + toEnumVarName(escapeText((String) p.getDefault()), p.getType());
|
||||
} else {
|
||||
return "." + toEnumVarName(escapeText(p.getDefault().toString()), p.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) {
|
||||
@@ -714,6 +739,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setNonPublicApi(boolean nonPublicApi) {
|
||||
this.nonPublicApi = nonPublicApi;
|
||||
}
|
||||
|
||||
public void setUnwrapRequired(boolean unwrapRequired) {
|
||||
this.unwrapRequired = unwrapRequired;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
* Copyright 2018 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class TypeScriptReduxQueryClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||
|
||||
public static final String NPM_REPOSITORY = "npmRepository";
|
||||
public static final String WITH_INTERFACES = "withInterfaces";
|
||||
public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter";
|
||||
|
||||
protected String npmRepository = null;
|
||||
private boolean useSingleRequestParameter = true;
|
||||
protected boolean addedApiIndex = false;
|
||||
protected boolean addedModelIndex = false;
|
||||
|
||||
|
||||
public TypeScriptReduxQueryClientCodegen() {
|
||||
super();
|
||||
|
||||
// clear import mapping (from default generator) as TS does not use it
|
||||
// at the moment
|
||||
importMapping.clear();
|
||||
|
||||
supportsMultipleInheritance = true;
|
||||
|
||||
outputFolder = "generated-code/typescript-redux-query";
|
||||
embeddedTemplateDir = templateDir = "typescript-redux-query";
|
||||
|
||||
this.apiPackage = "src" + File.separator +"apis";
|
||||
this.modelPackage = "src" + File.separator + "models";
|
||||
this.apiTemplateFiles.put("apis.mustache", ".ts");
|
||||
this.modelTemplateFiles.put("models.mustache", ".ts");
|
||||
this.addExtraReservedWords();
|
||||
|
||||
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "typescript-redux-query";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a TypeScript client library using redux-query API (beta).";
|
||||
}
|
||||
|
||||
public String getNpmRepository() {
|
||||
return npmRepository;
|
||||
}
|
||||
|
||||
public void setNpmRepository(String npmRepository) {
|
||||
this.npmRepository = npmRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
additionalProperties.put("isOriginalModelPropertyNaming", getModelPropertyNaming().equals("original"));
|
||||
additionalProperties.put("modelPropertyNaming", getModelPropertyNaming());
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "src", "index.ts"));
|
||||
supportingFiles.add(new SupportingFile("runtime.mustache", "src", "runtime.ts"));
|
||||
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
|
||||
if (additionalProperties.containsKey(USE_SINGLE_REQUEST_PARAMETER)) {
|
||||
this.setUseSingleRequestParameter(convertPropertyToBoolean(USE_SINGLE_REQUEST_PARAMETER));
|
||||
}
|
||||
writePropertyBack(USE_SINGLE_REQUEST_PARAMETER, getUseSingleRequestParameter());
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
addNpmPackageGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
Schema inner;
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
inner = ((ArraySchema) p).getItems();
|
||||
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(inner) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
inner = ModelUtils.getAdditionalProperties(p);
|
||||
return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }";
|
||||
} else if (ModelUtils.isFileSchema(p)) {
|
||||
return "Blob";
|
||||
} else if (ModelUtils.isBinarySchema(p)) {
|
||||
return "Blob";
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
return "Date";
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
return "Date";
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
codegenModel.additionalPropertiesType = getTypeDeclaration(ModelUtils.getAdditionalProperties(schema));
|
||||
addImport(codegenModel, codegenModel.additionalPropertiesType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
List<Object> models = (List<Object>) postProcessModelsEnum(objs).get("models");
|
||||
|
||||
// process enum in models
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
cm.imports = new TreeSet(cm.imports);
|
||||
// name enum with model name, e.g. StatusEnum => Pet.StatusEnum
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
// behaviour for enum names is specific for Typescript Fetch, not using namespaces
|
||||
var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
if (cm.parent != null) {
|
||||
for (CodegenProperty var : cm.allVars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum
|
||||
.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cm.oneOf.isEmpty()) {
|
||||
// For oneOfs only import $refs within the oneOf
|
||||
TreeSet<String> oneOfRefs = new TreeSet<>();
|
||||
for (String im : cm.imports) {
|
||||
if (cm.oneOf.contains(im)) {
|
||||
oneOfRefs.add(im);
|
||||
}
|
||||
}
|
||||
cm.imports = oneOfRefs;
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
Map<String, Object> result = super.postProcessAllModels(objs);
|
||||
for (Map.Entry<String, Object> entry : result.entrySet()) {
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||
for (Map<String, Object> model : models) {
|
||||
CodegenModel codegenModel = (CodegenModel) model.get("model");
|
||||
model.put("hasImports", codegenModel.imports.size() > 0);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addNpmPackageGeneration() {
|
||||
|
||||
if (additionalProperties.containsKey(NPM_REPOSITORY)) {
|
||||
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
|
||||
}
|
||||
|
||||
//Files for building our lib
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
||||
supportingFiles.add(new SupportingFile("npmignore.mustache", "", ".npmignore"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> operations, List<Object> allModels) {
|
||||
// Add supporting file only if we plan to generate files in /apis
|
||||
if (operations.size() > 0 && !addedApiIndex) {
|
||||
addedApiIndex = true;
|
||||
supportingFiles.add(new SupportingFile("apis.index.mustache", apiPackage().replace('.', File.separatorChar), "index.ts"));
|
||||
}
|
||||
|
||||
// Add supporting file only if we plan to generate files in /models
|
||||
if (allModels.size() > 0 && !addedModelIndex) {
|
||||
addedModelIndex = true;
|
||||
supportingFiles.add(new SupportingFile("models.index.mustache", modelPackage().replace('.', File.separatorChar), "index.ts"));
|
||||
}
|
||||
|
||||
this.addOperationModelImportInformation(operations);
|
||||
this.updateOperationParameterEnumInformation(operations);
|
||||
this.addOperationObjectResponseInformation(operations);
|
||||
return operations;
|
||||
}
|
||||
|
||||
private void addOperationModelImportInformation(Map<String, Object> operations) {
|
||||
// This method will add extra information to the operations.imports array.
|
||||
// The api template uses this information to import all the required
|
||||
// models for a given operation.
|
||||
List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
|
||||
for (Map<String, Object> im : imports) {
|
||||
String[] parts = im.get("import").toString().replace(modelPackage() + ".", "").split("( [|&] )|[<>]");
|
||||
for (String s : parts) {
|
||||
if (needToImport(s)) {
|
||||
im.put("filename", im.get("import"));
|
||||
im.put("className", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOperationParameterEnumInformation(Map<String, Object> operations) {
|
||||
// This method will add extra information as to whether or not we have enums and
|
||||
// update their names with the operation.id prefixed.
|
||||
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
|
||||
boolean hasEnum = false;
|
||||
for (CodegenOperation op : operationList) {
|
||||
for (CodegenParameter param : op.allParams) {
|
||||
if (Boolean.TRUE.equals(param.isEnum)) {
|
||||
hasEnum = true;
|
||||
param.datatypeWithEnum = param.datatypeWithEnum
|
||||
.replace(param.enumName, op.operationIdCamelCase + param.enumName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
operations.put("hasEnums", hasEnum);
|
||||
}
|
||||
|
||||
private void addOperationObjectResponseInformation(Map<String, Object> operations) {
|
||||
// This method will modify the information on the operations' return type.
|
||||
// The api template uses this information to know when to return a text
|
||||
// response for a given simple response operation.
|
||||
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
if(op.returnType == "object") {
|
||||
op.isMapContainer = true;
|
||||
op.returnSimpleType = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addExtraReservedWords() {
|
||||
this.reservedWords.add("BASE_PATH");
|
||||
this.reservedWords.add("BaseAPI");
|
||||
this.reservedWords.add("RequiredError");
|
||||
this.reservedWords.add("COLLECTION_FORMATS");
|
||||
// this.reservedWords.add("FetchAPI");
|
||||
this.reservedWords.add("ConfigurationParameters");
|
||||
this.reservedWords.add("Configuration");
|
||||
this.reservedWords.add("configuration");
|
||||
this.reservedWords.add("HTTPMethod");
|
||||
this.reservedWords.add("HTTPHeaders");
|
||||
this.reservedWords.add("HTTPQuery");
|
||||
this.reservedWords.add("HTTPBody");
|
||||
this.reservedWords.add("ModelPropertyNaming");
|
||||
// this.reservedWords.add("FetchParams");
|
||||
this.reservedWords.add("RequestOpts");
|
||||
this.reservedWords.add("exists");
|
||||
this.reservedWords.add("RequestContext");
|
||||
this.reservedWords.add("ResponseContext");
|
||||
this.reservedWords.add("Middleware");
|
||||
this.reservedWords.add("ApiResponse");
|
||||
this.reservedWords.add("ResponseTransformer");
|
||||
this.reservedWords.add("JSONApiResponse");
|
||||
this.reservedWords.add("VoidApiResponse");
|
||||
this.reservedWords.add("BlobApiResponse");
|
||||
this.reservedWords.add("TextApiResponse");
|
||||
}
|
||||
|
||||
private boolean getUseSingleRequestParameter() {
|
||||
return useSingleRequestParameter;
|
||||
}
|
||||
|
||||
private void setUseSingleRequestParameter(boolean useSingleRequestParameter) {
|
||||
this.useSingleRequestParameter = useSingleRequestParameter;
|
||||
}
|
||||
}
|
||||
@@ -189,15 +189,15 @@ return 0;
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
) {
|
||||
{{classname}}_t *{{classname}}_local_var = malloc(sizeof({{classname}}_t));
|
||||
{{classname}}_t *{{classname}}_local_var = malloc(sizeof({{classname}}_t));
|
||||
if (!{{classname}}_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
{{#vars}}
|
||||
{{classname}}_local_var->{{{baseName}}} = {{{baseName}}};
|
||||
{{/vars}}
|
||||
{{#vars}}
|
||||
{{classname}}_local_var->{{{baseName}}} = {{{baseName}}};
|
||||
{{/vars}}
|
||||
|
||||
return {{classname}}_local_var;
|
||||
return {{classname}}_local_var;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,36 +241,36 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
|
||||
{{#isContainer}}
|
||||
{{#isListContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
free(listEntry->data);
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
free(listEntry->data);
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
{{complexType}}_free(listEntry->data);
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
{{complexType}}_free(listEntry->data);
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
{{/isPrimitiveType}}
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
keyValuePair_t *localMapKeyPair = (keyValuePair_t*) listEntry->data;
|
||||
list_ForEach(listEntry, {{classname}}->{{baseName}}) {
|
||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
||||
free (localKeyValue->key);
|
||||
free (localKeyValue->value);
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
}
|
||||
list_free({{classname}}->{{baseName}});
|
||||
{{/isMapContainer}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
free({{classname}});
|
||||
free({{classname}});
|
||||
}
|
||||
|
||||
cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
{{#vars}}
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
{{#vars}}
|
||||
|
||||
// {{{classname}}}->{{{baseName}}}
|
||||
// {{{classname}}}->{{{baseName}}}
|
||||
{{#required}}
|
||||
{{^isEnum}}
|
||||
if (!{{{classname}}}->{{{baseName}}}) {
|
||||
@@ -279,8 +279,8 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
{{/isEnum}}
|
||||
{{/required}}
|
||||
{{^required}}{{^isEnum}}if({{{classname}}}->{{{baseName}}}) { {{/isEnum}}{{/required}}
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
if(cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{baseName}}}) == NULL) {
|
||||
goto fail; //Numeric
|
||||
@@ -328,8 +328,8 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
goto fail; //Date-Time
|
||||
}
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isModel}}
|
||||
{{#isEnum}}
|
||||
cJSON *{{{baseName}}}_enum_local_JSON = {{datatypeWithEnum}}_convertToJSON({{{classname}}}->{{{baseName}}});
|
||||
@@ -372,17 +372,17 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
goto fail;
|
||||
}
|
||||
{{/isFreeFormObject}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#isListContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}");
|
||||
if({{{name}}} == NULL) {
|
||||
goto fail; //primitive container
|
||||
}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#isListContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}");
|
||||
if({{{name}}} == NULL) {
|
||||
goto fail; //primitive container
|
||||
}
|
||||
|
||||
listEntry_t *{{{name}}}ListEntry;
|
||||
listEntry_t *{{{name}}}ListEntry;
|
||||
list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{baseName}}}) {
|
||||
{{#items}}
|
||||
{{#isString}}
|
||||
@@ -399,8 +399,8 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
{{/isString}}
|
||||
{{/items}}
|
||||
}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
cJSON *{{{baseName}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}");
|
||||
if({{{baseName}}} == NULL) {
|
||||
goto fail; //nonprimitive container
|
||||
@@ -416,15 +416,15 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
cJSON_AddItemToArray({{{baseName}}}, itemLocal);
|
||||
}
|
||||
}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
cJSON *{{{baseName}}} = cJSON_AddObjectToObject(item, "{{{baseName}}}");
|
||||
if({{{baseName}}} == NULL) {
|
||||
goto fail; //primitive map container
|
||||
}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
cJSON *{{{baseName}}} = cJSON_AddObjectToObject(item, "{{{baseName}}}");
|
||||
if({{{baseName}}} == NULL) {
|
||||
goto fail; //primitive map container
|
||||
}
|
||||
cJSON *localMapObject = cJSON_CreateObject(); //Memory free to be implemented in user code
|
||||
listEntry_t *{{{baseName}}}ListEntry;
|
||||
listEntry_t *{{{baseName}}}ListEntry;
|
||||
if ({{{classname}}}->{{{baseName}}}) {
|
||||
list_ForEach({{{baseName}}}ListEntry, {{{classname}}}->{{{baseName}}}) {
|
||||
keyValuePair_t *localKeyValue = (keyValuePair_t*){{{baseName}}}ListEntry->data;
|
||||
@@ -445,19 +445,19 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
cJSON_AddItemToObject({{{baseName}}},"", localMapObject);
|
||||
}
|
||||
}
|
||||
{{/isMapContainer}}
|
||||
{{/isContainer}}
|
||||
{{^required}}
|
||||
{{/isMapContainer}}
|
||||
{{/isContainer}}
|
||||
{{^required}}
|
||||
{{^isEnum}} } {{/isEnum}}
|
||||
{{/required}}
|
||||
{{/required}}
|
||||
|
||||
{{/vars}}
|
||||
return item;
|
||||
return item;
|
||||
fail:
|
||||
if (item) {
|
||||
if (item) {
|
||||
cJSON_Delete(item);
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{{classname}}_t *{{classname}}_parseFromJSON(cJSON *{{classname}}JSON){
|
||||
@@ -526,8 +526,8 @@ fail:
|
||||
char* decoded = base64decode({{{baseName}}}->valuestring, strlen({{{baseName}}}->valuestring));
|
||||
decoded_str_{{{baseName}}}->data = malloc(strlen(decoded) - 1);
|
||||
if (!decoded_str_{{{baseName}}}->data) {
|
||||
goto end;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
memcpy(decoded_str_{{{baseName}}}->data,decoded,(strlen(decoded)-1));
|
||||
decoded_str_{{{baseName}}}->len = strlen(decoded) - 1;
|
||||
{{/isBinary}}
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m"'
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -109,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
@@ -138,19 +154,19 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -159,14 +175,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,100 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
13
modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/Oper.mustache
vendored
Normal file
13
modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/Oper.mustache
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{apiPackage}};
|
||||
|
||||
import io.restassured.response.Response;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface Oper {
|
||||
|
||||
<T> T execute(Function<Response, T> handler);
|
||||
|
||||
}
|
||||
@@ -56,6 +56,15 @@ public class {{classname}} {
|
||||
return reqSpec;
|
||||
}
|
||||
|
||||
public List<Oper> getAllOperations() {
|
||||
return Arrays.asList(
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{operationId}}(){{^-last}},{{/-last}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
);
|
||||
}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
@@ -107,7 +116,7 @@ public class {{classname}} {
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public static class {{operationIdCamelCase}}Oper {
|
||||
public static class {{operationIdCamelCase}}Oper implements Oper {
|
||||
|
||||
public static final Method REQ_METHOD = {{httpMethod}};
|
||||
public static final String REQ_URI = "{{path}}";
|
||||
@@ -134,6 +143,7 @@ public class {{classname}} {
|
||||
* @param <T> type
|
||||
* @return type
|
||||
*/
|
||||
@Override
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class {{classname}} {
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
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}}
|
||||
{{/hasMore}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
|
||||
@@ -130,7 +130,7 @@ public class {{classname}} {
|
||||
{{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}}
|
||||
|
||||
{{#formParams}}if ({{paramName}} != null)
|
||||
formParams.add("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
|
||||
formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
|
||||
{{/hasMore}}{{/formParams}}{{/hasFormParams}}
|
||||
|
||||
final String[] accepts = { {{#hasProduces}}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class {{classname}} {
|
||||
{{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}}
|
||||
|
||||
{{#formParams}}if ({{paramName}} != null)
|
||||
formParams.add("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
|
||||
formParams.add{{#collectionFormat}}All{{/collectionFormat}}("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
|
||||
{{/hasMore}}{{/formParams}}{{/hasFormParams}}
|
||||
|
||||
final String[] accepts = { {{#hasProduces}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Before building the docker image run:
|
||||
#
|
||||
# mvn package -Pnative -Dnative-image.docker-build=true
|
||||
# mvn package -Pnative -Dquarkus.native.container-build=true
|
||||
#
|
||||
# Then, build the image with:
|
||||
#
|
||||
|
||||
@@ -7,21 +7,24 @@
|
||||
<name>{{artifactId}}</name>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<properties>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<surefire-plugin.version>2.22.0</surefire-plugin.version>
|
||||
<maven.compiler.parameters>true</maven.compiler.parameters>
|
||||
<quarkus.version>0.27.0</quarkus.version>
|
||||
<compiler-plugin.version>3.8.1</compiler-plugin.version>
|
||||
<maven.compiler.parameters>true</maven.compiler.parameters>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<quarkus-plugin.version>1.0.0.Final</quarkus-plugin.version>
|
||||
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
|
||||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
|
||||
<quarkus.platform.version>1.0.0.Final</quarkus.platform.version>
|
||||
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-bom</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<groupId>${quarkus.platform.group-id}</groupId>
|
||||
<artifactId>${quarkus.platform.artifact-id}</artifactId>
|
||||
<version>${quarkus.platform.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -71,7 +74,7 @@
|
||||
<plugin>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-maven-plugin</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<version>${quarkus-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
||||
@@ -117,6 +117,7 @@ org.openapitools.codegen.languages.TypeScriptFetchClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptInversifyClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptJqueryClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
|
||||
org.openapitools.codegen.languages.FsharpGiraffeServerCodegen
|
||||
org.openapitools.codegen.languages.AsciidocDocumentationCodegen
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:keywords: openapi, rest, {{appName}}
|
||||
:specDir: {{specDir}}
|
||||
:snippetDir: {{snippetDir}}
|
||||
:generator-template: v1 2019-11-10
|
||||
:generator-template: v1 2019-11-19
|
||||
:info-url: {{infoUrl}}
|
||||
:app-name: {{appName}}
|
||||
|
||||
@@ -18,6 +18,20 @@
|
||||
|
||||
{{#specinclude}}intro.adoc{{/specinclude}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
== Access
|
||||
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
{{^isBasicBearer}}* *HTTP Basic* Authentication _{{{name}}}_{{/isBasicBearer}}
|
||||
{{#isBasicBearer}}* *Bearer* Authentication {{/isBasicBearer}}
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}* *OAuth* AuthorizationUrl: _{{authorizationUrl}}_, TokenUrl: _{{tokenUrl}}_ {{/isOAuth}}
|
||||
{{#isApiKey}}* *APIKey* KeyParamName: _{{keyParamName}}_, KeyInQuery: _{{isKeyInQuery}}_, KeyInHeader: _{{isKeyInHeader}}_{{/isApiKey}}
|
||||
{{/authMethods}}
|
||||
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
== Endpoints
|
||||
|
||||
{{#apiInfo}}
|
||||
|
||||
@@ -26,6 +26,19 @@
|
||||
|===
|
||||
{{/hasBodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
===== Form Parameter
|
||||
|
||||
[cols="2,3,1,1,1"]
|
||||
|===
|
||||
|Name| Description| Required| Default| Pattern
|
||||
|
||||
{{#formParams}}
|
||||
{{>param}}
|
||||
{{/formParams}}
|
||||
|===
|
||||
{{/hasFormParams}}
|
||||
|
||||
{{#hasHeaderParams}}
|
||||
====== Header Parameters
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ struct {{classname}}
|
||||
{{^required}}Pistache::Optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{baseName}};
|
||||
{{/vars}}
|
||||
|
||||
bool operator==(const {{classname}}& other) const;
|
||||
bool operator!=(const {{classname}}& other) const;
|
||||
|
||||
nlohmann::json to_json() const;
|
||||
static {{classname}} from_json(const nlohmann::json& j);
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user