forked from loafle/openapi-generator-original
Latest from master - merge conflict resolution
This commit is contained in:
commit
a774ff9587
@ -1,3 +1,4 @@
|
||||
.git/
|
||||
*.iml
|
||||
out/
|
||||
*.ipr
|
||||
@ -13,35 +14,13 @@ generated-sources/*
|
||||
generated-code/*
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
/target
|
||||
/generated-files
|
||||
/nbactions.xml
|
||||
*.pyc
|
||||
__pycache__
|
||||
samples/server-generator/scalatra/output
|
||||
samples/server-generator/node/output/node_modules
|
||||
samples/server-generator/scalatra/target
|
||||
samples/server-generator/scalatra/output/.history
|
||||
samples/client/petstore/qt5cpp/PetStore/moc_*
|
||||
samples/client/petstore/qt5cpp/PetStore/*.o
|
||||
samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata
|
||||
samples/client/petstore/qt5cpp/build-*
|
||||
samples/client/petstore/qt5cpp/PetStore/PetStore
|
||||
samples/client/petstore/qt5cpp/PetStore/Makefile
|
||||
samples/client/petstore/java/hello.txt
|
||||
samples/client/petstore/android/default/hello.txt
|
||||
samples/client/petstore/objc/Build
|
||||
samples/client/petstore/objc/Pods
|
||||
samples/server/petstore/nodejs/node_modules
|
||||
target
|
||||
.idea
|
||||
.lib
|
||||
atlassian-ide-plugin.xml
|
||||
*.bak
|
||||
project/
|
||||
samples/*
|
||||
target/
|
||||
.idea/
|
||||
.lib/
|
||||
.DS_Store
|
||||
|
||||
samples/client/petstore/php/SwaggerClient-php/composer.lock
|
||||
samples/client/petstore/php/SwaggerClient-php/vendor/
|
||||
|
||||
samples/client/petstore/silex/SwaggerServer/composer.lock
|
||||
samples/client/petstore/silex/SwaggerServer/venodr/
|
||||
# Not needed in a linux container
|
||||
bin/windows/*
|
||||
|
22
.github/ISSUE_TEMPLATE.md
vendored
22
.github/ISSUE_TEMPLATE.md
vendored
@ -14,17 +14,17 @@ Also please indicate in the issue title which language/library is concerned. Eg:
|
||||
##### Swagger declaration file content or url
|
||||
|
||||
<!-- if it is a bug, a json or yaml that produces it.
|
||||
If you post the code inline, please wrap it with
|
||||
```yaml
|
||||
(here your code)
|
||||
```
|
||||
(for YAML code) or
|
||||
```json
|
||||
(here your code)
|
||||
```
|
||||
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
|
||||
please create a Gist (https://gist.github.com) or upload it somewhere else and
|
||||
link it here.
|
||||
If you post the code inline, please wrap it with
|
||||
```yaml
|
||||
(here your code)
|
||||
```
|
||||
(for YAML code) or
|
||||
```json
|
||||
(here your code)
|
||||
```
|
||||
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
|
||||
please create a Gist (https://gist.github.com) or upload it somewhere else and
|
||||
link it here.
|
||||
-->
|
||||
|
||||
##### Command line used for generation
|
||||
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,6 +1,6 @@
|
||||
### PR checklist
|
||||
|
||||
- [ ] Read the [contribution guildelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md).
|
||||
- [ ] Read the [contribution guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md).
|
||||
- [ ] Ran the shell/batch script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
|
||||
- [ ] Filed the PR against the correct branch: master for non-breaking changes and `2.3.0` branch for breaking (non-backward compatible) changes.
|
||||
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -143,6 +143,8 @@ samples/client/petstore/typescript-node/**/typings
|
||||
samples/client/petstore/typescript-angular/**/typings
|
||||
samples/client/petstore/typescript-fetch/**/dist/
|
||||
samples/client/petstore/typescript-fetch/**/typings
|
||||
samples/client/petstore/typescript-angular2/npm/npm-debug.log
|
||||
samples/client/petstore/typescript-node/npm/npm-debug.log
|
||||
|
||||
# aspnetcore
|
||||
samples/server/petstore/aspnetcore/.vs/
|
||||
|
@ -31,7 +31,8 @@ before_install:
|
||||
- gem install xcpretty -N --no-ri --no-rdoc
|
||||
- pod --version
|
||||
- pod setup --silent > /dev/null
|
||||
- brew install xctool
|
||||
# xctool already pre-installed
|
||||
#- brew install xctool
|
||||
- git clone https://github.com/wing328/swagger-samples
|
||||
- cd swagger-samples/java/java-jersey-jaxrs && sudo mvn -q jetty:run &
|
||||
|
||||
@ -47,6 +48,10 @@ script:
|
||||
- cd $SW/samples/client/petstore/swift/promisekit/SwaggerClientTests && pod install && xcodebuild clean test -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty
|
||||
# test default swift client
|
||||
- cd $SW/samples/client/petstore/swift/default/SwaggerClientTests && pod install && xcodebuild clean test -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty
|
||||
# test swift3 client with promisekit
|
||||
- cd $SW/samples/client/petstore/swift3/promisekit/SwaggerClientTests && pod install && xcodebuild clean test -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty
|
||||
# test default swift3 client
|
||||
- cd $SW/samples/client/petstore/swift3/default/SwaggerClientTests && pod install && xcodebuild clean test -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty
|
||||
|
||||
env:
|
||||
- DOCKER_IMAGE_NAME=swaggerapi/swagger-generator
|
||||
|
42
.travis.yml
42
.travis.yml
@ -7,6 +7,24 @@ jdk:
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
- $HOME/.ivy2
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
- $HOME/samples/client/petstore/php/SwaggerClient-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-angular/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-angular/typings
|
||||
|
||||
services:
|
||||
- docker
|
||||
@ -24,8 +42,16 @@ before_install:
|
||||
- docker pull swaggerapi/petstore
|
||||
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- docker ps -a
|
||||
# Add bats test framework and cURL for Bash script integration tests
|
||||
- sudo add-apt-repository ppa:duggan/bats --yes
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq bats
|
||||
- sudo apt-get install -qq curl
|
||||
|
||||
# show host table to confirm petstore.swagger.io is mapped to localhost
|
||||
- cat /etc/hosts
|
||||
# show java version
|
||||
- java -version
|
||||
|
||||
install:
|
||||
# Add Godeps dependencies to GOPATH and PATH
|
||||
@ -34,8 +60,18 @@ install:
|
||||
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"
|
||||
|
||||
script:
|
||||
- mvn verify -Psamples
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_IMAGE_NAME:$TRAVIS_TAG; fi && docker push $DOCKER_IMAGE_NAME; fi
|
||||
# fail fast
|
||||
- set -e
|
||||
# fail if templates/generators contain carriage return '\r'
|
||||
- /bin/bash ./bin/utils/detect_carriage_return.sh
|
||||
# fail if generators contain tab '\t'
|
||||
- /bin/bash ./bin/utils/detect_tab_in_java_class.sh
|
||||
# run integration tests defined in maven pom.xml
|
||||
- mvn --batch-mode verify -Psamples
|
||||
# docker: build generator image and push to Docker Hub
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
|
||||
# docker: build cli image and push to Docker Hub
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
|
||||
|
||||
env:
|
||||
- DOCKER_IMAGE_NAME=swaggerapi/swagger-generator
|
||||
- DOCKER_GENERATOR_IMAGE_NAME=swaggerapi/swagger-generator DOCKER_CODEGEN_CLI_IMAGE_NAME=swaggerapi/swagger-codegen-cli
|
||||
|
@ -16,6 +16,12 @@
|
||||
|
||||
## How to contribute
|
||||
|
||||
### git
|
||||
|
||||
If you're new to git, you may find the following FAQs useful:
|
||||
|
||||
https://github.com/swagger-api/swagger-codegen/wiki/FAQ#git
|
||||
|
||||
### Code generators
|
||||
|
||||
All the code generators can be found in [modules/swagger-codegen/src/main/java/io/swagger/codegen/languages](https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages)
|
||||
@ -30,11 +36,15 @@ For a list of variables available in the template, please refer to this [page](h
|
||||
### Style guide
|
||||
Code change should conform to the programming style guide of the respective languages:
|
||||
- Android: https://source.android.com/source/code-style.html
|
||||
- Bash: https://github.com/bahamas10/bash-style-guide
|
||||
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
|
||||
- C++: https://google.github.io/styleguide/cppguide.html
|
||||
- Clojure: https://github.com/bbatsov/clojure-style-guide
|
||||
- Elixir: https://github.com/christopheradams/elixir_style_guide
|
||||
- Erlang: https://github.com/inaka/erlang_guidelines
|
||||
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
|
||||
- Java: https://google.github.io/styleguide/javaguide.html
|
||||
- JavaScript: https://github.com/airbnb/javascript/tree/master/es5
|
||||
- JavaScript: https://github.com/airbnb/javascript/
|
||||
- Groovy: http://groovy-lang.org/style-guide.html
|
||||
- Go: https://github.com/golang/go/wiki/CodeReviewComments
|
||||
- ObjC: https://github.com/NYTimes/objective-c-style-guide
|
||||
@ -74,3 +84,5 @@ To start the CI tests, you can run `mvn verify -Psamples` (assuming you've all t
|
||||
- Document the fix in the code to make the code more readable
|
||||
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
|
||||
- File a PR with meaningful title, description and commit messages. A good example is [PR-3306](https://github.com/swagger-api/swagger-codegen/pull/3306)
|
||||
- Recommended git settings
|
||||
- `git config --global core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
|
||||
|
25
Dockerfile
25
Dockerfile
@ -1,13 +1,22 @@
|
||||
FROM maven:3.3-jdk-7
|
||||
FROM jimschubert/8-jdk-alpine-mvn:1.0
|
||||
|
||||
WORKDIR /src
|
||||
VOLUME /src
|
||||
VOLUME /root/.m2/repository
|
||||
ENV GEN_DIR /opt/swagger-codegen
|
||||
|
||||
ADD . /opt/swagger-codegen
|
||||
RUN set -x && \
|
||||
apk add --no-cache bash
|
||||
|
||||
RUN cd /opt/swagger-codegen && mvn package
|
||||
RUN mkdir /opt
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "/opt/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"]
|
||||
ADD . ${GEN_DIR}
|
||||
|
||||
CMD ["help"]
|
||||
VOLUME ${MAVEN_HOME}/.m2/repository
|
||||
|
||||
WORKDIR ${GEN_DIR}
|
||||
|
||||
RUN mvn -am -pl "modules/swagger-codegen-cli" package
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["build"]
|
||||
|
327
README.md
327
README.md
@ -1,6 +1,6 @@
|
||||
# Swagger Code Generator
|
||||
|
||||
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||
[](https://app.shippable.com/projects/5782588a3be4f4faa56c5bea)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/swagger-codegen-wh2wu)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/io.swagger/swagger-codegen-project)
|
||||
@ -12,10 +12,17 @@
|
||||
|
||||
:warning: If the OpenAPI/Swagger spec is obtained from an untrusted source, please make sure you've reviewed the spec before using Swagger Codegen to generate the API client, server stub or documentation as [code injection](https://en.wikipedia.org/wiki/Code_injection) may occur :warning:
|
||||
|
||||
## Overview
|
||||
This is the swagger codegen project, which allows generation of API client libraries, server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification).
|
||||
:rocket: ProductHunt: https://producthunt.com/posts/swagger-codegen :rocket:
|
||||
|
||||
Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
## Overview
|
||||
This is the swagger codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). Currently, the following languages/frameworks are supported:
|
||||
|
||||
- **API clients**: **ActionScript**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, jQuery, Node)
|
||||
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** ([Finch](https://github.com/finagle/finch), Scalatra)
|
||||
- **API documentation generators**: **HTML**, **Confluence Wiki**
|
||||
- **Others**: **JMeter**
|
||||
|
||||
Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the OpenAPI project.
|
||||
|
||||
# Table of contents
|
||||
|
||||
@ -61,19 +68,20 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
|
||||
-------------------------- | ------------ | -------------------------- | -----
|
||||
2.3.0 (upcoming minor release) | TBD | 1.0, 1.1, 1.2, 2.0 | Minor release with breaking changes
|
||||
2.2.2 (upcoming patch release) | TBD | 1.0, 1.1, 1.2, 2.0 | Patch release (without breaking changes)
|
||||
2.2.1 (**current stable**) | 2016-08-07 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-codegen/tree/v2.2.1)
|
||||
2.1.6 | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
|
||||
2.3.0 (upcoming minor release) | Apr/May 2017 | 1.0, 1.1, 1.2, 2.0 | Minor release with breaking changes
|
||||
2.2.3 (upcoming patch release) | TBD | 1.0, 1.1, 1.2, 2.0 | Patch release without breaking changes
|
||||
[2.2.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.2) (**current stable**) | 2017-03-01 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.2)
|
||||
[2.2.1](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.1) | 2016-08-07 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-codegen/tree/v2.2.1)
|
||||
[2.1.6](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.1.6) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
|
||||
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
||||
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
|
||||
|
||||
|
||||
### Prerequisites
|
||||
If you're looking for the latest stable version, you can grab it directly from maven central (you'll need java 7 runtime at a minimum):
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 7 runtime at a minimum):
|
||||
|
||||
```
|
||||
wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar -O swagger-codegen-cli.jar
|
||||
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.2/swagger-codegen-cli-2.2.2.jar -O swagger-codegen-cli.jar
|
||||
|
||||
java -jar swagger-codegen-cli.jar help
|
||||
```
|
||||
@ -105,16 +113,41 @@ After cloning the project, you can build it from source with this command:
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
### Homebrew
|
||||
|
||||
To install, run `brew install swagger-codegen`
|
||||
|
||||
Here is an example usage:
|
||||
```
|
||||
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/
|
||||
```
|
||||
|
||||
### Docker
|
||||
#### Build and run using docker
|
||||
|
||||
#### Development in docker
|
||||
|
||||
You can use `run-in-docker.sh` to do all development. This script maps your local repository to `/gen`
|
||||
in the docker container. It also maps `~/.m2/repository` to the appropriate container location.
|
||||
|
||||
To execute `mvn package`:
|
||||
|
||||
```
|
||||
git clone https://github.com/swagger-api/swagger-codegen
|
||||
cd swagger-codegen
|
||||
./run-in-docker.sh mvn package
|
||||
```
|
||||
```
|
||||
|
||||
Build artifacts are now accessible in your working directory.
|
||||
|
||||
Once built, `run-in-docker.sh` will act as an executable for swagger-codegen-cli. To generate code, you'll need to output to a directory under `/gen` (e.g. `/gen/out`). For example:
|
||||
|
||||
```
|
||||
./run-in-docker.sh help # Executes 'help' command for swagger-codegen-cli
|
||||
./run-in-docker.sh langs # Executes 'langs' command for swagger-codegen-cli
|
||||
./run-in-docker.sh /gen/bin/go-petstore.sh # Builds the Go client
|
||||
./run-in-docker.sh generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml \
|
||||
-l go -o /gen/out/go-petstore -DpackageName=petstore # generates go client, outputs locally to ./out/go-petstore
|
||||
```
|
||||
|
||||
#### Run Docker in Vagrant
|
||||
Prerequisite: install [Vagrant](https://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads).
|
||||
@ -127,18 +160,54 @@ cd /vagrant
|
||||
./run-in-docker.sh mvn package
|
||||
```
|
||||
|
||||
#### Public Docker image
|
||||
#### Public Pre-built Docker images
|
||||
|
||||
- https://hub.docker.com/r/swaggerapi/swagger-generator/ (official)
|
||||
- https://hub.docker.com/r/jimschubert/swagger-codegen-cli/ (unofficial)
|
||||
- https://hub.docker.com/r/swaggerapi/swagger-generator/ (official web service)
|
||||
- https://hub.docker.com/r/swaggerapi/swagger-codegen-cli/ (official CLI)
|
||||
|
||||
### Homebrew
|
||||
To install, run `brew install swagger-codegen`
|
||||
|
||||
Here is an example usage:
|
||||
##### Swagger Generator Docker Image
|
||||
|
||||
The Swagger Generator image can act as a self-hosted web application and API for generating code. This container can be incorporated into a CI pipeline, and requires at least two HTTP requests and some docker orchestration to access generated code.
|
||||
|
||||
Example usage (note this assumes `jq` is installed for command line processing of JSON):
|
||||
|
||||
```
|
||||
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/
|
||||
# Start container and save the container id
|
||||
CID=$(docker run -d swaggerapi/swagger-generator)
|
||||
# allow for startup
|
||||
sleep 5
|
||||
# Get the IP of the running container
|
||||
GEN_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $CID)
|
||||
# Execute an HTTP request and store the download link
|
||||
RESULT=$(curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
|
||||
"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"
|
||||
}' 'http://localhost:8188/api/gen/clients/javascript' | jq '.link' | tr -d '"')
|
||||
# Download the generated zip and redirect to a file
|
||||
curl $RESULT > result.zip
|
||||
# Shutdown the swagger generator image
|
||||
docker stop $CID && docker rm $CID
|
||||
```
|
||||
|
||||
In the example above, `result.zip` will contain the generated client.
|
||||
|
||||
##### Swagger Codegen CLI Docker Image
|
||||
|
||||
The Swagger Codegen image acts as a standalone executable. It can be used as an alternative to installing via homebrew, or for developers who are unable to install Java or upgrade the installed version.
|
||||
|
||||
To generate code with this image, you'll need to mount a local location as a volume.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l go \
|
||||
-o /local/out/go
|
||||
```
|
||||
|
||||
The generated code will be located under `./out/go` in the current directory.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To generate a PHP client for http://petstore.swagger.io/v2/swagger.json, please run the following
|
||||
@ -153,7 +222,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
```
|
||||
(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`)
|
||||
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar )
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.2/swagger-codegen-cli-2.2.2.jar)
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate`
|
||||
|
||||
@ -179,7 +248,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-o samples/client/petstore/java
|
||||
```
|
||||
|
||||
with a number of options. You can get the options with the `help generate` command:
|
||||
with a number of options. You can get the options with the `help generate` command (below only shows partal results):
|
||||
|
||||
```
|
||||
NAME
|
||||
@ -211,78 +280,7 @@ OPTIONS
|
||||
remotely. Pass in a URL-encoded string of name:header with a comma
|
||||
separating multiple values
|
||||
|
||||
--additional-properties <additional properties>
|
||||
sets additional properties that can be referenced by the mustache
|
||||
templates in the format of name=value,name=value
|
||||
|
||||
--api-package <api package>
|
||||
package for generated api classes
|
||||
|
||||
--artifact-id <artifact id>
|
||||
artifactId in generated pom.xml
|
||||
|
||||
--artifact-version <artifact version>
|
||||
artifact version in generated pom.xml
|
||||
|
||||
-c <configuration file>, --config <configuration file>
|
||||
Path to json configuration file. File content should be in a json
|
||||
format {"optionKey":"optionValue", "optionKey1":"optionValue1"...}
|
||||
Supported options can be different for each language. Run
|
||||
config-help -l {lang} command for language specific config options.
|
||||
|
||||
-D <system properties>
|
||||
sets specified system properties in the format of
|
||||
name=value,name=value
|
||||
|
||||
--group-id <group id>
|
||||
groupId in generated pom.xml
|
||||
|
||||
-i <spec file>, --input-spec <spec file>
|
||||
location of the swagger spec, as URL or file (required)
|
||||
|
||||
|
||||
--import-mappings <import mappings>
|
||||
specifies mappings between a given class and the import that should
|
||||
be used for that class in the format of type=import,type=import
|
||||
|
||||
--instantiation-types <instantiation types>
|
||||
sets instantiation type mappings in the format of
|
||||
type=instantiatedType,type=instantiatedType.For example (in Java):
|
||||
array=ArrayList,map=HashMap. In other words array types will get
|
||||
instantiated as ArrayList in generated code.
|
||||
|
||||
--invoker-package <invoker package>
|
||||
root package for generated code
|
||||
|
||||
-l <language>, --lang <language>
|
||||
client language to generate (maybe class name in classpath,
|
||||
required)
|
||||
|
||||
--language-specific-primitives <language specific primitives>
|
||||
specifies additional language specific primitive types in the format
|
||||
of type1,type2,type3,type3. For example:
|
||||
String,boolean,Boolean,Double
|
||||
|
||||
--library <library>
|
||||
library template (sub-template)
|
||||
|
||||
--model-package <model package>
|
||||
package for generated models
|
||||
|
||||
-o <output directory>, --output <output directory>
|
||||
where to write the generated files (current dir by default)
|
||||
|
||||
-s, --skip-overwrite
|
||||
specifies if the existing files should be overwritten during the
|
||||
generation.
|
||||
|
||||
-t <template directory>, --template-dir <template directory>
|
||||
folder containing the template files
|
||||
|
||||
--type-mappings <type mappings>
|
||||
sets mappings between swagger spec types and generated code types in
|
||||
the format of swaggerType=generatedType,swaggerType=generatedType.
|
||||
For example: array=List,map=Map,string=String
|
||||
...... (results omitted)
|
||||
|
||||
-v, --verbose
|
||||
verbose mode
|
||||
@ -326,6 +324,10 @@ You would then compile your library in the `output/myLibrary` folder with `mvn p
|
||||
```
|
||||
java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen
|
||||
```
|
||||
For Windows users, you will need to use `;` instead of `:` in the classpath, e.g.
|
||||
```
|
||||
java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar;modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen
|
||||
```
|
||||
|
||||
Note the `myClientCodegen` is an option now, and you can use the usual arguments for generating your library:
|
||||
|
||||
@ -449,46 +451,7 @@ There are different aspects of customizing the code generator beyond just creati
|
||||
$ ls -1 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/
|
||||
AbstractJavaJAXRSServerCodegen.java
|
||||
AbstractTypeScriptClientCodegen.java
|
||||
AkkaScalaClientCodegen.java
|
||||
AndroidClientCodegen.java
|
||||
AspNet5ServerCodegen.java
|
||||
AspNetCoreServerCodegen.java
|
||||
AsyncScalaClientCodegen.java
|
||||
CSharpClientCodegen.java
|
||||
ClojureClientCodegen.java
|
||||
CsharpDotNet2ClientCodegen.java
|
||||
DartClientCodegen.java
|
||||
FlashClientCodegen.java
|
||||
FlaskConnexionCodegen.java
|
||||
GoClientCodegen.java
|
||||
HaskellServantCodegen.java
|
||||
JMeterCodegen.java
|
||||
JavaCXFServerCodegen.java
|
||||
JavaClientCodegen.java
|
||||
JavaInflectorServerCodegen.java
|
||||
JavaJerseyServerCodegen.java
|
||||
JavaResteasyServerCodegen.java
|
||||
JavascriptClientCodegen.java
|
||||
NodeJSServerCodegen.java
|
||||
NancyFXServerCodegen
|
||||
ObjcClientCodegen.java
|
||||
PerlClientCodegen.java
|
||||
PhpClientCodegen.java
|
||||
PythonClientCodegen.java
|
||||
Qt5CPPGenerator.java
|
||||
RubyClientCodegen.java
|
||||
ScalaClientCodegen.java
|
||||
ScalatraServerCodegen.java
|
||||
SilexServerCodegen.java
|
||||
SinatraServerCodegen.java
|
||||
SlimFrameworkServerCodegen.java
|
||||
SpringMVCServerCodegen.java
|
||||
StaticDocCodegen.java
|
||||
StaticHtmlGenerator.java
|
||||
SwaggerGenerator.java
|
||||
SwaggerYamlGenerator.java
|
||||
SwiftCodegen.java
|
||||
TizenClientCodegen.java
|
||||
... (results omitted)
|
||||
TypeScriptAngularClientCodegen.java
|
||||
TypeScriptNodeClientCodegen.java
|
||||
```
|
||||
@ -510,7 +473,7 @@ and `config.json` contains the following as an example:
|
||||
```
|
||||
|
||||
Supported config options can be different per language. Running `config-help -l {lang}` will show available options.
|
||||
**These options are applied via configuration file (e.g. config.json) or by passing them with `-D{optionName}={optionValue}**. (If `-D{optionName}` does not work, please open a [ticket](https://github.com/swagger-api/swagger-codegen/issues/new) and we'll look into it)
|
||||
**These options are applied via configuration file (e.g. config.json) or by passing them with `-D{optionName}={optionValue}`**. (If `-D{optionName}` does not work, please open a [ticket](https://github.com/swagger-api/swagger-codegen/issues/new) and we'll look into it)
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java
|
||||
@ -525,37 +488,13 @@ CONFIG OPTIONS
|
||||
|
||||
apiPackage
|
||||
package for generated api classes
|
||||
|
||||
sortParamsByRequiredFlag
|
||||
Sort method arguments to place required parameters before optional parameters. Default: true
|
||||
|
||||
invokerPackage
|
||||
root package for generated code
|
||||
|
||||
groupId
|
||||
groupId in generated pom.xml
|
||||
|
||||
artifactId
|
||||
artifactId in generated pom.xml
|
||||
|
||||
artifactVersion
|
||||
artifact version in generated pom.xml
|
||||
|
||||
sourceFolder
|
||||
source folder for generated code
|
||||
|
||||
localVariablePrefix
|
||||
prefix for generated code members and local variables
|
||||
|
||||
serializableModel
|
||||
boolean - toggle "implements Serializable" for generated models
|
||||
|
||||
...... (results omitted)
|
||||
library
|
||||
library template (sub-template) to use:
|
||||
<default> - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2
|
||||
jersey1 - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2
|
||||
jersey2 - HTTP client: Jersey client 2.6
|
||||
feign - HTTP client: Netflix Feign 8.1.1. JSON processing: Jackson 2.6.3
|
||||
okhttp-gson - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1
|
||||
okhttp-gson (default) - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1
|
||||
retrofit - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1 (Retrofit 1.9.0)
|
||||
retrofit2 - HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.0-beta2)
|
||||
```
|
||||
@ -738,6 +677,21 @@ and here is the curl command:
|
||||
curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/python
|
||||
```
|
||||
|
||||
Instead of using `swaggerUrl` with an URL to the OpenAPI/Swagger spec, one can include the spec in the JSON payload with `spec`, e.g.
|
||||
```
|
||||
{
|
||||
"options": {},
|
||||
"spec": {
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"title": "Test API"
|
||||
},
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Guidelines for Contribution
|
||||
---------------------------
|
||||
|
||||
@ -749,7 +703,9 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [Activehours](https://www.activehours.com/)
|
||||
- [Acunetix](https://www.acunetix.com/)
|
||||
- [Atlassian](https://www.atlassian.com/)
|
||||
- [Autodesk](http://www.autodesk.com/)
|
||||
- [Avenida Compras S.A.](https://www.avenida.com.ar)
|
||||
- [AYLIEN](http://aylien.com/)
|
||||
- [Balance Internet](https://www.balanceinternet.com.au/)
|
||||
- [beemo](http://www.beemo.eu)
|
||||
- [bitly](https://bitly.com)
|
||||
@ -758,66 +714,94 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [carpolo](http://www.carpolo.co/)
|
||||
- [CloudBoost](https://www.CloudBoost.io/)
|
||||
- [Conplement](http://www.conplement.de/)
|
||||
- [Cummins] (http://www.cummins.com/)
|
||||
- [Cummins](http://www.cummins.com/)
|
||||
- [Cupix](http://www.cupix.com)
|
||||
- [DBBest Technologies](https://www.dbbest.com)
|
||||
- [DecentFoX](http://decentfox.com/)
|
||||
- [DocRaptor](https://docraptor.com)
|
||||
- [DocuSign](https://www.docusign.com)
|
||||
- [Ergon](http://www.ergon.ch/)
|
||||
- [EMC](https://www.emc.com/)
|
||||
- [eureka](http://eure.jp/)
|
||||
- [everystory.us](http://everystory.us)
|
||||
- [Expected Behavior](http://www.expectedbehavior.com/)
|
||||
- [Fastly](https://www.fastly.com/)
|
||||
- [Flat](https://flat.io)
|
||||
- [Finder](http://en.finder.pl/)
|
||||
- [FH Münster - University of Applied Sciences](http://www.fh-muenster.de)
|
||||
- [Fotition](https://www.fotition.com/)
|
||||
- [Gear Zero Network](https://www.gearzero.ca)
|
||||
- [Germin8](http://www.germin8.com)
|
||||
- [GigaSpaces](http://www.gigaspaces.com)
|
||||
- [goTransverse](http://www.gotransverse.com/api)
|
||||
- [GraphHopper](https://graphhopper.com/)
|
||||
- [Gravitate Solutions](http://gravitatesolutions.com/)
|
||||
- [HashData](http://www.hashdata.cn/)
|
||||
- [Hewlett Packard Enterprise](https://hpe.com)
|
||||
- [High Technologies Center](http://htc-cs.com)
|
||||
- [IBM](https://www.ibm.com)
|
||||
- [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications)
|
||||
- [Individual Standard IVS](http://www.individual-standard.com)
|
||||
- [Intent HQ](http://www.intenthq.com)
|
||||
- [Interactive Intelligence](http://developer.mypurecloud.com/)
|
||||
- [Kabuku](http://www.kabuku.co.jp/en)
|
||||
- [Kurio](https://kurio.co.id)
|
||||
- [Kuroi](http://kuroiwebdesign.com/)
|
||||
- [Kuary](https://kuary.com/)
|
||||
- [Kubernetes](https://kubernetes.io/)
|
||||
- [LANDR Audio](https://www.landr.com/)
|
||||
- [Lascaux](http://www.lascaux.it/)
|
||||
- [Leica Geosystems AG](http://leica-geosystems.com)
|
||||
- [LiveAgent](https://www.ladesk.com/)
|
||||
- [LXL Tech](http://lxltech.com)
|
||||
- [Lyft](https://www.lyft.com/developers)
|
||||
- [MailMojo](https://mailmojo.no/)
|
||||
- [Mindera](http://mindera.com/)
|
||||
- [Mporium](http://mporium.com/)
|
||||
- [Neverfail](https://neverfail.com/)
|
||||
- [nViso](http://www.nviso.ch/)
|
||||
- [Okiok](https://www.okiok.com)
|
||||
- [Onedata](http://onedata.org)
|
||||
- [OrderCloud.io](http://ordercloud.io)
|
||||
- [OSDN](https://osdn.jp)
|
||||
- [PagerDuty](https://www.pagerduty.com)
|
||||
- [PagerTree](https://pagertree.com)
|
||||
- [Pepipost](https://www.pepipost.com)
|
||||
- [Plexxi](http://www.plexxi.com)
|
||||
- [Pixoneye](http://www.pixoneye.com/)
|
||||
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
|
||||
- [PracticeBird](https://www.practicebird.com/)
|
||||
- [Prill Tecnologia](http://www.prill.com.br)
|
||||
- [QAdept](http://qadept.com/)
|
||||
- [QuantiModo](https://quantimo.do/)
|
||||
- [QuickBlox](https://quickblox.com/)
|
||||
- [Rapid7](https://rapid7.com/)
|
||||
- [Reload! A/S](https://reload.dk/)
|
||||
- [REstore](https://www.restore.eu)
|
||||
- [Revault Sàrl](http://revault.ch)
|
||||
- [Riffyn](https://riffyn.com)
|
||||
- [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html)
|
||||
- [Saritasa](https://www.saritasa.com/)
|
||||
- [SCOOP Software GmbH](http://www.scoop-software.de)
|
||||
- [Shine Solutions](https://shinesolutions.com/)
|
||||
- [Simpfony](https://www.simpfony.com/)
|
||||
- [Skurt](http://www.skurt.com)
|
||||
- [Slamby](https://www.slamby.com/)
|
||||
- [SmartRecruiters](https://www.smartrecruiters.com/)
|
||||
- [snapCX](https://snapcx.io)
|
||||
- [SPINEN](http://www.spinen.com)
|
||||
- [SRC](https://www.src.si/)
|
||||
- [Stingray](http://www.stingray.com)
|
||||
- [StyleRecipe](http://stylerecipe.co.jp)
|
||||
- [Svenska Spel AB](https://www.svenskaspel.se/)
|
||||
- [TaskData](http://www.taskdata.com/)
|
||||
- [ThoughtWorks](https://www.thoughtworks.com)
|
||||
- [Upwork](http://upwork.com/)
|
||||
- [uShip](https://www.uship.com/)
|
||||
- [VMware](https://vmware.com/)
|
||||
- [W.UP](http://wup.hu/?siteLang=en)
|
||||
- [Wealthfront](https://www.wealthfront.com/)
|
||||
- [Webever GmbH](https://www.webever.de/)
|
||||
- [WEXO A/S](https://www.wexo.dk/)
|
||||
- [Zalando](https://tech.zalando.com)
|
||||
- [ZEEF.com](https://zeef.com/)
|
||||
@ -860,6 +844,7 @@ Swagger Codegen core team members are contributors who have been making signific
|
||||
| Java Spring Boot | @cbornet (2016/07/19) |
|
||||
| Java Spring MVC | @kolyjjj (2016/05/01) @cbornet (2016/07/19) |
|
||||
| Java JAX-RS | |
|
||||
| Java Play Framework | |
|
||||
| NancyFX | |
|
||||
| NodeJS | @kolyjjj (2016/05/01) |
|
||||
| PHP Lumen | @abcsum (2016/05/01) |
|
||||
@ -868,15 +853,19 @@ Swagger Codegen core team members are contributors who have been making signific
|
||||
| Python Flask | |
|
||||
| Ruby Sinatra | @wing328 (2016/05/01) | |
|
||||
| Scala Scalatra | | |
|
||||
| Scala Finch | @jimschubert (2017/01/28) |
|
||||
|
||||
|
||||
## Template Creator
|
||||
Here is a list of template creators:
|
||||
* API Clients:
|
||||
* Akka-Scala: @cchafer
|
||||
* Bash: @bkryza
|
||||
* C++ REST: @Danielku15
|
||||
* C# (.NET 2.0): @who
|
||||
* Clojure: @xhh
|
||||
* Dart: @yissachar
|
||||
* Elixir: @niku
|
||||
* Groovy: @victorgit
|
||||
* Go: @wing328
|
||||
* Java (Feign): @davidkiss
|
||||
@ -894,6 +883,7 @@ Here is a list of template creators:
|
||||
* TypeScript (Angular1): @mhardorf
|
||||
* TypeScript (Fetch): @leonyu
|
||||
* TypeScript (Angular2): @roni-frantchi
|
||||
* TypeScript (jQuery): @bherila
|
||||
* Server Stubs
|
||||
* C# ASP.NET5: @jimschubert
|
||||
* C# NancyFX: @mstefaniuk
|
||||
@ -903,12 +893,16 @@ Here is a list of template creators:
|
||||
* Java MSF4J: @sanjeewa-malalgoda
|
||||
* Java Spring Boot: @diyfr
|
||||
* Java Undertow: @stevehu
|
||||
* Java Play Framework: @JFCote
|
||||
* JAX-RS RestEasy: @chameleon82
|
||||
* JAX-RS CXF: @hiveship
|
||||
* JAX-RS CXF (CDI): @nickcmaynard
|
||||
* JAX-RS RestEasy (JBoss EAP): @jfiala
|
||||
* PHP Lumen: @abcsum
|
||||
* PHP Slim: @jfastnacht
|
||||
* PHP Zend Expressive (with Path Handler): @Articus
|
||||
* Ruby on Rails 5: @zlx
|
||||
* Scala Finch: @jimschubert
|
||||
* Documentation
|
||||
* HTML Doc 2: @jhitchcock
|
||||
* Confluence Wiki: @jhitchcock
|
||||
@ -940,6 +934,12 @@ Swagger Codegen Evangelist shoulders one or more of the following responsibiliti
|
||||
|
||||
If you want to be a Swagger Codegen Evangelist, please kindly apply by sending an email to wing328hk@gmail.com (@wing328)
|
||||
|
||||
### List of Swagger Codegen Evangelists
|
||||
|
||||
- Cliffano Subagio (@cliffano from Australia joined on Dec 9, 2016)
|
||||
- [Building An AEM API Clients Ecosystem](http://www.slideshare.net/cliffano/building-an-aem-api-clients-ecosystem)
|
||||
- [Adobe Marketing Cloud Community Expo](http://blog.cliffano.com/2016/11/10/adobe-marketing-cloud-community-expo/)
|
||||
|
||||
# License information on Generated Code
|
||||
|
||||
The Swagger Codegen project is intended as a benefit for users of the Swagger / Open API Specification. The project itself has the [License](#license) as specified. In addition, please understand the following points:
|
||||
@ -952,7 +952,7 @@ When code is generated from this project, it shall be considered **AS IS** and o
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright 2016 SmartBear Software
|
||||
Copyright 2017 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -966,3 +966,4 @@ limitations under the License.
|
||||
|
||||
---
|
||||
<img src="http://swagger.io/wp-content/uploads/2016/02/logo.jpg"/>
|
||||
|
||||
|
@ -18,6 +18,8 @@ install:
|
||||
- cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g
|
||||
- cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g
|
||||
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
|
||||
- cmd: dir/w
|
||||
# - cmd: RMDIR "C:\projects\swagger-codegen\swagger-samples" /S /Q
|
||||
- git clone https://github.com/wing328/swagger-samples
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs"
|
||||
build_script:
|
||||
@ -27,6 +29,9 @@ build_script:
|
||||
# build C# API client (with PropertyChanged)
|
||||
- nuget restore samples\client\petstore\csharp\SwaggerClientWithPropertyChanged\IO.Swagger.sln
|
||||
- msbuild samples\client\petstore\csharp\SwaggerClientWithPropertyChanged\IO.Swagger.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
# build C# .net standard 1.3+ API client
|
||||
- nuget restore samples\client\petstore\csharp\SwaggerClient.v5\IO.Swagger.sln
|
||||
- msbuild samples\client\petstore\csharp\SwaggerClient.v5\IO.Swagger.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
# install swagger codegen locally
|
||||
- mvn clean install --batch-mode
|
||||
test_script:
|
||||
@ -37,6 +42,6 @@ test_script:
|
||||
|
||||
# generate all petstore clients
|
||||
- .\bin\windows\run-all-petstore.cmd
|
||||
cache:
|
||||
#cache:
|
||||
# - C:\maven\
|
||||
# - C:\Users\appveyor\.m2
|
||||
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l akka-scala -o samples/client/petstore/akka-scala"
|
||||
ags="$@ generate --artifact-id "scala-akka-petstore-client" -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l akka-scala -o samples/client/petstore/akka-scala"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -l aspnetcore -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnetcore"
|
||||
ags="$@ generate -l aspnetcore -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnetcore --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5}"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
31
bin/bash-petstore.sh
Executable file
31
bin/bash-petstore.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="$@ generate -t modules/swagger-codegen/src/main/resources/bash -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l bash -o samples/client/petstore/bash -c modules/swagger-codegen/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient --additional-properties hideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -5,3 +5,7 @@
|
||||
|
||||
# C# Petstore API client with PropertyChanged
|
||||
./bin/csharp-property-changed-petstore.sh
|
||||
|
||||
# C# Petstore API client (v5.0 for .net standarnd 1.3+)
|
||||
./bin/csharp-petstore-v5.sh
|
||||
|
||||
|
3
bin/csharp-petstore-v5.json
Normal file
3
bin/csharp-petstore-v5.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"targetFramework": "v5.0"
|
||||
}
|
31
bin/csharp-petstore-v5.sh
Executable file
31
bin/csharp-petstore-v5.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient.v5 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-v5.json"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient"
|
||||
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientWithPropertyChanged --additional-properties=generatePropertyChanged=true"
|
||||
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientWithPropertyChanged --additional-properties=generatePropertyChanged=true,packageGuid={5CD900DE-8266-412F-A758-28E1F9C623D5}"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true"
|
||||
|
||||
# then options to generate the library for vm would be:
|
||||
#ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm"
|
||||
|
31
bin/elixir-petstore.sh
Executable file
31
bin/elixir-petstore.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="$@ generate -t modules/swagger-codegen/src/main/resources/elixir -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l elixir -o samples/client/petstore/elixir"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
31
bin/finch-petstore-server.sh
Executable file
31
bin/finch-petstore-server.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -t modules/swagger-codegen/src/main/resources/finch -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l finch -o samples/server/petstore/finch"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go-server -o samples/server/petstore/go-api-server -DpackageName=petstoreserver "
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go-server -o samples/server/petstore/go-api-server -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true "
|
||||
|
||||
java $JAVA_OPTS -Dservice -jar $executable $ags
|
||||
|
31
bin/html-markdown.sh
Executable file
31
bin/html-markdown.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/markdown.yaml -l html -o samples/html.md"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l html2 -o samples/html2"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l html2 -o samples/html2 --additional-properties hideGenerationTimestamp=true"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l inflector -o samples/server/petstore/java-inflector"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l inflector -o samples/server/petstore/java-inflector -DhideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -26,9 +26,9 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/MSF4J -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/MSF4J -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true --additional-properties artifactId=swagger-msf4j-server"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main"
|
||||
rm -rf samples/server/petstore/java-msf4j/src/main
|
||||
find samples/server/petstore/java-msf4j -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
find samples/server/petstore/java-msf4j -maxdepth 1 -type f ! -name "README.md" ! -name "pom.xml" ! -name "mvn_test_jdk8_only.sh" ! -name ".swagger-codegen-ignore" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -9,3 +9,5 @@
|
||||
./bin/java-petstore-retrofit2.sh
|
||||
./bin/java-petstore-retrofit2rx.sh
|
||||
./bin/java8-petstore-jersey2.sh
|
||||
./bin/java-petstore-retrofit2-play24.sh
|
||||
./bin/java-petstore-jersey2-java6.sh
|
||||
|
@ -26,7 +26,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true"
|
||||
ags="$@ generate --artifact-id swagger-petstore-jersey2-java6 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true"
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main"
|
||||
rm -rf samples/client/petstore/java/jersey2-java6/src/main
|
||||
|
@ -28,6 +28,6 @@ fi
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson-parcelableModel -DhideGenerationTimestamp=true,parcelableModel=true"
|
||||
|
||||
rm -rf samples/client/petstore/java/okhttp-gson/src/main
|
||||
find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
rm -rf samples/client/petstore/java/okhttp-gson-parcelableModel/src/main
|
||||
find samples/client/petstore/java/okhttp-gson-parcelableModel -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
6
bin/java-petstore-retrofit2-all.sh
Executable file
6
bin/java-petstore-retrofit2-all.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/java-petstore-retrofit2-play24.sh
|
||||
./bin/java-petstore-retrofit2.sh
|
||||
./bin/java-petstore-retrofit2rx.sh
|
||||
./bin/java-petstore-retrofit2rx2.sh
|
1
bin/java-petstore-retrofit2-play24.json
Normal file
1
bin/java-petstore-retrofit2-play24.json
Normal file
@ -0,0 +1 @@
|
||||
{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2", "usePlay24WS":"true"}
|
34
bin/java-petstore-retrofit2-play24.sh
Executable file
34
bin/java-petstore-retrofit2-play24.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2-play24.json -o samples/client/petstore/java/retrofit2-play24 -DhideGenerationTimestamp=true"
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/java/retrofit2-play24/src/main"
|
||||
rm -rf samples/client/petstore/java/retrofit2-play24/src/main
|
||||
find samples/client/petstore/java/retrofit2-play24 -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
4
bin/java-petstore-retrofit2rx2.json
Normal file
4
bin/java-petstore-retrofit2rx2.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"library": "retrofit2",
|
||||
"artifactId": "swagger-petstore-retrofit2-rx2"
|
||||
}
|
34
bin/java-petstore-retrofit2rx2.sh
Executable file
34
bin/java-petstore-retrofit2rx2.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx2.json -o samples/client/petstore/java/retrofit2rx2 -DuseRxJava2=true,hideGenerationTimestamp=true"
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/java/retrofit2rx2/src/main"
|
||||
rm -rf samples/client/petstore/java/retrofit2rx2/src/main
|
||||
find samples/client/petstore/java/retrofit2rx2 -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
31
bin/java-play-framework-petstore-server.sh
Executable file
31
bin/java-play-framework-petstore-server.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaPlayFramework -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java-play-framework -o samples/server/petstore/java-play-framework -DhideGenerationTimestamp=true"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/undertow -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l undertow -o samples/server/petstore/undertow"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/undertow -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l undertow -o samples/server/petstore/undertow --additional-properties hideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
31
bin/jaxrs-cxf-client-petstore.sh
Executable file
31
bin/jaxrs-cxf-client-petstore.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate --artifact-id "jaxrs-cxf-petstore-client" -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/ -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/client/petstore/jaxrs-cxf-client/"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
31
bin/jaxrs-cxf-petstore-server-annotated-base-path.sh
Executable file
31
bin/jaxrs-cxf-petstore-server-annotated-base-path.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-annotated-base-path -DhideGenerationTimestamp=true,useAnnotatedBasePath=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
31
bin/jaxrs-cxf-petstore-server-non-spring-application.sh
Executable file
31
bin/jaxrs-cxf-petstore-server-non-spring-application.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-non-spring-app -DhideGenerationTimestamp=true,generateNonSpringApplication=true"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -26,7 +26,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey1 -DhideGenerationTimestamp=true --library=jersey1 --artifact-id=swagger-jaxrs-jersey1-server"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey1 -DhideGenerationTimestamp=true,serverPort=8080 --library=jersey1 --artifact-id=swagger-jaxrs-jersey1-server"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/jaxrs/jersey1/src/main"
|
||||
rm -rf samples/server/petstore/jaxrs/jersey1/src/main
|
||||
|
@ -26,7 +26,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey2 -DhideGenerationTimestamp=true"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey2 -DhideGenerationTimestamp=true,serverPort=8080"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/jaxrs/jersey2/src/main"
|
||||
rm -rf samples/server/petstore/jaxrs/jersey2/src/main
|
||||
|
3
bin/jaxrs-resteasy-eap-joda-petstore-server.json
Normal file
3
bin/jaxrs-resteasy-eap-joda-petstore-server.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"dateLibrary": "joda"
|
||||
}
|
35
bin/jaxrs-resteasy-eap-joda-petstore-server.sh
Normal file
35
bin/jaxrs-resteasy-eap-joda-petstore-server.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate --artifact-id swagger-jaxrs-resteasy-eap-joda-server -t modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-joda/src/main"
|
||||
rm -rf samples/server/petstore/jaxrs-resteasy/eap-joda/src/main
|
||||
find samples/server/petstore/jaxrs-resteasy/eap-joda -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
35
bin/jaxrs-resteasy-eap-petstore-server.sh
Normal file
35
bin/jaxrs-resteasy-eap-petstore-server.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap -DhideGenerationTimestamp=true"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap/src/main"
|
||||
rm -rf samples/server/petstore/jaxrs-resteasy/eap/src/main
|
||||
find samples/server/petstore/jaxrs-resteasy/eap -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -26,6 +26,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-spec -o samples/server/petstore/jaxrs-spec -DhideGenerationTimestamp=true"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs-spec -o samples/server/petstore/jaxrs-spec
|
||||
-DhideGenerationTimestamp=true"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx"
|
||||
ags="generate $@ -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx --additional-properties packageGuid={768B8DC6-54EE-4D40-9B20-7857E1D742A4}"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
31
bin/nodejs-petstore-google-cloud-functions.sh
Executable file
31
bin/nodejs-petstore-google-cloud-functions.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions"
|
||||
|
||||
java $JAVA_OPTS -Dservice -jar $executable $ags
|
@ -27,7 +27,7 @@ fi
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
# complex module name used for testing
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}"
|
||||
|
||||
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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/typescript-fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/TypeScript-Fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/spring-cloud-feign-petstore.sh
|
||||
./bin/spring-delegate.sh
|
||||
./bin/spring-delegate-j8.sh
|
||||
./bin/spring-stubs.sh
|
||||
./bin/spring-mvc-petstore-j8-async-server.sh
|
||||
./bin/springboot-petstore-server.sh
|
||||
|
34
bin/spring-delegate-j8.sh
Executable file
34
bin/spring-delegate-j8.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -o samples/server/petstore/springboot-delegate-j8 -DdelegatePattern=true,hideGenerationTimestamp=true,java8=true"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/springboot-delegate-j8/src/main"
|
||||
rm -rf samples/server/petstore/springboot-delegate-j8/src/main
|
||||
find samples/server/petstore/springboot-delegate-j8/ -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
34
bin/spring-delegate.sh
Executable file
34
bin/spring-delegate.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -o samples/server/petstore/springboot-delegate -DdelegatePattern=true,hideGenerationTimestamp=true"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/springboot-delegate/src/main"
|
||||
rm -rf samples/server/petstore/springboot-delegate/src/main
|
||||
find samples/server/petstore/springboot-delegate/ -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
3
bin/springboot-petstore-server-implicitHeaders.json
Executable file
3
bin/springboot-petstore-server-implicitHeaders.json
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"implicitHeaders": true
|
||||
}
|
34
bin/springboot-petstore-server-implicitHeaders.sh
Executable file
34
bin/springboot-petstore-server-implicitHeaders.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -c bin/springboot-petstore-server-implicitHeaders.json -o samples/server/petstore/springboot-implicitHeaders -DhideGenerationTimestamp=true"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/springboot-implicitHeaders/src/main"
|
||||
rm -rf samples/server/petstore/springboot-implicitHeaders/src/main
|
||||
find samples/server/petstore/springboot-implicitHeaders -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
36
bin/typescript-jquery-all.sh
Executable file
36
bin/typescript-jquery-all.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
echo "Typescript jquery Petstore API client (default setting)"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -o samples/client/petstore/typescript-jquery/default"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
echo "Typescript jquery Petstore API client with npm setting"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-jquery/npm"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
18
bin/utils/detect_carriage_return.sh
Executable file
18
bin/utils/detect_carriage_return.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# grep for \r in the templates
|
||||
grep -RUIl $'\r$' modules/swagger-codegen/src/main/resources/*
|
||||
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Templates contain carriage return '/r'. Please remove it and try again."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
# grep for \r in the generators
|
||||
grep -RUIl $'\r$' modules/swagger-codegen/src/main/java/io/swagger/codegen/*.java
|
||||
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Generators contain carriage return '/r'. Please remove it and try again."
|
||||
exit 1;
|
||||
fi
|
12
bin/utils/detect_tab_in_java_class.sh
Executable file
12
bin/utils/detect_tab_in_java_class.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# grep for \t in the generators
|
||||
RESULT=`find modules/swagger-codegen/src/ -name "*.java" | xargs grep $'\t'`
|
||||
|
||||
echo -e "$RESULT"
|
||||
|
||||
if [ "$RESULT" != "" ]; then
|
||||
echo "Java files contain tab '\\t'. Please remove it and try again."
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l akka-scala -o samples\client\petstore\akka-scala
|
||||
set ags=generate --artifact-id "scala-akka-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l akka-scala -o samples\client\petstore\akka-scala
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l aspnetcore -o samples\server\petstore\aspnetcore\
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l aspnetcore -o samples\server\petstore\aspnetcore\ --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5}
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
10
bin/windows/csharp-petstore-netstandard.bat
Normal file
10
bin/windows/csharp-petstore-netstandard.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples\client\petstore\csharp\SwaggerClientNetStandard --additional-properties targetFramework=v5.0,packageGuid={3AB1F259-1769-484B-9411-84505FCCBD55}
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples\client\petstore\csharp\SwaggerClient
|
||||
set ags=generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples\client\petstore\csharp\SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
10
bin/windows/java-play-framework-petstore-server.bat
Normal file
10
bin/windows/java-play-framework-petstore-server.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java-play-framework -o samples\server\petstore\java-play-framework
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
2
bin/windows/javascript-petstore-all.bat
Executable file
2
bin/windows/javascript-petstore-all.bat
Executable file
@ -0,0 +1,2 @@
|
||||
call .\bin\windows\javascript-petstore.bat
|
||||
call .\bin\windows\javascript-promise-petstore.bat
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l javascript -o samples\client\petstore\javascript
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples\client\petstore\javascript
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
10
bin/windows/javascript-promise-petstore.bat
Executable file
10
bin/windows/javascript-promise-petstore.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples\client\petstore\javascript-promise --additional-properties usePromises=true
|
||||
|
||||
java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/jaxrs-cxf-client-petstore.bat
Executable file
10
bin/windows/jaxrs-cxf-client-petstore.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
3
bin/windows/swift-petstore-all.bat
Executable file
3
bin/windows/swift-petstore-all.bat
Executable file
@ -0,0 +1,3 @@
|
||||
call .\bin\windows\swift-petstore.bat
|
||||
call .\bin\windows\swift-petstore-promisekit.bat
|
||||
call .\bin\windows\swift-petstore-rxswift.bat
|
10
bin/windows/swift-petstore-promisekit.bat
Executable file
10
bin/windows/swift-petstore-promisekit.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-promisekit.json -o samples\client\petstore\swift\promisekit
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/swift-petstore-rxswift.bat
Executable file
10
bin/windows/swift-petstore-rxswift.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-rxswift.json -o samples\client\petstore\swift\rxswift
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -o samples\client\petstore\swift
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -o samples\client\petstore\swift\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
3
bin/windows/swift3-petstore-all.bat
Executable file
3
bin/windows/swift3-petstore-all.bat
Executable file
@ -0,0 +1,3 @@
|
||||
call .\bin\windows\swift3-petstore.bat
|
||||
call .\bin\windows\swift3-petstore-promisekit.bat
|
||||
call .\bin\windows\swift3-petstore-rxswift.bat
|
10
bin/windows/swift3-petstore-promisekit.bat
Executable file
10
bin/windows/swift3-petstore-promisekit.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c bin\swift3-petstore-promisekit.json -o samples\client\petstore\swift3\promisekit
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/swift3-petstore-rxswift.bat
Executable file
10
bin/windows/swift3-petstore-rxswift.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c bin\swift3-petstore-rxswift.json -o samples\client\petstore\swift3\rxswift
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/swift3-petstore.bat
Executable file
10
bin/windows/swift3-petstore.bat
Executable file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -o samples\client\petstore\swift3\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/ze-ph-petstore.bat
Normal file
10
bin/windows/ze-ph-petstore.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l ze-ph -o samples\server\petstore\ze-ph
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
31
bin/ze-ph-petstore-server.sh
Normal file
31
bin/ze-ph-petstore-server.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/ze-ph -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ze-ph -o samples/server/petstore/ze-ph"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
44
circle.yml
Normal file
44
circle.yml
Normal file
@ -0,0 +1,44 @@
|
||||
# work in progress: the goal is to move all the existing tests
|
||||
# handled by travis-ci to circle CI so that travis-ci can test
|
||||
# objc/swift API client instead
|
||||
machine:
|
||||
environment:
|
||||
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
|
||||
java:
|
||||
# TODO we also need to test oraclejdk8
|
||||
version: oraclejdk7
|
||||
node:
|
||||
version: 5.0.0
|
||||
services:
|
||||
- docker
|
||||
# Override /etc/hosts
|
||||
hosts:
|
||||
petstore.swagger.io: 127.0.0.1
|
||||
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- ~/.jspm
|
||||
- ~/.npm
|
||||
- ~/builder
|
||||
- ~/.m2
|
||||
pre:
|
||||
- export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
|
||||
- gem install bundler
|
||||
- npm install -g typescript
|
||||
- sudo pip install virtualenv
|
||||
# to run petstore server locally via docker
|
||||
- docker pull swaggerapi/petstore
|
||||
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- docker ps -a
|
||||
# show host table to confirm petstore.swagger.io is mapped to localhost
|
||||
- cat /etc/hosts
|
||||
override:
|
||||
#- rvm --default use 2.1.0
|
||||
#- ruby -v
|
||||
|
||||
test:
|
||||
override:
|
||||
- mvn verify -Psamples
|
||||
#- mvn -q clean install
|
||||
#- jdk_switcher use oraclejdk8
|
||||
#- mvn -q clean install
|
24
docker-entrypoint.sh
Executable file
24
docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# GEN_DIR allows to share the entrypoint between Dockerfile and run-in-docker.sh (backward compatible)
|
||||
GEN_DIR=${GEN_DIR:-/opt/swagger-codegen}
|
||||
JAVA_OPTS=${JAVA_OPTS:-"-Xmx1024M -DloggerPath=conf/log4j.properties"}
|
||||
|
||||
codegen="${GEN_DIR}/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
case "$1" in
|
||||
generate|help|langs|meta|config-help)
|
||||
# If ${GEN_DIR} has been mapped elsewhere from default, and that location has not been built
|
||||
if [[ ! -f "${codegen}" ]]; then
|
||||
(cd ${GEN_DIR} && exec mvn -am -pl "modules/swagger-codegen-cli" package)
|
||||
fi
|
||||
command=$1
|
||||
shift
|
||||
exec java ${JAVA_OPTS} -jar ${codegen} ${command} "$@"
|
||||
;;
|
||||
*) # Any other commands, e.g. docker run imagename ls -la or docker run -it imagename /bin/bash
|
||||
exec "$@"
|
||||
;;
|
||||
esac
|
7
modules/swagger-codegen-cli/Dockerfile
Normal file
7
modules/swagger-codegen-cli/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM java:8-jre-alpine
|
||||
|
||||
ADD target/swagger-codegen-cli.jar /opt/swagger-codegen-cli/swagger-codegen-cli.jar
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "/opt/swagger-codegen-cli/swagger-codegen-cli.jar"]
|
||||
|
||||
CMD ["help"]
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-codegen-project</artifactId>
|
||||
<version>2.2.2-SNAPSHOT</version>
|
||||
<version>2.2.3-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -118,6 +118,13 @@ public class Generate implements Runnable {
|
||||
@Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT_DESC)
|
||||
private String httpUserAgent;
|
||||
|
||||
@Option(name = {"--reserved-words-mappings"}, title = "import mappings",
|
||||
description = "specifies how a reserved name should be escaped to. Otherwise, the default _<name> is used. For example id=identifier")
|
||||
private String reservedWordsMappings;
|
||||
|
||||
@Option(name = {"--ignore-file-override"}, title = "ignore file override location", description = CodegenConstants.IGNORE_FILE_OVERRIDE_DESC)
|
||||
private String ignoreFileOverride;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@ -211,13 +218,17 @@ public class Generate implements Runnable {
|
||||
configurator.setHttpUserAgent(httpUserAgent);
|
||||
}
|
||||
|
||||
if (isNotEmpty(ignoreFileOverride)) {
|
||||
configurator.setIgnoreFileOverride(ignoreFileOverride);
|
||||
}
|
||||
|
||||
applySystemPropertiesKvp(systemProperties, configurator);
|
||||
applyInstantiationTypesKvp(instantiationTypes, configurator);
|
||||
applyImportMappingsKvp(importMappings, configurator);
|
||||
applyTypeMappingsKvp(typeMappings, configurator);
|
||||
applyAdditionalPropertiesKvp(additionalProperties, configurator);
|
||||
applyLanguageSpecificPrimitivesCsv(languageSpecificPrimitives, configurator);
|
||||
|
||||
applyReservedWordsMappingsKvp(reservedWordsMappings, configurator);
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
|
||||
new DefaultGenerator().opts(clientOptInput).generate();
|
||||
|
@ -45,9 +45,21 @@ mvn clean compile
|
||||
- `modelPackage` - the package to use for generated model objects/classes
|
||||
- `apiPackage` - the package to use for generated api objects/classes
|
||||
- `invokerPackage` - the package to use for the generated invoker objects
|
||||
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums.
|
||||
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums
|
||||
- `useJaxbAnnotations` - enable Jaxb annotations inside the generated models
|
||||
- `configOptions` - a map of language-specific parameters (see below)
|
||||
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
|
||||
- `ignoreFileOverride` - specifies the full path to a `.swagger-codegen-ignore` used for pattern based overrides of generated outputs
|
||||
- `generateApis` - generate the apis (`true` by default)
|
||||
- `generateApiTests` - generate the api tests (`true` by default. Only available if `generateApis` is `true`)
|
||||
- `generateApiDocumentation` - generate the api documentation (`true` by default. Only available if `generateApis` is `true`)
|
||||
- `generateModels` - generate the models (`true` by default)
|
||||
- `modelsToGenerate` - A comma separated list of models to generate. All models is the default.
|
||||
- `generateModelTests` - generate the model tests (`true` by default. Only available if `generateModels` is `true`)
|
||||
- `generateModelDocumentation` - generate the model documentation (`true` by default. Only available if `generateModels` is `true`)
|
||||
- `generateSupportingFiles` - generate the supporting files (`true` by default)
|
||||
- `supportingFilesToGenerate` - A comma separated list of supporting files to generate. All files is the default.
|
||||
- `skip` - skip code generation (`false` by default. Can also be set globally through the `codegen.skip` property)
|
||||
|
||||
### Custom Generator
|
||||
|
||||
|
@ -22,12 +22,15 @@
|
||||
<!-- specify the swagger yaml -->
|
||||
<inputSpec>swagger.yaml</inputSpec>
|
||||
|
||||
<!-- target to generate -->
|
||||
<!-- target to generate java client code -->
|
||||
<language>java</language>
|
||||
|
||||
<!-- hint: if you want to generate java server code, e.g. based on Spring Boot,
|
||||
you can use the following target: <language>spring</language> -->
|
||||
|
||||
<!-- pass any necessary config options -->
|
||||
<configOptions>
|
||||
<dateLibrary>java8</dateLibrary>
|
||||
<dateLibrary>joda</dateLibrary>
|
||||
</configOptions>
|
||||
|
||||
<!-- override the default library to jersey2 -->
|
||||
@ -40,12 +43,16 @@
|
||||
</build>
|
||||
<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 -->
|
||||
|
||||
<!-- HTTP client: jersey-client -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
@ -54,16 +61,21 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-base</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
@ -79,10 +91,17 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Joda time: if you use it -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
@ -96,19 +115,13 @@
|
||||
<artifactId>migbase64</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
||||
<jersey-version>2.12</jersey-version>
|
||||
<jackson-version>2.4.2</jackson-version>
|
||||
<jodatime-version>2.3</jodatime-version>
|
||||
<swagger-annotations-version>1.5.8</swagger-annotations-version>
|
||||
<jersey-version>2.22.2</jersey-version>
|
||||
<jackson-version>2.7.0</jackson-version>
|
||||
<jodatime-version>2.7</jodatime-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
</properties>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-codegen-project</artifactId>
|
||||
<version>2.2.2-SNAPSHOT</version>
|
||||
<version>2.2.3-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>swagger-codegen-maven-plugin</artifactId>
|
||||
|
@ -21,6 +21,7 @@ import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyImportMapp
|
||||
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvp;
|
||||
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
|
||||
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvp;
|
||||
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvp;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
import java.io.File;
|
||||
@ -161,12 +162,78 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "modelNameSuffix", required = false)
|
||||
private String modelNameSuffix;
|
||||
|
||||
/**
|
||||
* Sets an optional ignoreFileOverride path
|
||||
*/
|
||||
@Parameter(name = "ignoreFileOverride", required = false)
|
||||
private String ignoreFileOverride;
|
||||
|
||||
/**
|
||||
* A map of language-specific parameters as passed with the -c option to the command line
|
||||
*/
|
||||
@Parameter(name = "configOptions")
|
||||
private Map<?, ?> configOptions;
|
||||
|
||||
/**
|
||||
* Generate the apis
|
||||
*/
|
||||
@Parameter(name = "generateApis", required = false)
|
||||
private Boolean generateApis = true;
|
||||
|
||||
/**
|
||||
* Generate the models
|
||||
*/
|
||||
@Parameter(name = "generateModels", required = false)
|
||||
private Boolean generateModels = true;
|
||||
|
||||
/**
|
||||
* A comma separated list of models to generate. All models is the default.
|
||||
*/
|
||||
@Parameter(name = "modelsToGenerate", required = false)
|
||||
private String modelsToGenerate = "";
|
||||
|
||||
/**
|
||||
* Generate the supporting files
|
||||
*/
|
||||
@Parameter(name = "generateSupportingFiles", required = false)
|
||||
private Boolean generateSupportingFiles = true;
|
||||
|
||||
/**
|
||||
* A comma separated list of models to generate. All models is the default.
|
||||
*/
|
||||
@Parameter(name = "supportingFilesToGenerate", required = false)
|
||||
private String supportingFilesToGenerate = "";
|
||||
|
||||
/**
|
||||
* Generate the model tests
|
||||
*/
|
||||
@Parameter(name = "generateModelTests", required = false)
|
||||
private Boolean generateModelTests = true;
|
||||
|
||||
/**
|
||||
* Generate the model documentation
|
||||
*/
|
||||
@Parameter(name = "generateModelDocumentation", required = false)
|
||||
private Boolean generateModelDocumentation = true;
|
||||
|
||||
/**
|
||||
* Generate the api tests
|
||||
*/
|
||||
@Parameter(name = "generateApiTests", required = false)
|
||||
private Boolean generateApiTests = true;
|
||||
|
||||
/**
|
||||
* Generate the api documentation
|
||||
*/
|
||||
@Parameter(name = "generateApiDocumentation", required = false)
|
||||
private Boolean generateApiDocumentation = true;
|
||||
|
||||
/**
|
||||
* Skip the execution.
|
||||
*/
|
||||
@Parameter(name = "skip", property = "codegen.skip", required = false, defaultValue = "false")
|
||||
private Boolean skip;
|
||||
|
||||
/**
|
||||
* Add the output directory to the project as a source root, so that the
|
||||
* generated java types are compiled and included in the project artifact.
|
||||
@ -177,6 +244,9 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter
|
||||
protected Map<String, String> environmentVariables = new HashMap<String, String>();
|
||||
|
||||
@Parameter
|
||||
protected Map<String, String> originalEnvironmentVariables = new HashMap<String, String>();
|
||||
|
||||
@Parameter
|
||||
private boolean configHelp = false;
|
||||
|
||||
@ -186,9 +256,19 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(readonly = true, required = true, defaultValue = "${project}")
|
||||
private MavenProject project;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException {
|
||||
|
||||
if(skip) {
|
||||
getLog().info("Code generation is skipped.");
|
||||
// Even when no new sources are generated, the existing ones should
|
||||
// still be compiled if needed.
|
||||
addCompileSourceRootIfConfigured();
|
||||
return;
|
||||
}
|
||||
|
||||
//attempt to read from config file
|
||||
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
|
||||
|
||||
@ -215,6 +295,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setGitRepoId(gitRepoId);
|
||||
}
|
||||
|
||||
if(isNotEmpty(ignoreFileOverride)) {
|
||||
configurator.setIgnoreFileOverride(ignoreFileOverride);
|
||||
}
|
||||
|
||||
configurator.setLang(language);
|
||||
|
||||
configurator.setOutputDir(output.getAbsolutePath());
|
||||
@ -263,6 +347,30 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
|
||||
}
|
||||
|
||||
// Set generation options
|
||||
if (null != generateApis && generateApis) {
|
||||
System.setProperty("apis", "");
|
||||
} else {
|
||||
System.clearProperty("apis");
|
||||
}
|
||||
|
||||
if (null != generateModels && generateModels) {
|
||||
System.setProperty("models", modelsToGenerate);
|
||||
} else {
|
||||
System.clearProperty("models");
|
||||
}
|
||||
|
||||
if (null != generateSupportingFiles && generateSupportingFiles) {
|
||||
System.setProperty("supportingFiles", supportingFilesToGenerate);
|
||||
} else {
|
||||
System.clearProperty("supportingFiles");
|
||||
}
|
||||
|
||||
System.setProperty("modelTests", generateModelTests.toString());
|
||||
System.setProperty("modelDocs", generateModelDocumentation.toString());
|
||||
System.setProperty("apiTests", generateApiTests.toString());
|
||||
System.setProperty("apiDocs", generateApiDocumentation.toString());
|
||||
|
||||
if (configOptions != null) {
|
||||
|
||||
if(configOptions.containsKey("instantiation-types")) {
|
||||
@ -284,11 +392,16 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
if(configOptions.containsKey("additional-properties")) {
|
||||
applyAdditionalPropertiesKvp(configOptions.get("additional-properties").toString(), configurator);
|
||||
}
|
||||
|
||||
if(configOptions.containsKey("reserved-words-mappings")) {
|
||||
applyReservedWordsMappingsKvp(configOptions.get("reserved-words-mappings").toString(), configurator);
|
||||
}
|
||||
}
|
||||
|
||||
if (environmentVariables != null) {
|
||||
|
||||
for(String key : environmentVariables.keySet()) {
|
||||
originalEnvironmentVariables.put(key, System.getProperty(key));
|
||||
String value = environmentVariables.get(key);
|
||||
if(value == null) {
|
||||
// don't put null values
|
||||
@ -329,12 +442,26 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
throw new MojoExecutionException("Code generation failed. See above for the full exception.");
|
||||
}
|
||||
|
||||
if (addCompileSourceRoot) {
|
||||
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
|
||||
addCompileSourceRootIfConfigured();
|
||||
}
|
||||
|
||||
private void addCompileSourceRootIfConfigured() {
|
||||
if(addCompileSourceRoot) {
|
||||
final Object sourceFolderObject = configOptions == null ? null : configOptions.get(CodegenConstants.SOURCE_FOLDER);
|
||||
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
|
||||
|
||||
String sourceJavaFolder = output.toString() + "/" + sourceFolder;
|
||||
project.addCompileSourceRoot(sourceJavaFolder);
|
||||
}
|
||||
|
||||
// Reset all environment variables to their original value. This prevents unexpected behaviour
|
||||
// when running the plugin multiple consecutive times with different configurations.
|
||||
for(Map.Entry<String, String> entry : originalEnvironmentVariables.entrySet()) {
|
||||
if(entry.getValue() == null) {
|
||||
System.clearProperty(entry.getKey());
|
||||
} else {
|
||||
System.setProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-codegen-project</artifactId>
|
||||
<version>2.2.2-SNAPSHOT</version>
|
||||
<version>2.2.3-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -224,16 +224,6 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${felix-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-ext</artifactId>
|
||||
@ -283,6 +273,11 @@
|
||||
<version>${diffutils-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.atlassian.commonmark</groupId>
|
||||
<artifactId>commonmark</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
|
@ -13,6 +13,7 @@ import java.io.Writer;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -56,13 +57,17 @@ public abstract class AbstractGenerator {
|
||||
if (is == null) {
|
||||
is = new FileInputStream(new File(name)); // May throw but never return a null value
|
||||
}
|
||||
return new InputStreamReader(is);
|
||||
return new InputStreamReader(is, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
throw new RuntimeException("can't load template " + name);
|
||||
}
|
||||
|
||||
private String buildLibraryFilePath(String dir, String library, String file) {
|
||||
return dir + File.separator + "libraries" + File.separator + library + File.separator + file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the template file path with template dir prepended, and use the
|
||||
* library template if exists.
|
||||
@ -72,24 +77,39 @@ public abstract class AbstractGenerator {
|
||||
* @return String Full template file path
|
||||
*/
|
||||
public String getFullTemplateFile(CodegenConfig config, String templateFile) {
|
||||
String template = config.templateDir() + File.separator + templateFile;
|
||||
if (new File(template).exists()) {
|
||||
return template;
|
||||
} else {
|
||||
String library = config.getLibrary();
|
||||
if (library != null && !"".equals(library)) {
|
||||
String libTemplateFile = config.embeddedTemplateDir() + File.separator +
|
||||
"libraries" + File.separator + library + File.separator +
|
||||
templateFile;
|
||||
if (embeddedTemplateExists(libTemplateFile)) {
|
||||
// Fall back to the template file embedded/packaged in the JAR file...
|
||||
//1st the code will check if there's a <template folder>/libraries/<library> folder containing the file
|
||||
//2nd it will check for the file in the specified <template folder> folder
|
||||
//3rd it will check if there's an <embedded template>/libraries/<library> folder containing the file
|
||||
//4th and last it will assume the file is in <embedded template> folder.
|
||||
|
||||
//check the supplied template library folder for the file
|
||||
final String library = config.getLibrary();
|
||||
if (StringUtils.isNotEmpty(library)) {
|
||||
//look for the file in the library subfolder of the supplied template
|
||||
final String libTemplateFile = buildLibraryFilePath(config.templateDir(), library, templateFile);
|
||||
if (new File(libTemplateFile).exists()) {
|
||||
return libTemplateFile;
|
||||
}
|
||||
}
|
||||
|
||||
//check the supplied template main folder for the file
|
||||
final String template = config.templateDir() + File.separator + templateFile;
|
||||
if (new File(template).exists()) {
|
||||
return template;
|
||||
}
|
||||
|
||||
//try the embedded template library folder next
|
||||
if (StringUtils.isNotEmpty(library)) {
|
||||
final String embeddedLibTemplateFile = buildLibraryFilePath(config.embeddedTemplateDir(), library, templateFile);
|
||||
if (embeddedTemplateExists(embeddedLibTemplateFile)) {
|
||||
// Fall back to the template file embedded/packaged in the JAR file library folder...
|
||||
return embeddedLibTemplateFile;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to the template file embedded/packaged in the JAR file...
|
||||
return config.embeddedTemplateDir() + File.separator + templateFile;
|
||||
}
|
||||
}
|
||||
|
||||
public String readResourceContents(String resourceFilePath) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -119,6 +119,8 @@ public interface CodegenConfig {
|
||||
|
||||
Set<String> languageSpecificPrimitives();
|
||||
|
||||
Map<String, String> reservedWordsMappings();
|
||||
|
||||
void preprocessSwagger(Swagger swagger);
|
||||
|
||||
void processSwagger(Swagger swagger);
|
||||
@ -197,4 +199,8 @@ public interface CodegenConfig {
|
||||
String getHttpUserAgent();
|
||||
|
||||
String getCommonTemplateDir();
|
||||
|
||||
void setIgnoreFilePathOverride(String ignoreFileOverride);
|
||||
|
||||
String getIgnoreFilePathOverride();
|
||||
}
|
||||
|
@ -12,10 +12,21 @@ public class CodegenConstants {
|
||||
|
||||
public static final String TEMPLATE_DIR = "templateDir";
|
||||
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS = "allowUnicodeIdentifiers";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_DESC = "boolean, toggles whether unicode identifiers are allowed in names or not, default is false";
|
||||
|
||||
public static final String INVOKER_PACKAGE = "invokerPackage";
|
||||
public static final String INVOKER_PACKAGE_DESC = "root package for generated code";
|
||||
|
||||
public static final String PHP_INVOKER_PACKAGE = "phpInvokerPackage";
|
||||
public static final String PHP_INVOKER_PACKAGE_DESC = "root package for generated php code";
|
||||
|
||||
public static final String PERL_MODULE_NAME = "perlModuleName";
|
||||
public static final String PERL_MODULE_NAME_DESC = "root module name for generated perl code";
|
||||
|
||||
public static final String PYTHON_PACKAGE_NAME = "pythonPackageName";
|
||||
public static final String PYTHON_PACKAGE_NAME_DESC = "package name for generated python code";
|
||||
|
||||
public static final String GROUP_ID = "groupId";
|
||||
public static final String GROUP_ID_DESC = "groupId in generated pom.xml";
|
||||
|
||||
@ -25,6 +36,39 @@ public class CodegenConstants {
|
||||
public static final String ARTIFACT_VERSION = "artifactVersion";
|
||||
public static final String ARTIFACT_VERSION_DESC = "artifact version in generated pom.xml";
|
||||
|
||||
public static final String ARTIFACT_URL = "artifactUrl";
|
||||
public static final String ARTIFACT_URL_DESC = "artifact URL in generated pom.xml";
|
||||
|
||||
public static final String ARTIFACT_DESCRIPTION = "artifactDescription";
|
||||
public static final String ARTIFACT_DESCRIPTION_DESC = "artifact description in generated pom.xml";
|
||||
|
||||
public static final String SCM_CONNECTION = "scmConnection";
|
||||
public static final String SCM_CONNECTION_DESC = "SCM connection in generated pom.xml";
|
||||
|
||||
public static final String SCM_DEVELOPER_CONNECTION = "scmDeveloperConnection";
|
||||
public static final String SCM_DEVELOPER_CONNECTION_DESC = "SCM developer connection in generated pom.xml";
|
||||
|
||||
public static final String SCM_URL = "scmUrl";
|
||||
public static final String SCM_URL_DESC = "SCM URL in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_NAME = "developerName";
|
||||
public static final String DEVELOPER_NAME_DESC = "developer name in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_EMAIL = "developerEmail";
|
||||
public static final String DEVELOPER_EMAIL_DESC = "developer email in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_ORGANIZATION = "developerOrganization";
|
||||
public static final String DEVELOPER_ORGANIZATION_DESC = "developer organization in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_ORGANIZATION_URL = "developerOrganizationUrl";
|
||||
public static final String DEVELOPER_ORGANIZATION_URL_DESC = "developer organization URL in generated pom.xml";
|
||||
|
||||
public static final String LICENSE_NAME = "licenseName";
|
||||
public static final String LICENSE_NAME_DESC = "The name of the license";
|
||||
|
||||
public static final String LICENSE_URL = "licenseUrl";
|
||||
public static final String LICENSE_URL_DESC = "The URL of the license";
|
||||
|
||||
public static final String SOURCE_FOLDER = "sourceFolder";
|
||||
public static final String SOURCE_FOLDER_DESC = "source folder for generated code";
|
||||
|
||||
@ -77,6 +121,9 @@ public class CodegenConstants {
|
||||
public static final String USE_COLLECTION = "useCollection";
|
||||
public static final String USE_COLLECTION_DESC = "Deserialize array types to Collection<T> instead of List<T>.";
|
||||
|
||||
public static final String INTERFACE_PREFIX = "interfacePrefix";
|
||||
public static final String INTERFACE_PREFIX_DESC = "Prefix interfaces with a community standard or widely accepted prefix.";
|
||||
|
||||
public static final String RETURN_ICOLLECTION = "returnICollection";
|
||||
public static final String RETURN_ICOLLECTION_DESC = "Return ICollection<T> instead of the concrete type.";
|
||||
|
||||
@ -128,9 +175,15 @@ public class CodegenConstants {
|
||||
public static final String GENERATE_MODEL_TESTS_DESC = "Specifies that model tests are to be generated.";
|
||||
|
||||
public static final String HIDE_GENERATION_TIMESTAMP = "hideGenerationTimestamp";
|
||||
public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp.";
|
||||
public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp when files are generated.";
|
||||
|
||||
public static final String GENERATE_PROPERTY_CHANGED = "generatePropertyChanged";
|
||||
public static final String GENERATE_PROPERTY_CHANGED_DESC = "Specifies that models support raising property changed events.";
|
||||
|
||||
public static final String NON_PUBLIC_API = "nonPublicApi";
|
||||
public static final String NON_PUBLIC_API_DESC = "Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.";
|
||||
|
||||
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
|
||||
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation.";
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class CodegenModel {
|
||||
public Set<String> allMandatory;
|
||||
|
||||
public Set<String> imports = new TreeSet<String>();
|
||||
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, isArrayModel, hasChildren;
|
||||
public Boolean hasOnlyReadOnly = true; // true if all properties are read-only
|
||||
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, isArrayModel, hasChildren;
|
||||
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
|
||||
public ExternalDocs externalDocs;
|
||||
|
||||
public Map<String, Object> vendorExtensions;
|
||||
@ -115,15 +115,15 @@ public class CodegenModel {
|
||||
return false;
|
||||
if (imports != null ? !imports.equals(that.imports) : that.imports != null)
|
||||
return false;
|
||||
if (hasVars != null ? !hasVars.equals(that.hasVars) : that.hasVars != null)
|
||||
if (hasVars != that.hasVars)
|
||||
return false;
|
||||
if (emptyVars != null ? !emptyVars.equals(that.emptyVars) : that.emptyVars != null)
|
||||
if (emptyVars != that.emptyVars)
|
||||
return false;
|
||||
if (hasMoreModels != null ? !hasMoreModels.equals(that.hasMoreModels) : that.hasMoreModels != null)
|
||||
if (hasMoreModels != that.hasMoreModels)
|
||||
return false;
|
||||
if (hasEnums != null ? !hasEnums.equals(that.hasEnums) : that.hasEnums != null)
|
||||
if (hasEnums != that.hasEnums)
|
||||
return false;
|
||||
if (isEnum != null ? !isEnum.equals(that.isEnum) : that.isEnum != null)
|
||||
if (isEnum != that.isEnum)
|
||||
return false;
|
||||
if (externalDocs != null ? !externalDocs.equals(that.externalDocs) : that.externalDocs != null)
|
||||
return false;
|
||||
@ -163,11 +163,11 @@ public class CodegenModel {
|
||||
result = 31 * result + (mandatory != null ? mandatory.hashCode() : 0);
|
||||
result = 31 * result + (allMandatory != null ? allMandatory.hashCode() : 0);
|
||||
result = 31 * result + (imports != null ? imports.hashCode() : 0);
|
||||
result = 31 * result + (hasVars != null ? hasVars.hashCode() : 0);
|
||||
result = 31 * result + (emptyVars != null ? emptyVars.hashCode() : 0);
|
||||
result = 31 * result + (hasMoreModels != null ? hasMoreModels.hashCode() : 0);
|
||||
result = 31 * result + (hasEnums != null ? hasEnums.hashCode() : 0);
|
||||
result = 31 * result + (isEnum != null ? isEnum.hashCode() : 0);
|
||||
result = 31 * result + (hasVars ? 13:31);
|
||||
result = 31 * result + (emptyVars ? 13:31);
|
||||
result = 31 * result + (hasMoreModels ? 13:31);
|
||||
result = 31 * result + (hasEnums ? 13:31);
|
||||
result = 31 * result + (isEnum ? 13:31);
|
||||
result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0);
|
||||
result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0);
|
||||
result = 31 * result + Objects.hash(hasOnlyReadOnly);
|
||||
|
@ -11,10 +11,10 @@ import java.util.Arrays;
|
||||
|
||||
public class CodegenOperation {
|
||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
||||
public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
||||
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMapContainer,
|
||||
isListContainer, isMultipart, hasMore = Boolean.TRUE,
|
||||
isResponseBinary = Boolean.FALSE, hasReference = Boolean.FALSE,
|
||||
isListContainer, isMultipart, hasMore = true,
|
||||
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
isRestful;
|
||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||
@ -36,6 +36,7 @@ public class CodegenOperation {
|
||||
public Map<String, Object> vendorExtensions;
|
||||
public String nickname; // legacy support
|
||||
public String operationIdLowerCase; // for mardown documentation
|
||||
public String operationIdCamelCase; // for class names
|
||||
|
||||
/**
|
||||
* Check if there's at least one parameter
|
||||
@ -189,33 +190,35 @@ public class CodegenOperation {
|
||||
|
||||
if (responseHeaders != null ? !responseHeaders.equals(that.responseHeaders) : that.responseHeaders != null)
|
||||
return false;
|
||||
if (hasAuthMethods != null ? !hasAuthMethods.equals(that.hasAuthMethods) : that.hasAuthMethods != null)
|
||||
if (hasAuthMethods != that.hasAuthMethods)
|
||||
return false;
|
||||
if (hasConsumes != null ? !hasConsumes.equals(that.hasConsumes) : that.hasConsumes != null)
|
||||
if (hasConsumes != that.hasConsumes)
|
||||
return false;
|
||||
if (hasProduces != null ? !hasProduces.equals(that.hasProduces) : that.hasProduces != null)
|
||||
if (hasProduces != that.hasProduces)
|
||||
return false;
|
||||
if (hasParams != null ? !hasParams.equals(that.hasParams) : that.hasParams != null)
|
||||
if (hasParams != that.hasParams)
|
||||
return false;
|
||||
if (hasOptionalParams != null ? !hasOptionalParams.equals(that.hasOptionalParams) : that.hasOptionalParams != null)
|
||||
if (hasOptionalParams != that.hasOptionalParams)
|
||||
return false;
|
||||
if (returnTypeIsPrimitive != null ? !returnTypeIsPrimitive.equals(that.returnTypeIsPrimitive) : that.returnTypeIsPrimitive != null)
|
||||
if (returnTypeIsPrimitive != that.returnTypeIsPrimitive)
|
||||
return false;
|
||||
if (returnSimpleType != null ? !returnSimpleType.equals(that.returnSimpleType) : that.returnSimpleType != null)
|
||||
if (returnSimpleType != that.returnSimpleType)
|
||||
return false;
|
||||
if (subresourceOperation != null ? !subresourceOperation.equals(that.subresourceOperation) : that.subresourceOperation != null)
|
||||
if (subresourceOperation != that.subresourceOperation)
|
||||
return false;
|
||||
if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null)
|
||||
if (isMapContainer != that.isMapContainer)
|
||||
return false;
|
||||
if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null)
|
||||
if (isListContainer != that.isListContainer)
|
||||
return false;
|
||||
if (isMultipart != null ? !isMultipart.equals(that.isMultipart) : that.isMultipart != null)
|
||||
if (isMultipart != that.isMultipart)
|
||||
return false;
|
||||
if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null)
|
||||
if (hasMore != that.hasMore)
|
||||
return false;
|
||||
if (isResponseBinary != null ? !isResponseBinary.equals(that.isResponseBinary) : that.isResponseBinary != null)
|
||||
if (isResponseBinary != that.isResponseBinary)
|
||||
return false;
|
||||
if (hasReference != null ? !hasReference.equals(that.hasReference) : that.hasReference != null)
|
||||
if (hasReference != that.hasReference)
|
||||
return false;
|
||||
if (isResponseFile != that.isResponseFile)
|
||||
return false;
|
||||
if (path != null ? !path.equals(that.path) : that.path != null)
|
||||
return false;
|
||||
@ -277,27 +280,30 @@ public class CodegenOperation {
|
||||
return false;
|
||||
if ( prioritizedContentTypes != null ? !prioritizedContentTypes.equals(that.prioritizedContentTypes) : that.prioritizedContentTypes != null )
|
||||
return false;
|
||||
return operationIdLowerCase != null ? operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase == null;
|
||||
if ( operationIdLowerCase != null ? !operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase != null )
|
||||
return false;
|
||||
return operationIdCamelCase != null ? operationIdCamelCase.equals(that.operationIdCamelCase) : that.operationIdCamelCase == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = responseHeaders.hashCode();
|
||||
result = 31 * result + (hasAuthMethods != null ? hasAuthMethods.hashCode() : 0);
|
||||
result = 31 * result + (hasConsumes != null ? hasConsumes.hashCode() : 0);
|
||||
result = 31 * result + (hasProduces != null ? hasProduces.hashCode() : 0);
|
||||
result = 31 * result + (hasParams != null ? hasParams.hashCode() : 0);
|
||||
result = 31 * result + (hasOptionalParams != null ? hasOptionalParams.hashCode() : 0);
|
||||
result = 31 * result + (returnTypeIsPrimitive != null ? returnTypeIsPrimitive.hashCode() : 0);
|
||||
result = 31 * result + (returnSimpleType != null ? returnSimpleType.hashCode() : 0);
|
||||
result = 31 * result + (subresourceOperation != null ? subresourceOperation.hashCode() : 0);
|
||||
result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0);
|
||||
result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0);
|
||||
result = 31 * result + (isMultipart != null ? isMultipart.hashCode() : 0);
|
||||
result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0);
|
||||
result = 31 * result + (isResponseBinary != null ? isResponseBinary.hashCode() : 0);
|
||||
result = 31 * result + (hasReference != null ? hasReference.hashCode() : 0);
|
||||
result = 31 * result + (hasAuthMethods ? 13:31);
|
||||
result = 31 * result + (hasConsumes ? 13:31);
|
||||
result = 31 * result + (hasProduces ? 13:31);
|
||||
result = 31 * result + (hasParams ? 13:31);
|
||||
result = 31 * result + (hasOptionalParams ? 13:31);
|
||||
result = 31 * result + (returnTypeIsPrimitive ? 13:31);
|
||||
result = 31 * result + (returnSimpleType ? 13:31);
|
||||
result = 31 * result + (subresourceOperation ? 13:31);
|
||||
result = 31 * result + (isMapContainer ? 13:31);
|
||||
result = 31 * result + (isListContainer ? 13:31);
|
||||
result = 31 * result + (isMultipart ? 13:31);
|
||||
result = 31 * result + (hasMore ? 13:31);
|
||||
result = 31 * result + (isResponseBinary ? 13:31);
|
||||
result = 31 * result + (isResponseFile ? 13:31);
|
||||
result = 31 * result + (hasReference ? 13:31);
|
||||
result = 31 * result + (path != null ? path.hashCode() : 0);
|
||||
result = 31 * result + (operationId != null ? operationId.hashCode() : 0);
|
||||
result = 31 * result + (returnType != null ? returnType.hashCode() : 0);
|
||||
@ -329,6 +335,7 @@ public class CodegenOperation {
|
||||
result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
|
||||
result = 31 * result + (prioritizedContentTypes != null ? prioritizedContentTypes.hashCode() : 0);
|
||||
result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0);
|
||||
result = 31 * result + (operationIdCamelCase != null ? operationIdCamelCase.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -6,45 +6,47 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public class CodegenParameter {
|
||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
public boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
isCookieParam, isBodyParam, hasMore, isContainer,
|
||||
secondaryParam, isCollectionFormatMulti, isPrimitiveType;
|
||||
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName;
|
||||
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat,
|
||||
collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName;
|
||||
|
||||
public String example; // example value (x-example)
|
||||
public String jsonSchema;
|
||||
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||
public Boolean isListContainer, isMapContainer;
|
||||
public Boolean isFile, notFile;
|
||||
public boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||
public boolean isListContainer, isMapContainer;
|
||||
public boolean isFile, notFile;
|
||||
public boolean isEnum;
|
||||
public List<String> _enum;
|
||||
public Map<String, Object> allowableValues;
|
||||
public CodegenProperty items;
|
||||
public Map<String, Object> vendorExtensions;
|
||||
public Boolean hasValidation;
|
||||
public boolean hasValidation;
|
||||
|
||||
/**
|
||||
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
||||
* this property is required and its value MUST be true. Otherwise, the property
|
||||
* MAY be included and its default value is false.
|
||||
*/
|
||||
public Boolean required;
|
||||
public boolean required;
|
||||
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17.
|
||||
*/
|
||||
public Number maximum;
|
||||
public String maximum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17
|
||||
*/
|
||||
public Boolean exclusiveMaximum;
|
||||
public boolean exclusiveMaximum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
public Number minimum;
|
||||
public String minimum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
public Boolean exclusiveMinimum;
|
||||
public boolean exclusiveMinimum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor26
|
||||
*/
|
||||
@ -68,7 +70,7 @@ public class CodegenParameter {
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor49
|
||||
*/
|
||||
public Boolean uniqueItems;
|
||||
public boolean uniqueItems;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
|
||||
*/
|
||||
@ -90,6 +92,7 @@ public class CodegenParameter {
|
||||
output.collectionFormat = this.collectionFormat;
|
||||
output.isCollectionFormatMulti = this.isCollectionFormatMulti;
|
||||
output.description = this.description;
|
||||
output.unescapedDescription = this.unescapedDescription;
|
||||
output.baseType = this.baseType;
|
||||
output.isFormParam = this.isFormParam;
|
||||
output.isQueryParam = this.isQueryParam;
|
||||
@ -155,27 +158,27 @@ public class CodegenParameter {
|
||||
CodegenParameter that = (CodegenParameter) o;
|
||||
|
||||
if (isEnum != that.isEnum) return false;
|
||||
if (isFormParam != null ? !isFormParam.equals(that.isFormParam) : that.isFormParam != null)
|
||||
if (isFormParam != that.isFormParam)
|
||||
return false;
|
||||
if (isQueryParam != null ? !isQueryParam.equals(that.isQueryParam) : that.isQueryParam != null)
|
||||
if (isQueryParam != that.isQueryParam)
|
||||
return false;
|
||||
if (isPathParam != null ? !isPathParam.equals(that.isPathParam) : that.isPathParam != null)
|
||||
if (isPathParam != that.isPathParam)
|
||||
return false;
|
||||
if (isHeaderParam != null ? !isHeaderParam.equals(that.isHeaderParam) : that.isHeaderParam != null)
|
||||
if (isHeaderParam != that.isHeaderParam)
|
||||
return false;
|
||||
if (isCookieParam != null ? !isCookieParam.equals(that.isCookieParam) : that.isCookieParam != null)
|
||||
if (isCookieParam != that.isCookieParam)
|
||||
return false;
|
||||
if (isBodyParam != null ? !isBodyParam.equals(that.isBodyParam) : that.isBodyParam != null)
|
||||
if (isBodyParam != that.isBodyParam)
|
||||
return false;
|
||||
if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null)
|
||||
if (hasMore != that.hasMore)
|
||||
return false;
|
||||
if (isContainer != null ? !isContainer.equals(that.isContainer) : that.isContainer != null)
|
||||
if (isContainer != that.isContainer)
|
||||
return false;
|
||||
if (secondaryParam != null ? !secondaryParam.equals(that.secondaryParam) : that.secondaryParam != null)
|
||||
if (secondaryParam != that.secondaryParam)
|
||||
return false;
|
||||
if (isCollectionFormatMulti != null ? !isCollectionFormatMulti.equals(that.isCollectionFormatMulti) : that.isCollectionFormatMulti != null)
|
||||
if (isCollectionFormatMulti != that.isCollectionFormatMulti)
|
||||
return false;
|
||||
if (isPrimitiveType != null ? !isPrimitiveType.equals(that.isPrimitiveType) : that.isPrimitiveType != null)
|
||||
if (isPrimitiveType != that.isPrimitiveType)
|
||||
return false;
|
||||
if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null)
|
||||
return false;
|
||||
@ -203,33 +206,33 @@ public class CodegenParameter {
|
||||
return false;
|
||||
if (jsonSchema != null ? !jsonSchema.equals(that.jsonSchema) : that.jsonSchema != null)
|
||||
return false;
|
||||
if (isString != null ? !isString.equals(that.isString) : that.isString != null)
|
||||
if (isString != that.isString)
|
||||
return false;
|
||||
if (isInteger != null ? !isInteger.equals(that.isInteger) : that.isInteger != null)
|
||||
if (isInteger != that.isInteger)
|
||||
return false;
|
||||
if (isLong != null ? !isLong.equals(that.isLong) : that.isLong != null)
|
||||
if (isLong != that.isLong)
|
||||
return false;
|
||||
if (isFloat != null ? !isFloat.equals(that.isFloat) : that.isFloat != null)
|
||||
if (isFloat != that.isFloat)
|
||||
return false;
|
||||
if (isDouble != null ? !isDouble.equals(that.isDouble) : that.isDouble != null)
|
||||
if (isDouble != that.isDouble)
|
||||
return false;
|
||||
if (isByteArray != null ? !isByteArray.equals(that.isByteArray) : that.isByteArray != null)
|
||||
if (isByteArray != that.isByteArray)
|
||||
return false;
|
||||
if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null)
|
||||
if (isBinary != that.isBinary)
|
||||
return false;
|
||||
if (isBoolean != null ? !isBoolean.equals(that.isBoolean) : that.isBoolean != null)
|
||||
if (isBoolean != that.isBoolean)
|
||||
return false;
|
||||
if (isDate != null ? !isDate.equals(that.isDate) : that.isDate != null)
|
||||
if (isDate != that.isDate)
|
||||
return false;
|
||||
if (isDateTime != null ? !isDateTime.equals(that.isDateTime) : that.isDateTime != null)
|
||||
if (isDateTime != that.isDateTime)
|
||||
return false;
|
||||
if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null)
|
||||
if (isListContainer != that.isListContainer)
|
||||
return false;
|
||||
if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null)
|
||||
if (isMapContainer != that.isMapContainer)
|
||||
return false;
|
||||
if (isFile != null ? !isFile.equals(that.isFile) : that.isFile != null)
|
||||
if (isFile != that.isFile)
|
||||
return false;
|
||||
if (notFile != null ? !notFile.equals(that.notFile) : that.notFile != null)
|
||||
if (notFile != that.notFile)
|
||||
return false;
|
||||
if (_enum != null ? !_enum.equals(that._enum) : that._enum != null)
|
||||
return false;
|
||||
@ -239,17 +242,17 @@ public class CodegenParameter {
|
||||
return false;
|
||||
if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null)
|
||||
return false;
|
||||
if (hasValidation != null ? !hasValidation.equals(that.hasValidation) : that.hasValidation != null)
|
||||
if (hasValidation != that.hasValidation)
|
||||
return false;
|
||||
if (required != null ? !required.equals(that.required) : that.required != null)
|
||||
if (required != that.required)
|
||||
return false;
|
||||
if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null)
|
||||
return false;
|
||||
if (exclusiveMaximum != null ? !exclusiveMaximum.equals(that.exclusiveMaximum) : that.exclusiveMaximum != null)
|
||||
if (exclusiveMaximum != that.exclusiveMaximum)
|
||||
return false;
|
||||
if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null)
|
||||
return false;
|
||||
if (exclusiveMinimum != null ? !exclusiveMinimum.equals(that.exclusiveMinimum) : that.exclusiveMinimum != null)
|
||||
if (exclusiveMinimum != that.exclusiveMinimum)
|
||||
return false;
|
||||
if (maxLength != null ? !maxLength.equals(that.maxLength) : that.maxLength != null)
|
||||
return false;
|
||||
@ -261,7 +264,7 @@ public class CodegenParameter {
|
||||
return false;
|
||||
if (minItems != null ? !minItems.equals(that.minItems) : that.minItems != null)
|
||||
return false;
|
||||
if (uniqueItems != null ? !uniqueItems.equals(that.uniqueItems) : that.uniqueItems != null)
|
||||
if (uniqueItems != that.uniqueItems)
|
||||
return false;
|
||||
return multipleOf != null ? multipleOf.equals(that.multipleOf) : that.multipleOf == null;
|
||||
|
||||
@ -269,17 +272,17 @@ public class CodegenParameter {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = isFormParam != null ? isFormParam.hashCode() : 0;
|
||||
result = 31 * result + (isQueryParam != null ? isQueryParam.hashCode() : 0);
|
||||
result = 31 * result + (isPathParam != null ? isPathParam.hashCode() : 0);
|
||||
result = 31 * result + (isHeaderParam != null ? isHeaderParam.hashCode() : 0);
|
||||
result = 31 * result + (isCookieParam != null ? isCookieParam.hashCode() : 0);
|
||||
result = 31 * result + (isBodyParam != null ? isBodyParam.hashCode() : 0);
|
||||
result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0);
|
||||
result = 31 * result + (isContainer != null ? isContainer.hashCode() : 0);
|
||||
result = 31 * result + (secondaryParam != null ? secondaryParam.hashCode() : 0);
|
||||
result = 31 * result + (isCollectionFormatMulti != null ? isCollectionFormatMulti.hashCode() : 0);
|
||||
result = 31 * result + (isPrimitiveType != null ? isPrimitiveType.hashCode() : 0);
|
||||
int result = isFormParam ? 13:31;
|
||||
result = 31 * result + (isQueryParam ? 13:31);
|
||||
result = 31 * result + (isPathParam ? 13:31);
|
||||
result = 31 * result + (isHeaderParam ? 13:31);
|
||||
result = 31 * result + (isCookieParam ? 13:31);
|
||||
result = 31 * result + (isBodyParam ? 13:31);
|
||||
result = 31 * result + (hasMore ? 13:31);
|
||||
result = 31 * result + (isContainer ? 13:31);
|
||||
result = 31 * result + (secondaryParam ? 13:31);
|
||||
result = 31 * result + (isCollectionFormatMulti ? 13:31);
|
||||
result = 31 * result + (isPrimitiveType ? 13:31);
|
||||
result = 31 * result + (baseName != null ? baseName.hashCode() : 0);
|
||||
result = 31 * result + (paramName != null ? paramName.hashCode() : 0);
|
||||
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
|
||||
@ -293,37 +296,37 @@ public class CodegenParameter {
|
||||
result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0);
|
||||
result = 31 * result + (example != null ? example.hashCode() : 0);
|
||||
result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0);
|
||||
result = 31 * result + (isString != null ? isString.hashCode() : 0);
|
||||
result = 31 * result + (isInteger != null ? isInteger.hashCode() : 0);
|
||||
result = 31 * result + (isLong != null ? isLong.hashCode() : 0);
|
||||
result = 31 * result + (isFloat != null ? isFloat.hashCode() : 0);
|
||||
result = 31 * result + (isDouble != null ? isDouble.hashCode() : 0);
|
||||
result = 31 * result + (isByteArray != null ? isByteArray.hashCode() : 0);
|
||||
result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0);
|
||||
result = 31 * result + (isBoolean != null ? isBoolean.hashCode() : 0);
|
||||
result = 31 * result + (isDate != null ? isDate.hashCode() : 0);
|
||||
result = 31 * result + (isDateTime != null ? isDateTime.hashCode() : 0);
|
||||
result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0);
|
||||
result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0);
|
||||
result = 31 * result + (isFile != null ? isFile.hashCode() : 0);
|
||||
result = 31 * result + (notFile != null ? notFile.hashCode() : 0);
|
||||
result = 31 * result + (isString ? 13:31);
|
||||
result = 31 * result + (isInteger ? 13:31);
|
||||
result = 31 * result + (isLong ? 13:31);
|
||||
result = 31 * result + (isFloat ? 13:31);
|
||||
result = 31 * result + (isDouble ? 13:31);
|
||||
result = 31 * result + (isByteArray ? 13:31);
|
||||
result = 31 * result + (isBinary ? 13:31);
|
||||
result = 31 * result + (isBoolean ? 13:31);
|
||||
result = 31 * result + (isDate ? 13:31);
|
||||
result = 31 * result + (isDateTime ? 13:31);
|
||||
result = 31 * result + (isListContainer ? 13:31);
|
||||
result = 31 * result + (isMapContainer ? 13:31);
|
||||
result = 31 * result + (isFile ? 13:31);
|
||||
result = 31 * result + (notFile ? 13:31);
|
||||
result = 31 * result + (isEnum ? 1 : 0);
|
||||
result = 31 * result + (_enum != null ? _enum.hashCode() : 0);
|
||||
result = 31 * result + (allowableValues != null ? allowableValues.hashCode() : 0);
|
||||
result = 31 * result + (items != null ? items.hashCode() : 0);
|
||||
result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0);
|
||||
result = 31 * result + (hasValidation != null ? hasValidation.hashCode() : 0);
|
||||
result = 31 * result + (required != null ? required.hashCode() : 0);
|
||||
result = 31 * result + (hasValidation ? 13:31);
|
||||
result = 31 * result + (required ? 13:31);
|
||||
result = 31 * result + (maximum != null ? maximum.hashCode() : 0);
|
||||
result = 31 * result + (exclusiveMaximum != null ? exclusiveMaximum.hashCode() : 0);
|
||||
result = 31 * result + (exclusiveMaximum ? 13:31);
|
||||
result = 31 * result + (minimum != null ? minimum.hashCode() : 0);
|
||||
result = 31 * result + (exclusiveMinimum != null ? exclusiveMinimum.hashCode() : 0);
|
||||
result = 31 * result + (exclusiveMinimum ? 13:31);
|
||||
result = 31 * result + (maxLength != null ? maxLength.hashCode() : 0);
|
||||
result = 31 * result + (minLength != null ? minLength.hashCode() : 0);
|
||||
result = 31 * result + (pattern != null ? pattern.hashCode() : 0);
|
||||
result = 31 * result + (maxItems != null ? maxItems.hashCode() : 0);
|
||||
result = 31 * result + (minItems != null ? minItems.hashCode() : 0);
|
||||
result = 31 * result + (uniqueItems != null ? uniqueItems.hashCode() : 0);
|
||||
result = 31 * result + (uniqueItems ? 13:31);
|
||||
result = 31 * result + (multipleOf != null ? multipleOf.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
@ -7,9 +7,11 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CodegenProperty implements Cloneable {
|
||||
public String baseName, complexType, getter, setter, description, datatype, datatypeWithEnum,
|
||||
dataFormat, name, min, max, defaultValue, defaultValueWithParam, baseType, containerType;
|
||||
public String baseName, complexType, getter, setter, description, datatype,
|
||||
datatypeWithEnum, dataFormat, name, min, max, defaultValue, defaultValueWithParam,
|
||||
baseType, containerType, title;
|
||||
|
||||
/** The 'description' string without escape charcters needed by some programming languages/targets */
|
||||
public String unescapedDescription;
|
||||
|
||||
/**
|
||||
@ -30,26 +32,29 @@ public class CodegenProperty implements Cloneable {
|
||||
public String example;
|
||||
|
||||
public String jsonSchema;
|
||||
public Double minimum;
|
||||
public Double maximum;
|
||||
public Boolean exclusiveMinimum;
|
||||
public Boolean exclusiveMaximum;
|
||||
public Boolean hasMore, required, secondaryParam;
|
||||
public Boolean hasMoreNonReadOnly; // for model constructor, true if next properyt is not readonly
|
||||
public Boolean isPrimitiveType, isContainer, isNotContainer;
|
||||
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||
public Boolean isListContainer, isMapContainer;
|
||||
public String minimum;
|
||||
public String maximum;
|
||||
public boolean exclusiveMinimum;
|
||||
public boolean exclusiveMaximum;
|
||||
public boolean hasMore, required, secondaryParam;
|
||||
public boolean hasMoreNonReadOnly; // for model constructor, true if next properyt is not readonly
|
||||
public boolean isPrimitiveType, isContainer, isNotContainer;
|
||||
public boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime;
|
||||
public boolean isListContainer, isMapContainer;
|
||||
public boolean isEnum;
|
||||
public Boolean isReadOnly = false;
|
||||
public boolean isReadOnly = false;
|
||||
public List<String> _enum;
|
||||
public Map<String, Object> allowableValues;
|
||||
public CodegenProperty items;
|
||||
public Map<String, Object> vendorExtensions;
|
||||
public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
|
||||
public Boolean isInherited;
|
||||
public boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
|
||||
public boolean isInherited;
|
||||
public String nameInCamelCase; // property name in camel case
|
||||
// enum name based on the property name, usually use as a prefix (e.g. VAR_NAME) for enum name (e.g. VAR_NAME_VALUE1)
|
||||
public String enumName;
|
||||
public Integer maxItems;
|
||||
public Integer minItems;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -74,17 +79,18 @@ public class CodegenProperty implements Cloneable {
|
||||
result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
|
||||
result = prime * result + ((defaultValueWithParam == null) ? 0 : defaultValueWithParam.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
||||
result = prime * result + ((example == null) ? 0 : example.hashCode());
|
||||
result = prime * result + ((exclusiveMaximum == null) ? 0 : exclusiveMaximum.hashCode());
|
||||
result = prime * result + ((exclusiveMinimum == null) ? 0 : exclusiveMinimum.hashCode());
|
||||
result = prime * result + (exclusiveMaximum ? 13:31);
|
||||
result = prime * result + (exclusiveMinimum ? 13:31);
|
||||
result = prime * result + ((getter == null) ? 0 : getter.hashCode());
|
||||
result = prime * result + ((hasMore == null) ? 0 : hasMore.hashCode());
|
||||
result = prime * result + ((hasMoreNonReadOnly == null) ? 0 : hasMoreNonReadOnly.hashCode());
|
||||
result = prime * result + ((isContainer == null) ? 0 : isContainer.hashCode());
|
||||
result = prime * result + (hasMore ? 13:31);
|
||||
result = prime * result + ((hasMoreNonReadOnly ? 13:31));
|
||||
result = prime * result + ((isContainer ? 13:31));
|
||||
result = prime * result + (isEnum ? 1231 : 1237);
|
||||
result = prime * result + ((isNotContainer == null) ? 0 : isNotContainer.hashCode());
|
||||
result = prime * result + ((isPrimitiveType == null) ? 0 : isPrimitiveType.hashCode());
|
||||
result = prime * result + ((isReadOnly == null) ? 0 : isReadOnly.hashCode());
|
||||
result = prime * result + ((isNotContainer ? 13:31));
|
||||
result = prime * result + ((isPrimitiveType ? 13:31));
|
||||
result = prime * result + ((isReadOnly ? 13:31));
|
||||
result = prime * result + ((items == null) ? 0 : items.hashCode());
|
||||
result = prime * result + ((jsonSchema == null) ? 0 : jsonSchema.hashCode());
|
||||
result = prime * result + ((max == null) ? 0 : max.hashCode());
|
||||
@ -95,27 +101,30 @@ public class CodegenProperty implements Cloneable {
|
||||
result = prime * result + ((minimum == null) ? 0 : minimum.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((pattern == null) ? 0 : pattern.hashCode());
|
||||
result = prime * result + ((required == null) ? 0 : required.hashCode());
|
||||
result = prime * result + ((secondaryParam == null) ? 0 : secondaryParam.hashCode());
|
||||
result = prime * result + ((required ? 13:31));
|
||||
result = prime * result + ((secondaryParam ? 13:31));
|
||||
result = prime * result + ((setter == null) ? 0 : setter.hashCode());
|
||||
result = prime * result + ((unescapedDescription == null) ? 0 : unescapedDescription.hashCode());
|
||||
result = prime * result + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode());
|
||||
result = prime * result + ((hasValidation == null) ? 0 : hasValidation.hashCode());
|
||||
result = prime * result + ((isString == null) ? 0 : isString.hashCode());
|
||||
result = prime * result + ((isInteger == null) ? 0 : isInteger.hashCode());
|
||||
result = prime * result + ((isLong == null) ? 0 : isLong.hashCode());
|
||||
result = prime * result + ((isFloat == null) ? 0 : isFloat.hashCode());
|
||||
result = prime * result + ((isDouble == null) ? 0 : isDouble.hashCode());
|
||||
result = prime * result + ((isByteArray == null) ? 0 : isByteArray.hashCode());
|
||||
result = prime * result + ((isBinary == null) ? 0 : isBinary.hashCode());
|
||||
result = prime * result + ((isBoolean == null) ? 0 : isBoolean.hashCode());
|
||||
result = prime * result + ((isDate == null) ? 0 : isDate.hashCode());
|
||||
result = prime * result + ((isDateTime == null) ? 0 : isDateTime.hashCode());
|
||||
result = prime * result + ((isMapContainer == null) ? 0 : isMapContainer.hashCode());
|
||||
result = prime * result + ((isListContainer == null) ? 0 : isListContainer.hashCode());
|
||||
result = prime * result + ((hasValidation ? 13:31));
|
||||
result = prime * result + ((isString ? 13:31));
|
||||
result = prime * result + ((isInteger ? 13:31));
|
||||
result = prime * result + ((isLong ?13:31));
|
||||
result = prime * result + ((isFloat ? 13:31));
|
||||
result = prime * result + ((isDouble ? 13:31));
|
||||
result = prime * result + ((isByteArray ? 13:31));
|
||||
result = prime * result + ((isBinary ? 13:31));
|
||||
result = prime * result + ((isFile ? 13:31));
|
||||
result = prime * result + ((isBoolean ? 13:31));
|
||||
result = prime * result + ((isDate ? 13:31));
|
||||
result = prime * result + ((isDateTime ? 13:31));
|
||||
result = prime * result + ((isMapContainer ? 13:31));
|
||||
result = prime * result + ((isListContainer ? 13:31));
|
||||
result = prime * result + Objects.hashCode(isInherited);
|
||||
result = prime * result + Objects.hashCode(nameInCamelCase);
|
||||
result = prime * result + Objects.hashCode(enumName);
|
||||
result = prime * result + ((maxItems == null) ? 0 : maxItems.hashCode());
|
||||
result = prime * result + ((minItems == null) ? 0 : minItems.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -143,6 +152,9 @@ public class CodegenProperty implements Cloneable {
|
||||
if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.datatype == null) ? (other.datatype != null) : !this.datatype.equals(other.datatype)) {
|
||||
return false;
|
||||
}
|
||||
@ -191,31 +203,31 @@ public class CodegenProperty implements Cloneable {
|
||||
if (this.maximum != other.maximum && (this.maximum == null || !this.maximum.equals(other.maximum))) {
|
||||
return false;
|
||||
}
|
||||
if (this.exclusiveMinimum != other.exclusiveMinimum && (this.exclusiveMinimum == null || !this.exclusiveMinimum.equals(other.exclusiveMinimum))) {
|
||||
if (this.exclusiveMinimum != other.exclusiveMinimum) {
|
||||
return false;
|
||||
}
|
||||
if (this.exclusiveMaximum != other.exclusiveMaximum && (this.exclusiveMaximum == null || !this.exclusiveMaximum.equals(other.exclusiveMaximum))) {
|
||||
if (this.exclusiveMaximum != other.exclusiveMaximum) {
|
||||
return false;
|
||||
}
|
||||
if (this.required != other.required && (this.required == null || !this.required.equals(other.required))) {
|
||||
if (this.required != other.required) {
|
||||
return false;
|
||||
}
|
||||
if (this.secondaryParam != other.secondaryParam && (this.secondaryParam == null || !this.secondaryParam.equals(other.secondaryParam))) {
|
||||
if (this.secondaryParam != other.secondaryParam) {
|
||||
return false;
|
||||
}
|
||||
if (this.isPrimitiveType != other.isPrimitiveType && (this.isPrimitiveType == null || !this.isPrimitiveType.equals(other.isPrimitiveType))) {
|
||||
if (this.isPrimitiveType != other.isPrimitiveType) {
|
||||
return false;
|
||||
}
|
||||
if (this.isContainer != other.isContainer && (this.isContainer == null || !this.isContainer.equals(other.isContainer))) {
|
||||
if (this.isContainer != other.isContainer) {
|
||||
return false;
|
||||
}
|
||||
if (this.isNotContainer != other.isNotContainer && (this.isNotContainer == null || !this.isNotContainer.equals(other.isNotContainer))) {
|
||||
if (this.isNotContainer != other.isNotContainer) {
|
||||
return false;
|
||||
}
|
||||
if (this.isEnum != other.isEnum) {
|
||||
return false;
|
||||
}
|
||||
if (this.isReadOnly != other.isReadOnly && (this.isReadOnly == null || !this.isReadOnly.equals(other.isReadOnly))) {
|
||||
if (this.isReadOnly != other.isReadOnly) {
|
||||
return false;
|
||||
}
|
||||
if (this._enum != other._enum && (this._enum == null || !this._enum.equals(other._enum))) {
|
||||
@ -229,45 +241,48 @@ public class CodegenProperty implements Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.hasValidation != other.hasValidation && (this.hasValidation == null || !this.hasValidation.equals(other.hasValidation))) {
|
||||
if (this.hasValidation != other.hasValidation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isString != other.isString && (this.isString == null || !this.isString.equals(other.isString))) {
|
||||
if (this.isString != other.isString) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isInteger != other.isInteger && (this.isInteger == null || !this.isInteger.equals(other.isInteger))) {
|
||||
if (this.isInteger != other.isInteger) {
|
||||
return false;
|
||||
}
|
||||
if (this.isLong != other.isLong && (this.isLong == null || !this.isLong.equals(other.isLong))) {
|
||||
if (this.isLong != other.isLong) {
|
||||
return false;
|
||||
}
|
||||
if (this.isFloat != other.isFloat && (this.isFloat == null || !this.isFloat.equals(other.isFloat))) {
|
||||
if (this.isFloat != other.isFloat) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDouble != other.isDouble && (this.isDouble == null || !this.isDouble.equals(other.isDouble))) {
|
||||
if (this.isDouble != other.isDouble) {
|
||||
return false;
|
||||
}
|
||||
if (this.isByteArray != other.isByteArray && (this.isByteArray == null || !this.isByteArray.equals(other.isByteArray))) {
|
||||
if (this.isByteArray != other.isByteArray) {
|
||||
return false;
|
||||
}
|
||||
if (this.isBoolean != other.isBoolean && (this.isBoolean == null || !this.isBoolean.equals(other.isBoolean))) {
|
||||
if (this.isBoolean != other.isBoolean) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDate != other.isDate && (this.isDate == null || !this.isDate.equals(other.isDate))) {
|
||||
if (this.isDate != other.isDate) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDateTime != other.isDateTime && (this.isDateTime == null || !this.isDateTime.equals(other.isDateTime))) {
|
||||
if (this.isDateTime != other.isDateTime) {
|
||||
return false;
|
||||
}
|
||||
if (this.isBinary != other.isBinary && (this.isBinary == null || !this.isBinary.equals(other.isBinary))) {
|
||||
if (this.isBinary != other.isBinary) {
|
||||
return false;
|
||||
}
|
||||
if (this.isListContainer != other.isListContainer && (this.isListContainer == null || !this.isListContainer.equals(other.isListContainer))) {
|
||||
if (this.isFile != other.isFile) {
|
||||
return false;
|
||||
}
|
||||
if (this.isMapContainer != other.isMapContainer && (this.isMapContainer == null || !this.isMapContainer.equals(other.isMapContainer))) {
|
||||
if (this.isListContainer != other.isListContainer) {
|
||||
return false;
|
||||
}
|
||||
if (this.isMapContainer != other.isMapContainer) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.isInherited, other.isInherited)) {
|
||||
@ -279,6 +294,12 @@ public class CodegenProperty implements Cloneable {
|
||||
if (!Objects.equals(this.enumName, other.enumName)) {
|
||||
return false;
|
||||
}
|
||||
if (this.maxItems != other.maxItems && (this.maxItems == null || !this.maxItems.equals(other.maxItems))) {
|
||||
return false;
|
||||
}
|
||||
if (this.minItems != other.minItems && (this.minItems == null || !this.minItems.equals(other.minItems))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7,21 +7,21 @@ import java.util.Map;
|
||||
public class CodegenResponse {
|
||||
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||
public String code, message;
|
||||
public Boolean hasMore;
|
||||
public boolean hasMore;
|
||||
public List<Map<String, Object>> examples;
|
||||
public String dataType, baseType, containerType;
|
||||
public Boolean isDefault;
|
||||
public Boolean simpleType;
|
||||
public Boolean primitiveType;
|
||||
public Boolean isMapContainer;
|
||||
public Boolean isListContainer;
|
||||
public Boolean isBinary = Boolean.FALSE;
|
||||
public boolean hasHeaders;
|
||||
public boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBoolean, isDate, isDateTime;
|
||||
public boolean isDefault;
|
||||
public boolean simpleType;
|
||||
public boolean primitiveType;
|
||||
public boolean isMapContainer;
|
||||
public boolean isListContainer;
|
||||
public boolean isBinary = false;
|
||||
public boolean isFile = false;
|
||||
public Object schema;
|
||||
public String jsonSchema;
|
||||
|
||||
public boolean isWildcard() {
|
||||
return "0".equals(code) || "default".equals(code);
|
||||
}
|
||||
public Map<String, Object> vendorExtensions;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -41,7 +41,7 @@ public class CodegenResponse {
|
||||
return false;
|
||||
if (message != null ? !message.equals(that.message) : that.message != null)
|
||||
return false;
|
||||
if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null)
|
||||
if (hasMore != that.hasMore)
|
||||
return false;
|
||||
if (examples != null ? !examples.equals(that.examples) : that.examples != null)
|
||||
return false;
|
||||
@ -51,20 +51,24 @@ public class CodegenResponse {
|
||||
return false;
|
||||
if (containerType != null ? !containerType.equals(that.containerType) : that.containerType != null)
|
||||
return false;
|
||||
if (isDefault != null ? !isDefault.equals(that.isDefault) : that.isDefault != null)
|
||||
if (isDefault != that.isDefault)
|
||||
return false;
|
||||
if (simpleType != null ? !simpleType.equals(that.simpleType) : that.simpleType != null)
|
||||
if (simpleType != that.simpleType)
|
||||
return false;
|
||||
if (primitiveType != null ? !primitiveType.equals(that.primitiveType) : that.primitiveType != null)
|
||||
if (primitiveType != that.primitiveType)
|
||||
return false;
|
||||
if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null)
|
||||
if (isMapContainer != that.isMapContainer)
|
||||
return false;
|
||||
if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null)
|
||||
if (isListContainer != that.isListContainer)
|
||||
return false;
|
||||
if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null)
|
||||
if (isBinary != that.isBinary)
|
||||
return false;
|
||||
if (isFile != that.isFile)
|
||||
return false;
|
||||
if (schema != null ? !schema.equals(that.schema) : that.schema != null)
|
||||
return false;
|
||||
if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null)
|
||||
return false;
|
||||
return jsonSchema != null ? jsonSchema.equals(that.jsonSchema) : that.jsonSchema == null;
|
||||
|
||||
}
|
||||
@ -74,19 +78,21 @@ public class CodegenResponse {
|
||||
int result = headers.hashCode();
|
||||
result = 31 * result + (code != null ? code.hashCode() : 0);
|
||||
result = 31 * result + (message != null ? message.hashCode() : 0);
|
||||
result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0);
|
||||
result = 31 * result + (hasMore ? 13:31);
|
||||
result = 31 * result + (examples != null ? examples.hashCode() : 0);
|
||||
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
|
||||
result = 31 * result + (baseType != null ? baseType.hashCode() : 0);
|
||||
result = 31 * result + (containerType != null ? containerType.hashCode() : 0);
|
||||
result = 31 * result + (isDefault != null ? isDefault.hashCode() : 0);
|
||||
result = 31 * result + (simpleType != null ? simpleType.hashCode() : 0);
|
||||
result = 31 * result + (primitiveType != null ? primitiveType.hashCode() : 0);
|
||||
result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0);
|
||||
result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0);
|
||||
result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0);
|
||||
result = 31 * result + (isDefault ? 13:31);
|
||||
result = 31 * result + (simpleType ? 13:31);
|
||||
result = 31 * result + (primitiveType ? 13:31);
|
||||
result = 31 * result + (isMapContainer ? 13:31);
|
||||
result = 31 * result + (isListContainer ? 13:31);
|
||||
result = 31 * result + (isBinary ? 13:31);
|
||||
result = 31 * result + (isFile ? 13:31);
|
||||
result = 31 * result + (schema != null ? schema.hashCode() : 0);
|
||||
result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0);
|
||||
result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DecimalProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
import io.swagger.models.properties.FileProperty;
|
||||
import io.swagger.models.properties.FloatProperty;
|
||||
import io.swagger.models.properties.IntegerProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
@ -91,6 +92,7 @@ public class DefaultCodegen {
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<String, String>();
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected String commonTemplateDir = "_common";
|
||||
@ -105,6 +107,7 @@ public class DefaultCodegen {
|
||||
protected String library;
|
||||
protected Boolean sortParamsByRequiredFlag = true;
|
||||
protected Boolean ensureUniqueParams = true;
|
||||
protected Boolean allowUnicodeIdentifiers = false;
|
||||
protected String gitUserId, gitRepoId, releaseNote;
|
||||
protected String httpUserAgent;
|
||||
protected Boolean hideGenerationTimestamp = true;
|
||||
@ -113,6 +116,8 @@ public class DefaultCodegen {
|
||||
// Then translated back during JSON encoding and decoding
|
||||
protected Map<String, String> specialCharReplacements = new HashMap<String, String>();
|
||||
|
||||
protected String ignoreFilePathOverride;
|
||||
|
||||
public List<CliOption> cliOptions() {
|
||||
return cliOptions;
|
||||
}
|
||||
@ -140,6 +145,11 @@ public class DefaultCodegen {
|
||||
.get(CodegenConstants.ENSURE_UNIQUE_PARAMS).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS)) {
|
||||
this.setAllowUnicodeIdentifiers(Boolean.valueOf(additionalProperties
|
||||
.get(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS).toString()));
|
||||
}
|
||||
|
||||
if(additionalProperties.containsKey(CodegenConstants.MODEL_NAME_PREFIX)){
|
||||
this.setModelNamePrefix((String) additionalProperties.get(CodegenConstants.MODEL_NAME_PREFIX));
|
||||
}
|
||||
@ -147,7 +157,6 @@ public class DefaultCodegen {
|
||||
if(additionalProperties.containsKey(CodegenConstants.MODEL_NAME_SUFFIX)){
|
||||
this.setModelNameSuffix((String) additionalProperties.get(CodegenConstants.MODEL_NAME_SUFFIX));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// override with any special post-processing for all models
|
||||
@ -184,12 +193,18 @@ public class DefaultCodegen {
|
||||
for (String name : allModels.keySet()) {
|
||||
CodegenModel cm = allModels.get(name);
|
||||
CodegenModel parent = allModels.get(cm.parent);
|
||||
// if a discriminator exists on the parent, don't add this child to the inheritance heirarchy
|
||||
// TODO Determine what to do if the parent discriminator name == the grandparent discriminator name
|
||||
while (parent != null) {
|
||||
if (parent.children == null) {
|
||||
parent.children = new ArrayList<CodegenModel>();
|
||||
}
|
||||
parent.children.add(cm);
|
||||
if (parent.discriminator == null) {
|
||||
parent = allModels.get(parent.parent);
|
||||
} else {
|
||||
parent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,6 +317,10 @@ public class DefaultCodegen {
|
||||
* @return the sanitized variable name for enum
|
||||
*/
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
if (value.length() == 0) {
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
@ -464,6 +483,10 @@ public class DefaultCodegen {
|
||||
return modelDocTemplateFiles;
|
||||
}
|
||||
|
||||
public Map<String, String> reservedWordsMappings() {
|
||||
return reservedWordsMappings;
|
||||
}
|
||||
|
||||
public Map<String, String> apiTestTemplateFiles() {
|
||||
return apiTestTemplateFiles;
|
||||
}
|
||||
@ -564,6 +587,10 @@ public class DefaultCodegen {
|
||||
this.ensureUniqueParams = ensureUniqueParams;
|
||||
}
|
||||
|
||||
public void setAllowUnicodeIdentifiers(Boolean allowUnicodeIdentifiers) {
|
||||
this.allowUnicodeIdentifiers = allowUnicodeIdentifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
|
||||
*
|
||||
@ -783,6 +810,8 @@ public class DefaultCodegen {
|
||||
typeMapping.put("integer", "Integer");
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
typeMapping.put("binary", "byte[]");
|
||||
typeMapping.put("file", "File");
|
||||
typeMapping.put("UUID", "UUID");
|
||||
|
||||
|
||||
instantiationTypes = new HashMap<String, String>();
|
||||
@ -817,6 +846,10 @@ public class DefaultCodegen {
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
|
||||
.ENSURE_UNIQUE_PARAMS_DESC).defaultValue(Boolean.TRUE.toString()));
|
||||
|
||||
//name formatting options
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, CodegenConstants
|
||||
.ALLOW_UNICODE_IDENTIFIERS_DESC).defaultValue(Boolean.FALSE.toString()));
|
||||
|
||||
// initialize special character mapping
|
||||
initalizeSpecialCharacterMapping();
|
||||
}
|
||||
@ -1087,6 +1120,8 @@ public class DefaultCodegen {
|
||||
datatype = "ByteArray";
|
||||
} else if (p instanceof BinaryProperty) {
|
||||
datatype = "binary";
|
||||
} else if (p instanceof FileProperty) {
|
||||
datatype = "file";
|
||||
} else if (p instanceof BooleanProperty) {
|
||||
datatype = "boolean";
|
||||
} else if (p instanceof DateProperty) {
|
||||
@ -1189,7 +1224,8 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the proper model name (capitalized)
|
||||
* Output the proper model name (capitalized).
|
||||
* In case the name belongs to the TypeSystem it won't be renamed.
|
||||
*
|
||||
* @param name the name of the model
|
||||
* @return capitalized model name
|
||||
@ -1241,7 +1277,6 @@ public class DefaultCodegen {
|
||||
if (model instanceof ArrayModel) {
|
||||
ArrayModel am = (ArrayModel) model;
|
||||
ArrayProperty arrayProperty = new ArrayProperty(am.getItems());
|
||||
m.hasEnums = false; // Otherwise there will be a NullPointerException in JavaClientCodegen.fromModel
|
||||
m.isArrayModel = true;
|
||||
m.arrayModelType = fromProperty(name, arrayProperty).complexType;
|
||||
addParentContainer(m, name, arrayProperty);
|
||||
@ -1257,6 +1292,18 @@ public class DefaultCodegen {
|
||||
allProperties = new LinkedHashMap<String, Property>();
|
||||
allRequired = new ArrayList<String>();
|
||||
m.allVars = new ArrayList<CodegenProperty>();
|
||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||
for (Model innerModel: ((ComposedModel)model).getAllOf()) {
|
||||
if (innerModel instanceof ModelImpl) {
|
||||
if (m.discriminator == null) {
|
||||
m.discriminator = ((ModelImpl) innerModel).getDiscriminator();
|
||||
}
|
||||
if (modelImplCnt++ > 1) {
|
||||
LOGGER.warn("More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored.");
|
||||
break; // only one ModelImpl with discriminator allowed in allOf
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
allProperties = null;
|
||||
allRequired = null;
|
||||
@ -1432,22 +1479,45 @@ public class DefaultCodegen {
|
||||
property.nameInCamelCase = camelize(property.name, false);
|
||||
property.description = escapeText(p.getDescription());
|
||||
property.unescapedDescription = p.getDescription();
|
||||
property.title = p.getTitle();
|
||||
property.getter = "get" + getterAndSetterCapitalize(name);
|
||||
property.setter = "set" + getterAndSetterCapitalize(name);
|
||||
property.example = toExampleValue(p);
|
||||
String example = toExampleValue(p);
|
||||
if(!"null".equals(example)) {
|
||||
property.example = example;
|
||||
}
|
||||
property.defaultValue = toDefaultValue(p);
|
||||
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
|
||||
property.jsonSchema = Json.pretty(p);
|
||||
if (p.getReadOnly() != null) {
|
||||
property.isReadOnly = p.getReadOnly();
|
||||
}
|
||||
property.vendorExtensions = p.getVendorExtensions();
|
||||
|
||||
String type = getSwaggerType(p);
|
||||
if (p instanceof AbstractNumericProperty) {
|
||||
AbstractNumericProperty np = (AbstractNumericProperty) p;
|
||||
property.minimum = np.getMinimum();
|
||||
property.maximum = np.getMaximum();
|
||||
if (np.getMinimum() != null) {
|
||||
if (p instanceof BaseIntegerProperty) { // int, long
|
||||
property.minimum = String.valueOf(np.getMinimum().longValue());
|
||||
} else { // double, decimal
|
||||
property.minimum = String.valueOf(np.getMinimum());
|
||||
}
|
||||
}
|
||||
if (np.getMaximum() != null) {
|
||||
if (p instanceof BaseIntegerProperty) { // int, long
|
||||
property.maximum = String.valueOf(np.getMaximum().longValue());
|
||||
} else { // double, decimal
|
||||
property.maximum = String.valueOf(np.getMaximum());
|
||||
}
|
||||
}
|
||||
|
||||
if (np.getExclusiveMinimum() != null) {
|
||||
property.exclusiveMinimum = np.getExclusiveMinimum();
|
||||
}
|
||||
if (np.getExclusiveMaximum() != null) {
|
||||
property.exclusiveMaximum = np.getExclusiveMaximum();
|
||||
}
|
||||
|
||||
// check if any validation rule defined
|
||||
// exclusive* are noop without corresponding min/max
|
||||
@ -1548,6 +1618,9 @@ public class DefaultCodegen {
|
||||
if (p instanceof BinaryProperty) {
|
||||
property.isBinary = true;
|
||||
}
|
||||
if (p instanceof FileProperty) {
|
||||
property.isFile = true;
|
||||
}
|
||||
if (p instanceof UUIDProperty) {
|
||||
property.isString = true;
|
||||
}
|
||||
@ -1661,6 +1734,8 @@ public class DefaultCodegen {
|
||||
property.baseType = getSwaggerType(p);
|
||||
// handle inner property
|
||||
ArrayProperty ap = (ArrayProperty) p;
|
||||
property.maxItems = ap.getMaxItems();
|
||||
property.minItems = ap.getMinItems();
|
||||
CodegenProperty cp = fromProperty(property.name, ap.getItems());
|
||||
updatePropertyForArray(property, cp);
|
||||
} else if (p instanceof MapProperty) {
|
||||
@ -1688,6 +1763,7 @@ public class DefaultCodegen {
|
||||
LOGGER.warn("skipping invalid array property " + Json.pretty(property));
|
||||
return;
|
||||
}
|
||||
property.dataFormat = innerProperty.dataFormat;
|
||||
if (!languageSpecificPrimitives.contains(innerProperty.baseType)) {
|
||||
property.complexType = innerProperty.baseType;
|
||||
} else {
|
||||
@ -1724,6 +1800,7 @@ public class DefaultCodegen {
|
||||
property.isPrimitiveType = true;
|
||||
}
|
||||
property.items = innerProperty;
|
||||
property.dataFormat = innerProperty.dataFormat;
|
||||
// inner item is Enum
|
||||
if (isPropertyInnerMostEnum(property)) {
|
||||
// isEnum is set to true when the type is an enum
|
||||
@ -1973,9 +2050,12 @@ public class DefaultCodegen {
|
||||
}
|
||||
r.isDefault = response == methodResponse;
|
||||
op.responses.add(r);
|
||||
if (r.isBinary && r.isDefault){
|
||||
if (Boolean.TRUE.equals(r.isBinary) && Boolean.TRUE.equals(r.isDefault)){
|
||||
op.isResponseBinary = Boolean.TRUE;
|
||||
}
|
||||
if (Boolean.TRUE.equals(r.isFile) && Boolean.TRUE.equals(r.isDefault)){
|
||||
op.isResponseFile = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
op.responses.get(op.responses.size() - 1).hasMore = false;
|
||||
|
||||
@ -2010,14 +2090,14 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
if (cm.isContainer != null) {
|
||||
if (cm.isContainer) {
|
||||
op.returnContainer = cm.containerType;
|
||||
if ("map".equals(cm.containerType)) {
|
||||
op.isMapContainer = Boolean.TRUE;
|
||||
op.isMapContainer = true;
|
||||
} else if ("list".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = Boolean.TRUE;
|
||||
op.isListContainer = true;
|
||||
} else if ("array".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = Boolean.TRUE;
|
||||
op.isListContainer = true;
|
||||
}
|
||||
} else {
|
||||
op.returnSimpleType = true;
|
||||
@ -2085,7 +2165,7 @@ public class DefaultCodegen {
|
||||
} else if (param instanceof FormParameter) {
|
||||
formParams.add(p.copy());
|
||||
}
|
||||
if (p.required == null || !p.required) {
|
||||
if (!p.required) {
|
||||
op.hasOptionalParams = true;
|
||||
}
|
||||
}
|
||||
@ -2103,10 +2183,8 @@ public class DefaultCodegen {
|
||||
Collections.sort(allParams, new Comparator<CodegenParameter>() {
|
||||
@Override
|
||||
public int compare(CodegenParameter one, CodegenParameter another) {
|
||||
boolean oneRequired = one.required == null ? false : one.required;
|
||||
boolean anotherRequired = another.required == null ? false : another.required;
|
||||
if (oneRequired == anotherRequired) return 0;
|
||||
else if (oneRequired) return -1;
|
||||
if (one.required == another.required) return 0;
|
||||
else if (one.required) return -1;
|
||||
else return 1;
|
||||
}
|
||||
});
|
||||
@ -2155,7 +2233,9 @@ public class DefaultCodegen {
|
||||
r.schema = response.getSchema();
|
||||
r.examples = toExamples(response.getExamples());
|
||||
r.jsonSchema = Json.pretty(response);
|
||||
r.vendorExtensions = response.getVendorExtensions();
|
||||
addHeaders(response, r.headers);
|
||||
r.hasHeaders = !r.headers.isEmpty();
|
||||
|
||||
if (r.schema != null) {
|
||||
Property responseProperty = response.getSchema();
|
||||
@ -2174,12 +2254,38 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
r.dataType = cm.datatype;
|
||||
r.isBinary = isDataTypeBinary(cm.datatype);
|
||||
if (cm.isContainer != null) {
|
||||
|
||||
if (Boolean.TRUE.equals(cm.isString)) {
|
||||
r.isString = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isBoolean)) {
|
||||
r.isBoolean = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isLong)) {
|
||||
r.isLong = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isInteger)) {
|
||||
r.isInteger = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isDouble)) {
|
||||
r.isDouble = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isFloat)) {
|
||||
r.isFloat = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isByteArray)) {
|
||||
r.isByteArray = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isBinary)) {
|
||||
r.isBinary = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isFile)) {
|
||||
r.isFile = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isDate)) {
|
||||
r.isDate = true;
|
||||
} else if (Boolean.TRUE.equals(cm.isDateTime)) {
|
||||
r.isDateTime = true;
|
||||
} else {
|
||||
LOGGER.debug("Property type is not primitive: " + cm.datatype);
|
||||
}
|
||||
|
||||
if (cm.isContainer) {
|
||||
r.simpleType = false;
|
||||
r.containerType = cm.containerType;
|
||||
r.isMapContainer = "map".equals(cm.containerType);
|
||||
r.isListContainer = "list".equals(cm.containerType);
|
||||
r.isListContainer = "list".equalsIgnoreCase(cm.containerType) || "array".equalsIgnoreCase(cm.containerType);
|
||||
} else {
|
||||
r.simpleType = true;
|
||||
}
|
||||
@ -2212,16 +2318,25 @@ public class DefaultCodegen {
|
||||
p.jsonSchema = Json.pretty(param);
|
||||
|
||||
if (System.getProperty("debugParser") != null) {
|
||||
LOGGER.info("working on Parameter " + param);
|
||||
LOGGER.info("working on Parameter " + param.getName());
|
||||
}
|
||||
|
||||
// move the defaultValue for headers, forms and params
|
||||
if (param instanceof QueryParameter) {
|
||||
p.defaultValue = ((QueryParameter) param).getDefaultValue();
|
||||
QueryParameter qp = (QueryParameter) param;
|
||||
if(qp.getDefaultValue() != null) {
|
||||
p.defaultValue = qp.getDefaultValue().toString();
|
||||
}
|
||||
} else if (param instanceof HeaderParameter) {
|
||||
p.defaultValue = ((HeaderParameter) param).getDefaultValue();
|
||||
HeaderParameter hp = (HeaderParameter) param;
|
||||
if(hp.getDefaultValue() != null) {
|
||||
p.defaultValue = hp.getDefaultValue().toString();
|
||||
}
|
||||
} else if (param instanceof FormParameter) {
|
||||
p.defaultValue = ((FormParameter) param).getDefaultValue();
|
||||
FormParameter fp = (FormParameter) param;
|
||||
if(fp.getDefaultValue() != null) {
|
||||
p.defaultValue = fp.getDefaultValue().toString();
|
||||
}
|
||||
}
|
||||
|
||||
p.vendorExtensions = param.getVendorExtensions();
|
||||
@ -2232,7 +2347,7 @@ public class DefaultCodegen {
|
||||
String collectionFormat = null;
|
||||
String type = qp.getType();
|
||||
if (null == type) {
|
||||
LOGGER.warn("Type is NULL for Serializable Parameter: " + param);
|
||||
LOGGER.warn("Type is NULL for Serializable Parameter: " + param.getName());
|
||||
}
|
||||
if ("array".equals(type)) { // for array parameter
|
||||
Property inner = qp.getItems();
|
||||
@ -2314,16 +2429,23 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
// validation
|
||||
p.maximum = qp.getMaximum();
|
||||
p.exclusiveMaximum = qp.isExclusiveMaximum();
|
||||
p.minimum = qp.getMinimum();
|
||||
p.exclusiveMinimum = qp.isExclusiveMinimum();
|
||||
// handle maximum, minimum properly for int/long by removing the trailing ".0"
|
||||
if ("integer".equals(qp.getType())) {
|
||||
p.maximum = qp.getMaximum() == null ? null : String.valueOf(qp.getMaximum().longValue());
|
||||
p.minimum = qp.getMinimum() == null ? null : String.valueOf(qp.getMinimum().longValue());
|
||||
} else {
|
||||
p.maximum = qp.getMaximum() == null ? null : String.valueOf(qp.getMaximum());
|
||||
p.minimum = qp.getMinimum() == null ? null : String.valueOf(qp.getMinimum());
|
||||
}
|
||||
|
||||
p.exclusiveMaximum = qp.isExclusiveMaximum() == null ? false : qp.isExclusiveMaximum();
|
||||
p.exclusiveMinimum = qp.isExclusiveMinimum() == null ? false : qp.isExclusiveMinimum();
|
||||
p.maxLength = qp.getMaxLength();
|
||||
p.minLength = qp.getMinLength();
|
||||
p.pattern = toRegularExpression(qp.getPattern());
|
||||
p.maxItems = qp.getMaxItems();
|
||||
p.minItems = qp.getMinItems();
|
||||
p.uniqueItems = qp.isUniqueItems();
|
||||
p.uniqueItems = qp.isUniqueItems() == null ? false : qp.isUniqueItems();
|
||||
p.multipleOf = qp.getMultipleOf();
|
||||
|
||||
// exclusive* are noop without corresponding min/max
|
||||
@ -2345,7 +2467,7 @@ public class DefaultCodegen {
|
||||
if (model instanceof ModelImpl) {
|
||||
ModelImpl impl = (ModelImpl) model;
|
||||
CodegenModel cm = fromModel(bp.getName(), impl);
|
||||
if (cm.emptyVars != null && cm.emptyVars == false) {
|
||||
if (!cm.emptyVars) {
|
||||
p.dataType = getTypeDeclaration(cm.classname);
|
||||
imports.add(p.dataType);
|
||||
} else {
|
||||
@ -2357,6 +2479,10 @@ public class DefaultCodegen {
|
||||
p.dataType = cp.datatype;
|
||||
p.isPrimitiveType = cp.isPrimitiveType;
|
||||
p.isBinary = isDataTypeBinary(cp.datatype);
|
||||
p.isFile = isDataTypeFile(cp.datatype);
|
||||
if (cp.complexType != null) {
|
||||
imports.add(cp.complexType);
|
||||
}
|
||||
}
|
||||
|
||||
// set boolean flag (e.g. isString)
|
||||
@ -2449,6 +2575,8 @@ public class DefaultCodegen {
|
||||
p.example = "BINARY_DATA_HERE";
|
||||
} else if (Boolean.TRUE.equals(p.isByteArray)) {
|
||||
p.example = "B";
|
||||
} else if (Boolean.TRUE.equals(p.isFile)) {
|
||||
p.example = "/path/to/file.txt";
|
||||
} else if (Boolean.TRUE.equals(p.isDate)) {
|
||||
p.example = "2013-10-20";
|
||||
} else if (Boolean.TRUE.equals(p.isDateTime)) {
|
||||
@ -2469,6 +2597,10 @@ public class DefaultCodegen {
|
||||
return dataType.toLowerCase().startsWith("byte");
|
||||
}
|
||||
|
||||
public boolean isDataTypeFile(String dataType) {
|
||||
return dataType.toLowerCase().equals("file");
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert map of Swagger SecuritySchemeDefinition objects to a list of Codegen Security objects
|
||||
*
|
||||
@ -2695,6 +2827,7 @@ public class DefaultCodegen {
|
||||
}
|
||||
co.operationId = uniqueName;
|
||||
co.operationIdLowerCase = uniqueName.toLowerCase();
|
||||
co.operationIdCamelCase = DefaultCodegen.camelize(uniqueName);
|
||||
opList.add(co);
|
||||
co.baseName = tag;
|
||||
}
|
||||
@ -2822,8 +2955,8 @@ public class DefaultCodegen {
|
||||
LOGGER.warn("null property for " + key);
|
||||
} else {
|
||||
final CodegenProperty cp = fromProperty(key, prop);
|
||||
cp.required = mandatory.contains(key) ? true : null;
|
||||
m.hasRequired = Boolean.TRUE.equals(m.hasRequired) || Boolean.TRUE.equals(cp.required);
|
||||
cp.required = mandatory.contains(key) ? true : false;
|
||||
m.hasRequired = m.hasRequired || cp.required;
|
||||
if (cp.isEnum) {
|
||||
// FIXME: if supporting inheritance, when called a second time for allProperties it is possible for
|
||||
// m.hasEnums to be set incorrectly if allProperties has enumerations but properties does not.
|
||||
@ -2843,7 +2976,7 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
if (cp.isContainer != null) {
|
||||
if (cp.isContainer) {
|
||||
addImport(m, typeMapping.get("array"));
|
||||
}
|
||||
|
||||
@ -3171,7 +3304,14 @@ public class DefaultCodegen {
|
||||
|
||||
// remove everything else other than word, number and _
|
||||
// $php_variable => php_variable
|
||||
return name.replaceAll("[^a-zA-Z0-9_]", "");
|
||||
if (allowUnicodeIdentifiers) { //could be converted to a single line with ?: operator
|
||||
name = Pattern.compile("\\W", Pattern.UNICODE_CHARACTER_CLASS).matcher(name).replaceAll("");
|
||||
}
|
||||
else {
|
||||
name = name.replaceAll("\\W", "");
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3264,6 +3404,10 @@ public class DefaultCodegen {
|
||||
} else if (Boolean.TRUE.equals(property.isBinary)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isFile)) {
|
||||
parameter.isFile = true;
|
||||
// file is *not* a primitive type
|
||||
//parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isDate)) {
|
||||
parameter.isDate = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
@ -3359,11 +3503,44 @@ public class DefaultCodegen {
|
||||
public boolean convertPropertyToBooleanAndWriteBack(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
booleanValue = convertPropertyToBoolean(propertyKey);
|
||||
// write back as boolean
|
||||
additionalProperties.put(propertyKey, booleanValue);
|
||||
writePropertyBack(propertyKey, booleanValue);
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an override location, if any is specified, for the .swagger-codegen-ignore.
|
||||
*
|
||||
* This is originally intended for the first generation only.
|
||||
*
|
||||
* @return a string of the full path to an override ignore file.
|
||||
*/
|
||||
public String getIgnoreFilePathOverride() {
|
||||
return ignoreFilePathOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an override location for the .swagger-codegen.ignore location for the first code generation.
|
||||
*
|
||||
* @param ignoreFileOverride The full path to an ignore file
|
||||
*/
|
||||
public void setIgnoreFilePathOverride(final String ignoreFileOverride) {
|
||||
this.ignoreFilePathOverride = ignoreFileOverride;
|
||||
}
|
||||
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
public void writePropertyBack(String propertyKey, boolean value) {
|
||||
additionalProperties.put(propertyKey, value);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,21 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
this.swagger = opts.getSwagger();
|
||||
this.config = opts.getConfig();
|
||||
this.config.additionalProperties().putAll(opts.getOpts().getProperties());
|
||||
ignoreProcessor = new CodegenIgnoreProcessor(this.config.getOutputDir());
|
||||
|
||||
String ignoreFileLocation = this.config.getIgnoreFilePathOverride();
|
||||
if(ignoreFileLocation != null) {
|
||||
final File ignoreFile = new File(ignoreFileLocation);
|
||||
if(ignoreFile.exists() && ignoreFile.canRead()) {
|
||||
this.ignoreProcessor = new CodegenIgnoreProcessor(ignoreFile);
|
||||
} else {
|
||||
LOGGER.warn("Ignore file specified at {} is not valid. This will fall back to an existing ignore file if present in the output directory.", ignoreFileLocation);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ignoreProcessor == null) {
|
||||
this.ignoreProcessor = new CodegenIgnoreProcessor(this.config.getOutputDir());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -61,12 +75,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
StringBuilder hostBuilder = new StringBuilder();
|
||||
hostBuilder.append(getScheme());
|
||||
hostBuilder.append("://");
|
||||
if (swagger.getHost() != null) {
|
||||
if (!StringUtils.isEmpty(swagger.getHost())) {
|
||||
hostBuilder.append(swagger.getHost());
|
||||
} else {
|
||||
hostBuilder.append("localhost");
|
||||
}
|
||||
if (swagger.getBasePath() != null) {
|
||||
if (!StringUtils.isEmpty(swagger.getBasePath()) && !swagger.getBasePath().equals("/")) {
|
||||
hostBuilder.append(swagger.getBasePath());
|
||||
}
|
||||
return hostBuilder.toString();
|
||||
@ -113,7 +127,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
config.processOpts();
|
||||
config.preprocessSwagger(swagger);
|
||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().toString());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().getName());
|
||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||
if (swagger.getVendorExtensions() != null) {
|
||||
config.vendorExtensions().putAll(swagger.getVendorExtensions());
|
||||
@ -140,8 +154,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
// set a default description if none if provided
|
||||
config.additionalProperties().put("appDescription",
|
||||
"No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)");
|
||||
config.additionalProperties().put("unescapedAppDescription", "No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)");
|
||||
} else {
|
||||
config.additionalProperties().put("appDescription", config.escapeText(info.getDescription()));
|
||||
config.additionalProperties().put("unescapedAppDescription", info.getDescription());
|
||||
}
|
||||
|
||||
if (info.getContact() != null) {
|
||||
@ -474,7 +490,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
if (!of.isDirectory()) {
|
||||
of.mkdirs();
|
||||
}
|
||||
String outputFilename = outputFolder + File.separator + support.destinationFilename;
|
||||
String outputFilename = outputFolder + File.separator + support.destinationFilename.replace('/', File.separatorChar);
|
||||
if (!config.shouldOverwrite(outputFilename)) {
|
||||
LOGGER.info("Skipped overwriting " + outputFilename);
|
||||
continue;
|
||||
@ -526,6 +542,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
if (in != null) {
|
||||
LOGGER.info("writing file " + outputFile);
|
||||
IOUtils.copy(in, out);
|
||||
out.close();
|
||||
} else {
|
||||
LOGGER.error("can't open " + templateFile + " for input");
|
||||
}
|
||||
@ -656,7 +673,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
|
||||
private File processTemplateToFile(Map<String, Object> templateData, String templateName, String outputFilename) throws IOException {
|
||||
if(ignoreProcessor.allowsFile(new File(outputFilename.replaceAll("//", "/")))) {
|
||||
String adjustedOutputFilename = outputFilename.replaceAll("//", "/").replace('/', File.separatorChar);
|
||||
if(ignoreProcessor.allowsFile(new File(adjustedOutputFilename))) {
|
||||
String templateFile = getFullTemplateFile(config, templateName);
|
||||
String template = readTemplate(templateFile);
|
||||
Mustache.Compiler compiler = Mustache.compiler();
|
||||
@ -671,11 +689,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
.defaultValue("")
|
||||
.compile(template);
|
||||
|
||||
writeToFile(outputFilename, tmpl.execute(templateData));
|
||||
return new File(outputFilename);
|
||||
writeToFile(adjustedOutputFilename, tmpl.execute(templateData));
|
||||
return new File(adjustedOutputFilename);
|
||||
}
|
||||
|
||||
LOGGER.info("Skipped generation of " + outputFilename + " due to rule in .swagger-codegen-ignore");
|
||||
LOGGER.info("Skipped generation of " + adjustedOutputFilename + " due to rule in .swagger-codegen-ignore");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -870,7 +888,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
if (os != null && os.size() > 0) {
|
||||
CodegenOperation op = os.get(os.size() - 1);
|
||||
op.hasMore = null;
|
||||
op.hasMore = false;
|
||||
}
|
||||
}
|
||||
return operations;
|
||||
|
@ -25,7 +25,8 @@ public class AuthParser {
|
||||
for (String part : parts) {
|
||||
String[] kvPair = part.split(":");
|
||||
if (kvPair.length == 2) {
|
||||
auths.add(new AuthorizationValue(URLDecoder.decode(kvPair[0]), URLDecoder.decode(kvPair[1]), "header")); // FIXME replace the deprecated method by decode(string, encoding). Which encoding is used ? Default UTF-8 ?
|
||||
// FIXME replace the deprecated method by decode(string, encoding). Which encoding is used ? Default UTF-8 ?
|
||||
auths.add(new AuthorizationValue(URLDecoder.decode(kvPair[0]), URLDecoder.decode(kvPair[1]), "header"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,5 +54,4 @@ public class AuthParser {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user