Compare commits

..

27 Commits

Author SHA1 Message Date
Jérémie Bresson
74914b6313 Prepare release 3.0.2 (#337) 2018-06-18 07:19:53 +02:00
John Wang
30d10213ec Add links for released versions in compat table (#336) 2018-06-18 04:51:05 +02:00
Ben Wells
c51986d657 Go server clean up (#328) 2018-06-18 01:09:48 +08:00
Jim Schubert
97bab928bd [cli] Enable recommendations on validate command (#292) 2018-06-18 01:09:21 +08:00
Akihito Nakano
75171b4672 [C++] Rename template dir (#332)
* Rename templateDir: pistache-server -> cpp-pistache-server

* Rename templateDir: qt5cpp -> cpp-qt5-client

* Rename templateDir: restbed -> cpp-restbed-server

* Rename templateDir: cpprest -> cpp-rest-sdk-client

* Rename templateDir: tizen -> cpp-tizen-client

* Update scripts
2018-06-17 19:56:56 +09:00
William Cheng
7c49bdd953 CircleCI migration from 1.0 to 2.0 (#333)
* migration to circleci 2.0 config

* install docker compose

* add setup remote docker

* comment out docker compose

* using public petstore for testing

* use only one working_directory

* use openapitools/openapi-petstore instead

* disable auth in petstore server

* run petstore server locally via mvn jetty

* fix typo

* test go first

* test pet server at port 8080

* remove docker compose command

* wait for server to start up

* sleep longer

* test mvn jetty again

* use machine executor

* comment out docker

* comment out restore cache

* sleep for 30s

* change petstore port

* restore petstore docker

* fix docker run command

* restore cache, clean up comments
2018-06-17 14:52:37 +08:00
delenius
c607ea8b31 Add fixes for es6 generator (#180)
Various fixes for JS (ES6) generator
2018-06-17 01:59:23 +08:00
William Cheng
53d9878cf2 Update Petstore samples (#331)
* Grammar and spelling fixes

* update petstore samples
2018-06-17 01:33:36 +08:00
Ville Skyttä
798bf61fde Grammar and spelling fixes (#329) 2018-06-17 00:49:01 +08:00
William Cheng
e5635d236d update brew readme (#330) 2018-06-16 21:21:18 +08:00
William Cheng
6c996a7d1a Various improvement to CI (#326)
* Various improvement to CI

* trigger a failure

* disable ensure up-to-date script

* move ensure-up-to-date under bin/utils, pipe update to /dev/null
2018-06-15 16:18:31 +08:00
Jérémie Bresson
5630746794 Remove "CI/pom.xml.shippable" (#319)
Remove Shippable CI specific pom file to avoid duplicates
2018-06-15 06:55:33 +02:00
Stian Liknes
680a2bc3ec Configuration option to disable HTML escaping when using Gson (#298)
* Configuration option to disable HTML escaping when using Gson

The default implementation of Gson will escape certain characters by default. This
includes the `=` character, which is used in base64 encoding and cause problems when
deserializing the value to a base64 encoded string in a service.

Adding an option for disabling this feature makes it easier to generate client code
with sane defaults.

* Update Petstore sample
2018-06-14 19:27:52 +08:00
topce
f8e61ac914 [typescript] fix cast problem (#303)
* fix cast problem

* fix cast problem
wing328 suggestion
2018-06-14 19:20:34 +08:00
Stian Liknes
24104dac35 Add option modelPropertyNaming to javascript generator (#299)
* Add option modelPropertyNaming to javascript generator

Fixes 6530

* Update Petstore sample
2018-06-14 19:19:23 +08:00
John Wang
7126074f49 add Go client test - TestPlaceOrder (#321) 2018-06-14 14:24:16 +08:00
Benjamin Gill
91d6d77a09 [rust-server] Add rust-server to travis CI (#308)
* Add rust-server to travis CI

* Install rust correctly (and only once)
2018-06-14 00:05:49 +08:00
Jérémie Bresson
f964873a2d Change "samples" profile name to "samples.shippable" (#305) 2018-06-13 15:05:20 +02:00
Benjamin Gill
6f6a4a1013 [rust-server] (Re-)Adding support for rust-server (#290)
* First attempt at getting rust-server working

* Solve the problem of spurious 'object's

* We've found the missing models

* Catch some single-var objects correctly

* Get single-param models 'working'

* Got files working

* Remove surplus logging

* Disable some things to get it compiling

* `cargo test` now passes as well

* Create rust-server-specific petstore.yaml

We've commented out a few bits that rust-server doesn't yet support

* Remove commented-out code

And finally get rid of the generation date in the sample
2018-06-13 18:53:03 +08:00
William Cheng
49b8ece776 update cpp server scripts/batch files (#296) 2018-06-13 16:57:36 +08:00
sunn
299527370e [go-server] Add dockerfile for building and run petstore service (#274)
* Add possibility to build and run go service in a container

* Remove tabs

* Update Pet Store server sample

* Add {{{packageName}}} instead of petstore
2018-06-13 16:55:04 +08:00
Jim Schubert
55f9e31f81 Update template modification docs (#291)
Updates some confusing wording, specifies naming conventions, and links
to external `new.sh` for contributed templates (rather than modified
templates).
2018-06-12 21:35:09 -04:00
Phil Sturgeon
2ff81caef6 Expanding customization docs (#283)
* Expanding customization docs

As a new user I was very confused on how to either modify, override or create a new library. The existing docs were brief and had requirred knowledge that new users will not have,  and it took a lot of trial and error to make progress.

Also the wording seemed off. It kept talking about "client" when this project creates more than just clients, used "language" when some templates are not a language, and used library to mean a few seeminly different things. I've tried to consolidate the wording around "template" and "codegen".

The codegen is the Java code, and then you give it a "name" which is used for the template. That's the template folder it will live in, so it seems to work.

Feel free to use this as a base and edit it out, but this will all make a lot more sense to beginners. :)
2018-06-12 18:09:26 -04:00
Jérémie Bresson
9930f610a7 Ignore signing for other branches than master (#288) 2018-06-12 16:25:47 +02:00
Christophe Bornet
d2016d8e0a Fix spring controller validation (#225) 2018-06-12 20:45:17 +08:00
Jérémie Bresson
defedf6e2b Mention new branches in the doc pages (#287)
* Mention new branches in docs
* Add badges for new branches in README.md
* Allow branches "3.1.x" and "4.0.x" to deploy (.travis.yaml)
2018-06-12 12:05:32 +02:00
Jérémie Bresson
8ae1c814d5 Prepare 3.0.2-SNAPSHOT (#285)
Set version `3.0.2-SNAPSHOT`.

Follow up from #280
2018-06-11 13:22:03 -04:00
1336 changed files with 18715 additions and 13359 deletions

View File

@@ -2,7 +2,7 @@
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] Ran the shell 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). Windows batch files can be found in `.\bin\windows\`.
- [ ] Filed the PR against the correct branch: Default: `master`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.1.x`, `4.0.x`. Default: `master`.
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
### Description of the PR

View File

@@ -25,7 +25,10 @@ cache:
- $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
- $HOME/samples/server/petstore/rust-server/target
- $HOME/perl5
- $HOME/.cargo
- $HOME/.stack
services:
- docker
@@ -41,7 +44,7 @@ before_install:
- stack upgrade
- stack --version
# install rust
- curl -sSf https://static.rust-lang.org/rustup.sh | sh
- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
# required when sudo: required for the Ruby petstore tests
- gem install bundler
- npm install -g typescript
@@ -83,7 +86,7 @@ install:
# Add Godeps dependencies to GOPATH and PATH
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.4 bash)"
- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace"
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$HOME/.cargo/bin:$PATH"
- go version
script:
@@ -100,14 +103,24 @@ script:
- mvn --quiet verify -Psamples
after_success:
# push to maven repo
- if [ $SONATYPE_USERNAME ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
echo "Finished ./gradlew uploadArchives";
popd;
- if [ $SONATYPE_USERNAME ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" = "master" ]; then
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
echo "Finished ./gradlew uploadArchives";
popd;
else
mvn clean deploy --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
echo "Finished ./gradlew uploadArchives";
popd;
fi;
fi;
## docker: build and push openapi-generator-online to DockerHub
- if [ $DOCKER_HUB_USERNAME ]; then echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin && docker build -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online && 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 && echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME"; fi; fi

View File

@@ -9,7 +9,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.0.1</version>
<version>3.0.2</version>
<url>https://github.com/openapi-tools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapi-tools/openapi-generator.git</connection>

View File

@@ -10,7 +10,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.0.1</version>
<version>3.0.2</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
@@ -833,6 +833,8 @@
</activation>
<modules>
<!-- clients -->
<!-- test non-java projects -->
<module>samples/client/petstore/go</module>
<!-- test java-related projects -->
<module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/scala</module>
@@ -855,8 +857,6 @@
<module>samples/client/petstore/kotlin/</module>
<module>samples/client/petstore/kotlin-threetenbp/</module>
<module>samples/client/petstore/kotlin-string/</module>
<!-- test non-java projects -->
<module>samples/client/petstore/go</module>
<!-- servers -->
<module>samples/server/petstore/java-vertx/rx</module>
<module>samples/server/petstore/java-vertx/async</module>
@@ -873,9 +873,10 @@
<module>samples/server/petstore/java-play-framework-api-package-override</module>
<module>samples/server/petstore/undertow</module>
<module>samples/server/petstore/jaxrs/jersey1</module>
<module>samples/server/petstore/jaxrs/jersey2</module>
<module>samples/server/petstore/jaxrs/jersey1-useTags</module>
<module>samples/server/petstore/jaxrs/jersey2-useTags</module>
<!-- move to other CI as the following fails often in CircleCI
<module>samples/server/petstore/jaxrs/jersey2</module>
<module>samples/server/petstore/jaxrs/jersey2-useTags</module> -->
<module>samples/server/petstore/jaxrs-datelib-j8</module>
<module>samples/server/petstore/jaxrs-resteasy/default</module>
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
@@ -883,9 +884,10 @@
<module>samples/server/petstore/jaxrs-resteasy/eap-java8</module>
<module>samples/server/petstore/jaxrs-resteasy/joda</module>
<!--<module>samples/server/petstore/kotlin-server/ktor</module>-->
<!-- move to other CI as the following fails often in CircleCI
<module>samples/server/petstore/spring-mvc</module>
<module>samples/server/petstore/spring-mvc-j8-async</module>
<module>samples/server/petstore/spring-mvc-j8-localdatetime</module>
<module>samples/server/petstore/spring-mvc-j8-localdatetime</module>-->
<module>samples/client/petstore/spring-cloud</module>
<module>samples/server/petstore/springboot</module>
<module>samples/server/petstore/springboot-beanvalidation</module>
@@ -898,6 +900,7 @@
<module>samples/server/petstore/jaxrs-spec-interface</module>
<module>samples/server/petstore/scala-lagom-server</module>
<module>samples/server/petstore/scalatra</module>
<module>samples/server/petstore/finch</module>
</modules>
</profile>
</profiles>

View File

@@ -10,7 +10,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.0.1</version>
<version>3.0.2</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@@ -9,7 +9,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.0.1</version>
<version>3.0.2</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@@ -1,944 +0,0 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-shippable-pom</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-shippable-pom</name>
<version>3.0.1</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<developers>
<!-- original author of the project -->
<developer>
<id>fehguy</id>
<name>Tony Tam</name>
<email>fehguy@gmail.com</email>
</developer>
<!-- openapi-generator core team -->
<developer>
<id>wing328</id>
<name>William Cheng</name>
<email>wing328hk@gmail.com</email>
</developer>
<developer>
<id>jimschubert</id>
<name>Jim Schubert</name>
<email>james.schubert@gmail.com</email>
</developer>
<developer>
<id>cbornet</id>
<name>Christophe Bornet</name>
</developer>
<developer>
<id>jaz-ah</id>
<name>Joseph Zuromski</name>
</developer>
<developer>
<id>ackintosh</id>
<name>Akihito Nakano</name>
</developer>
<developer>
<id>JFCote</id>
<name>Jean-François Côté</name>
</developer>
<developer>
<id>jmini</id>
<name>Jérémie Bresson</name>
<email>dev@jmini.fr</email>
</developer>
</developers>
<issueManagement>
<system>github</system>
<url>https://github.com/openapitools/openapi-generator/issues</url>
</issueManagement>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<outputDirectory>target/classes</outputDirectory>
<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
<artifactId>wagon-svn</artifactId>
<version>1.8</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-alpha-6</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-1</version>
</extension>
</extensions>
<defaultGoal>install</defaultGoal>
<directory>target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<!-- Uncomment this to format before checkstyle -->
<!-- <executions>
<execution>
<id>format</id>
<phase>validate</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions> -->
<configuration>
<compilerSource>1.8</compilerSource>
<compilerCompliance>1.8</compilerCompliance>
<compilerTargetPlatform>1.8</compilerTargetPlatform>
<lineEnding>LF</lineEnding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>../google_checkstyle.xml</configLocation>
<!-- Don't include generated sources a la http://stackoverflow.com/a/30406454 -->
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.19</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-version}</version>
<configuration>
<testNGArtifactName>none:none</testNGArtifactName>
<argLine>-XX:+StartAttachListener</argLine>
</configuration>
<executions>
<execution>
<id>test-testng</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>org.testng:testng</testNGArtifactName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<implementation-version>${project.version}</implementation-version>
<package>org.openapitools</package>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<aggregate>true</aggregate>
<source>1.8</source>
<encoding>UTF-8</encoding>
<maxmemory>1g</maxmemory>
<failOnWarnings>true</failOnWarnings>
<excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>0.5.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>release-profile</id>
<properties>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration/>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>prepare-package</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Samples -->
<profile>
<id>android-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/android/volley</module>
</modules>
</profile>
<profile>
<id>bash-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/bash</module>
</modules>
</profile>
<profile>
<id>clojure-client</id>
<activation>
<property>
<name>env</name>
<value>clojure</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/clojure</module>
</modules>
</profile>
<profile>
<id>haskell-http-client</id>
<activation>
<property>
<name>env</name>
<value>haskell-http-client</value>
</property>
</activation>
<modules>
<!--<module>../samples/client/petstore/haskell-http-client</module>-->
</modules>
</profile>
<profile>
<id>haskell-http-client-integration-test</id>
<activation>
<property>
<name>env</name>
<value>haskell-http-client</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/haskell-http-client/tests-integration</module>
</modules>
</profile>
<profile>
<id>java-client-jersey1</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/jersey1</module>
</modules>
</profile>
<profile>
<id>java-client-jersey2</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/jersey2</module>
</modules>
</profile>
<profile>
<id>java-client-jersey2-java6</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/jersey2-java6</module>
</modules>
</profile>
<profile>
<id>java-client-okhttp-gson</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/okhttp-gson</module>
</modules>
</profile>
<profile>
<id>java-client-okhttp-gson-parcelable</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/okhttp-gson/parcelableModel</module>
</modules>
</profile>
<profile>
<id>java-client-retrofit</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/retrofit</module>
</modules>
</profile>
<profile>
<id>java-client-retrofit2</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/retrofit2</module>
</modules>
</profile>
<profile>
<id>java-client-retrofit2-rx</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/retrofit2rx</module>
</modules>
</profile>
<profile>
<id>java-client-feign</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/java/feign</module>
</modules>
</profile>
<profile>
<id>javascript-client</id>
<activation>
<property>
<name>env</name>
<value>javascript</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/javascript</module>
</modules>
</profile>
<profile>
<id>scala-client</id>
<activation>
<property>
<name>env</name>
<value>scala</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/scala</module>
</modules>
</profile>
<profile>
<id>java-msf4j-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/java-msf4/</module>
</modules>
</profile>
<profile>
<id>jaxrs-cxf-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs-cxf</module>
</modules>
</profile>
<profile>
<id>jaxrs-resteasy-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs-resteasy/default</module>
</modules>
</profile>
<profile>
<id>jaxrs-resteasy-server-joda</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs-resteasy/joda</module>
</modules>
</profile>
<profile>
<id>jaxrs-resteasy-eap-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs-resteasy/eap</module>
</modules>
</profile>
<profile>
<id>jaxrs-resteasy-eap-server-joda</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs-resteasy/eap-joda</module>
</modules>
</profile>
<profile>
<id>jaxrs-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs/jersey2</module>
</modules>
</profile>
<profile>
<id>jaxrs-server-jersey1</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/jaxrs/jersey1</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-tests-default</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-fetch/tests/default</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-builds-default</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-fetch/builds/default</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-builds-es6-target</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-fetch/builds/es6-target</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-builds-with-npm-version</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
</modules>
</profile>
<profile>
<id>typescript-angularjs-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-angularjs/npm</module>
</modules>
</profile>
<profile>
<id>typescript-node-npm-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/typescript-node/npm</module>
</modules>
</profile>
<profile>
<id>python-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/python</module>
</modules>
</profile>
<profile>
<id>ruby-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/ruby</module>
</modules>
</profile>
<profile>
<id>go-client</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/go</module>
</modules>
</profile>
<profile>
<id>spring-mvc</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/spring-mvc</module>
</modules>
</profile>
<profile>
<id>springboot-beanvalidation</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/springboot-beanvalidation</module>
</modules>
</profile>
<profile>
<id>springboot-reactive</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/springboot-reactive</module>
</modules>
</profile>
<profile>
<id>springboot</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/springboot</module>
</modules>
</profile>
<profile>
<id>spring-cloud</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/client/petstore/spring-cloud</module>
</modules>
</profile>
<profile>
<id>scalatra-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/scalatra</module>
</modules>
</profile>
<profile>
<id>java-inflector</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/java-inflector</module>
</modules>
</profile>
<profile>
<id>java-undertowr</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>../samples/server/petstore/undertow</module>
</modules>
</profile>
<profile>
<id>samples</id>
<activation>
<property>
<name>env</name>
<value>samples</value>
</property>
</activation>
<modules>
<!-- clients -->
<module>../samples/client/petstore/elixir</module>
<!--<module>../samples/client/petstore/haskell-http-client</module>-->
<module>../samples/client/petstore/erlang-client</module>
<!-- servers -->
<module>../samples/server/petstore/erlang-server</module>
</modules>
</profile>
</profiles>
<modules>
<module>../</module>
</modules>
<reporting>
<outputDirectory>target/site</outputDirectory>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<reports>
<report>project-team</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<swagger-parser-version>2.0.1</swagger-parser-version>
<swagger-core-version>2.0.1</swagger-core-version>
<scala-version>2.11.1</scala-version>
<felix-version>3.3.0</felix-version>
<commons-io-version>2.4</commons-io-version>
<commons-cli-version>1.2</commons-cli-version>
<junit-version>4.8.1</junit-version>
<jackson-version>2.8.9</jackson-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<commons-lang-version>3.4</commons-lang-version>
<slf4j-version>1.7.12</slf4j-version>
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
<jmustache-version>1.12</jmustache-version>
<testng-version>6.9.6</testng-version>
<surefire-version>2.19.1</surefire-version>
<jmockit-version>1.25</jmockit-version>
<reflections-version>0.9.10</reflections-version>
<spring-boot-version>2.0.2.RELEASE</spring-boot-version>
</properties>
</project>

View File

@@ -22,6 +22,10 @@ If you're new to git, you may find the following FAQs useful:
https://github.com/openapitools/openapi-generator/wiki/FAQ#git
### Branches
Please file the pull request against the correct branch, e.g. `master` for non-breaking changes. See the [Git Branches](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches) page for more information.
### Code generators
All the code generators can be found in [modules/openapi-generator/src/main/java/org/openapitools/codegen/languages](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages)

View File

@@ -2,11 +2,20 @@
<div align="center">
Master (3.0.0): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.0.2`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[`3.1.x`](https://github.com/OpenAPITools/openapi-generator/tree/3.1.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/3.1.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/3.1.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=3.1.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=3.1.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[`4.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.0.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.0.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=4.0.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
</div>
<div align="center">
@@ -74,10 +83,11 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
OpenAPI Generator Version | Release Date | OpenAPI Spec compatibility | Notes
---------------------------- | ------------ | -------------------------- | -----
4.0.0 (upcoming major release) | TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes (no fallback)
3.1.0 (upcoming minor release) | TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release with breaking changes (with fallbacks)
3.0.1 (current master, upcoming release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.0.1/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Bug fixes release
3.0.0 | 01.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | First release with breaking changes
4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes (no fallback)
3.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.1.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release with breaking changes (with fallbacks)
3.0.2 (current master, upcoming release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.0.2/)| TBD | 1.0, 1.1, 1.2,
[3.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.1) | 11.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.0.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.0) | 01.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | First release with breaking changes
### [1.2 - Artifacts on Maven Central](#table-of-contents)
@@ -91,7 +101,7 @@ You can find our released artefacts on maven central:
<version>${openapi-generator-version}</version>
</dependency>
```
* [openapi-generator](https://mvnrepository.com/artifact/org.openapitools/openapi-generator)
See the different versions of the [openapi-generator](https://mvnrepository.com/artifact/org.openapitools/openapi-generator) artifact available on maven central.
**Cli:**
```xml
@@ -101,7 +111,7 @@ You can find our released artefacts on maven central:
<version>${openapi-generator-version}</version>
</dependency>
```
* [openapi-generator-cli](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli)
See the different versions of the [openapi-generator-cli](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli) artifact available on maven central.
**Maven plugin:**
```xml
@@ -111,7 +121,7 @@ You can find our released artefacts on maven central:
<version>${openapi-generator-version}</version>
</dependency>
```
* [openapi-generator-maven-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-maven-plugin)
* See the different versions of the [openapi-generator-maven-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-maven-plugin) artifact available on maven central.
* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.adoc)
**Gradle plugin:**
@@ -122,7 +132,7 @@ You can find our released artefacts on maven central:
<version>${openapi-generator-version}</version>
</dependency>
```
* [openapi-generator-gradle-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-gradle-plugin)
* See the different versions of the [openapi-generator-gradle-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-gradle-plugin) artifact available on maven central.
* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc)
### [1.3 - Download JAR](#table-of-contents)
@@ -133,12 +143,12 @@ JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generato
For **Mac/Linux** users:
```sh
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.0.0/openapi-generator-cli-3.0.0.jar -O openapi-generator-cli.jar
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.0.1/openapi-generator-cli-3.0.1.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.0.0/openapi-generator-cli-3.0.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.0.1/openapi-generator-cli-3.0.1.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -169,13 +179,15 @@ If you don't have maven installed, you may directly use the included [maven wrap
### [1.5 - Homebrew](#table-of-contents)
To install, run `brew install openapi-generator` (the new brew formula is pending https://github.com/Homebrew/homebrew-core/pull/28584)
To install, run `brew install openapi-generator`
Here is an example usage to generate a Ruby client:
```sh
openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby -o /tmp/test/
```
To reinstall with the latest master, run `brew reinstall --HEAD openapi-generator`
### [1.6 - Docker](#table-of-contents)
#### Public Pre-built Docker images

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/cpprest -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/tizen -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-tizen-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -1,41 +0,0 @@
#!/bin/bash
# this bash script run the scripts for the 'mature' generators
# it ensures that all changes are commited into the 'samples/' folder
echo "# START SCRIPT: $0"
echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date."
echo "Please press CTRL+C to stop or the script will continue in 5 seconds."
sleep 5
# LIST OF SCRIPTS:
./bin/ruby-petstore.sh
./bin/java-petstore-all.sh
./bin/java-jaxrs-petstore-server-all.sh
./bin/spring-all-pestore.sh
./bin/kotlin-client-petstore.sh
./bin/kotlin-client-string.sh
./bin/kotlin-client-threetenbp.sh
./bin/kotlin-server-petstore.sh
./bin/php-petstore.sh
./bin/php-silex-petstore-server.sh
./bin/php-symfony-petstore.sh
./bin/php-lumen-petstore-server.sh
./bin/php-slim-petstore-server.sh
./bin/php-ze-ph-petstore-server.sh
./bin/openapi3/php-petstore.sh
# Check:
if [ -n "$(git status --porcelain)" ]; then
echo "UNCOMMITTED CHANGES ERROR"
echo "There are uncommitted changes in working tree after execution of 'bin/ensure-up-to-date'"
echo "Perform git diff"
git --no-pager diff
echo "Perform git status"
git status
echo "Please run 'bin/ensure-up-to-date' locally and commit changes (UNCOMMITTED CHANGES ERROR)"
exit 1
else
echo "Git working tree is clean"
fi

View File

@@ -27,6 +27,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 -g cpp-pistache-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/server/petstore/pistache-server $@"
ags="generate -g cpp-pistache-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/server/petstore/cpp-pistache $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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 -g cpp-restbed-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/server/petstore/restbed $@"
ags="generate -g cpp-restbed-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/server/petstore/cpp-restbed $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/tizen -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-tizen-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/rust-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g rust-server -o samples/server/petstore/rust-server -DpackageName=petstore_api $@"
ags="generate -t modules/openapi-generator/src/main/resources/rust-server -i modules/openapi-generator/src/test/resources/2_0/rust-server/petstore-with-fake-endpoints-models-for-testing.yaml -g rust-server -o samples/server/petstore/rust-server -DpackageName=petstore_api --additional-properties hideGenerationTimestamp=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,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/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g cpp-qt5 -o samples/client/petstore-security-test/cpp-qt5 $@"
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g cpp-qt5 -o samples/client/petstore-security-test/cpp-qt5 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules\openapi-generator\src\test\resources\2_0\petstore-security-test.yaml -g qt5cpp -o samples\client\petstore-security-test\qt5cpp
set ags=generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules\openapi-generator\src\test\resources\2_0\petstore-security-test.yaml -g qt5cpp -o samples\client\petstore-security-test\qt5cpp
java %JAVA_OPTS% -jar %executable% %ags%

41
bin/utils/ensure-up-to-date Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
# this bash script run the scripts for the 'mature' generators
# it ensures that all changes are committed into the 'samples/' folder
echo "# START SCRIPT: $0"
echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date."
echo "Please press CTRL+C to stop or the script will continue in 5 seconds."
sleep 5
# LIST OF SCRIPTS:
./bin/ruby-petstore.sh > /dev/null 2>&1
./bin/java-petstore-all.sh > /dev/null 2>&1
./bin/java-jaxrs-petstore-server-all.sh > /dev/null 2>&1
./bin/spring-all-pestore.sh > /dev/null 2>&1
./bin/kotlin-client-petstore.sh > /dev/null 2>&1
./bin/kotlin-client-string.sh > /dev/null 2>&1
./bin/kotlin-client-threetenbp.sh > /dev/null 2>&1
./bin/kotlin-server-petstore.shl> /dev/null 2>&1
./bin/php-petstore.sh > /dev/null 2>&1
./bin/php-silex-petstore-server.shj> /dev/null 2>&1
./bin/php-symfony-petstore.sh > /dev/null 2>&1
./bin/php-lumen-petstore-server.sh > /dev/null 2>&1
./bin/php-slim-petstore-server.sh > /dev/null 2>&1
./bin/php-ze-ph-petstore-server.sh > /dev/null 2>&1
./bin/openapi3/php-petstore.sh > /dev/null 2>&1
# Check:
if [ -n "$(git status --porcelain)" ]; then
echo "UNCOMMITTED CHANGES ERROR"
echo "There are uncommitted changes in working tree after execution of 'bin/ensure-up-to-date'"
echo "Perform git diff"
git --no-pager diff
echo "Perform git status"
git status
echo "Please run 'bin/ensure-up-to-date' locally and commit changes (UNCOMMITTED CHANGES ERROR)"
exit 1
else
echo "Git working tree is clean"
fi

View File

@@ -39,7 +39,6 @@ declare -a files=("CI/pom.xml.bash"
"CI/pom.xml.circleci"
"CI/pom.xml.circleci.java7"
"CI/pom.xml.ios"
"CI/pom.xml.shippable"
"modules/openapi-generator-cli/pom.xml"
"modules/openapi-generator-gradle-plugin/README.adoc"
"modules/openapi-generator-gradle-plugin/gradle.properties"

View File

@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-pistache-server -o samples\server\petstore\pistache-server\
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-pistache-server -o samples\server\petstore\cpp-pistache\
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restbed-server -o samples\server\petstore\restbed\
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restbed-server -o samples\server\petstore\cpp-restbed\
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -1,54 +1,93 @@
# Java-related client, server tests
machine:
java:
version: openjdk8
services:
- docker
# Override /etc/hosts
hosts:
petstore.swagger.io: 127.0.0.1
environment:
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
dependencies:
cache_directories:
- "~/.m2"
- "~/.sbt"
- "~/.ivy2/cache"
pre:
- 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
# 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:
- cp CI/pom.xml.circleci pom.xml
test:
override:
## test with jdk8
- java -version
- mvn --quiet clean install
- mvn --quiet verify -Psamples
# skip the rest if previous mvn task fails
- if [ $? -ne 0 ]; then exit 1; fi
## test with jdk7
- sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
- java -version
- cp CI/pom.xml.circleci.java7 pom.xml # use jdk7 pom
- mvn --quiet clean install
- mvn --quiet verify -Psamples
# skip the rest if previous mvn task fails
- if [ $? -ne 0 ]; then exit 1; fi
## docker push done in Travis instead
## 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 --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/opeanapi-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_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 --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
version: 2
jobs:
build:
machine:
docker_layer_caching: true
working_directory: ~/OpenAPITools/openapi-generator
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
steps:
# Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
- checkout
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
# In many cases you can simplify this from what is generated here.
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
# This is based on your 1.0 configuration file or project settings
- run:
command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $BASH_ENV
- run:
command: 'sudo docker info >/dev/null 2>&1 || sudo service docker start; '
- run:
command: |-
printf '127.0.0.1 petstore.swagger.io
' | sudo tee -a /etc/hosts
# Dependencies
# This would typically go in either a build or a build-and-test job when using workflows
# Restore the dependency cache
- restore_cache:
keys:
# This branch if available
- v1-dep-{{ .Branch }}-
# Default branch if not
- v1-dep-master-
# This is based on your 1.0 configuration file or project settings
- run: sudo add-apt-repository ppa:duggan/bats --yes
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq bats
- run: sudo apt-get install -qq curl
# - run: docker pull openapitools/openapi-petstore
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
- run: docker pull swaggerapi/petstore
- run: docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- run: docker ps -a
- run: sleep 30
- run: cat /etc/hosts
# This is based on your 1.0 configuration file or project settings
- run: cp CI/pom.xml.circleci pom.xml
# Save dependency cache
- save_cache:
key: v1-dep-{{ .Branch }}
paths:
# This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
# These cache paths were specified in the 1.0 config
- ~/.sbt
# Test
# This would typically be a build job when using workflows, possibly combined with build
# This is based on your 1.0 configuration file or project settings
- run: java -version
- run: mvn --quiet clean install
- run: mvn --quiet verify -Psamples
- run: if [ $? -ne 0 ]; then exit 1; fi
- run: sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
- run: java -version
- run: cp CI/pom.xml.circleci.java7 pom.xml
- run: mvn --quiet clean install
- run: mvn --quiet verify -Psamples
- run: if [ $? -ne 0 ]; then exit 1; fi
# Teardown
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# Save test results
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results

View File

@@ -166,7 +166,7 @@ cf8d8d56f [PHP] Fix code example from README. Variable name was missing when usi
76907cacd [PHP] declare property headerSelector
### Python
7184f1ec6 [python] asyncio supports _preload_content; remove unsed imports (#107)
7184f1ec6 [python] asyncio supports _preload_content; remove unused imports (#107)
d74d2ba03 fix: python clients
8e0a0ebd6 Fix python / tornado body handling
b39c35c76 Fix inconsistency between model name and file name in python client
@@ -250,7 +250,7 @@ ce930e7a6 [Jaxrs-cxf] Add bean-level cascaded beanvalidation for pojos (@Valid)
ff1178ad7 [Java][Spring] fix missing optional query params
2103fadab Fix package declaration for play-framework
2c6380c84 fix inner item (list, map) for play framework
e33b350c8 Fix an issue in Play Framework generator where a CSV is empty and transfered to the controllerImp with an empty item.
e33b350c8 Fix an issue in Play Framework generator where a CSV is empty and transferred to the controllerImp with an empty item.
99fc27246 [JAX-RS][Spec] Removes throws Exception.
fe2a44339 Fixes issue (SpringCodeGen dateLibrary "java8-localdatetime" option is ignored).
d890d733f [JaxRS][Java] issue with implFolder on windows, and required fields generation for containers (#88)

View File

@@ -1,38 +1,58 @@
## Customization
### Modifying the client library format
Don't like the default client syntax? Want a different language supported? No problem! OpenAPI Generator processes mustache templates with the [jmustache](https://github.com/samskivert/jmustache) engine. You can modify our templates or make your own.
### Modifying a template
You can look at `modules/openapi-generator/src/main/resources/${your-language}` for examples. To make your own templates, create your own files and use the `-t` flag to specify your template folder. It actually is that easy.
Clone OpenAPI Generator and navigate to `modules/openapi-generator/src/main/resources/${template}`, where `${template}` is the name of the generator you wish to modify. For example, if you are looking for the C# template, it's named `csharp`. This directory contains all the templates used to generate your target client/server/doc output.
### Making your own codegen modules
Templates consist of multiple mustache files. [Mustache](https://mustache.github.io/) is used as the templating language for these templates, and the specific engine used is [jmustache](https://github.com/samskivert/jmustache).
If you're starting a project with a new language and don't see what you need, openapi-generator can help you create a project to generate your own libraries:
If you wish to modify one of these templates, copy and paste the template you're interested in to a templates directory you control. To let OpenAPI Generator know where this templates directory is, use the `-t` option (e.g: `-t ./templates/`).
To tie that all together (example for modifying ruby templates):
```sh
mkdir templates
export template=ruby
cp -r modules/openapi-generator/src/main/resources/${template} templates/${template}
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-t ./templates/${template} -g ruby -i ./foo.yml -o ./out/ruby
```
_**Note:** You cannot use this approach to create new templates, only override existing ones. If you'd like to create a new generator within the project, see `new.sh` in the repository root._
### Creating a new template
If none of the templates suit your needs, you can create a brand new template. OpenAPI Generator can help with this, using the `meta` command:
```sh
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar meta \
-o output/myLibrary -n myClientCodegen -p com.my.company.codegen
-o out/generators/my-codegen -n my-codegen -p com.my.company.codegen
```
This will write, in the folder `output/myLibrary`, all the files you need to get started, including a `README.md. Once modified and compiled, you can load your library with the codegen and generate clients with your own, custom-rolled logic.
This will create a new directory `out/generators/my-codegen`, with all the files you need to get started - including a `README.md`. Once modified and compiled, you can use your new codegen just like any other, with your own custom-rolled logic.
You would then compile your library in the `output/myLibrary` folder with `mvn package` and execute the codegen like such:
These names can be anything you like. If you are building a client for the whitespace language, maybe you'd use the options `-o out/generators/whitespace -n whitespace`. They can be the same, or different, it doesn't matter. The `-n` value will be become the template name.
**NOTE** Convention is to use kebab casing for names passed to `-n`. Example, `scala-finatra` would become `ScalaFinatraGenerator`.
To compile your library, enter the `out/generators/my-codegen` directory, run `mvn package` and execute the generator:
```sh
java -cp output/myLibrary/target/myClientCodegen-openapi-generator-1.0.0.jar:modules/openapi-generator-cli/target/openapi-generator-cli.jar org.openapitools.codegen.OpenAPIGenerator
java -cp out/generators/my-codegen/target/my-codegen-openapi-generator-1.0.0.jar:modules/openapi-generator-cli/target/openapi-generator-cli.jar org.openapitools.codegen.OpenAPIGenerator
```
For Windows users, you will need to use `;` instead of `:` in the classpath, e.g.
```
java -cp output/myLibrary/target/myClientCodegen-openapi-generator-1.0.0.jar;modules/openapi-generator-cli/target/openapi-generator-cli.jar org.openapitools.codegen.OpenAPIGenerator
java -cp out/generators/my-codegen/target/my-codegen-openapi-generator-1.0.0.jar;modules/openapi-generator-cli/target/openapi-generator-cli.jar org.openapitools.codegen.OpenAPIGenerator
```
Note the `myClientCodegen` is an option now, and you can use the usual arguments for generating your library:
Note the `my-codegen` is an option for `-g` now, and you can use the usual arguments for generating your code:
```sh
java -cp output/myLibrary/target/myClientCodegen-openapi-generator-1.0.0.jar:modules/openapi-generator-cli/target/openapi-generator-cli.jar \
io.openapitools.codegen.OpenAPIGenerator generate -g myClientCodegen\
java -cp out/codegens/customCodegen/target/my-codegen-openapi-generator-1.0.0.jar:modules/openapi-generator-cli/target/openapi-generator-cli.jar \
io.openapitools.codegen.OpenAPIGenerator generate -g my-codegen \
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
-o myClient
-o ./out/myClient
```

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -21,7 +21,9 @@ import io.airlift.airline.Command;
import io.airlift.airline.Option;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
import org.openapitools.codegen.utils.ModelUtils;
import java.util.HashSet;
import java.util.List;
@@ -34,26 +36,58 @@ public class Validate implements Runnable {
description = "location of the OpenAPI spec, as URL or file (required)")
private String spec;
@Option(name = { "--recommend"}, title = "recommend spec improvements")
private Boolean recommend;
@Override
public void run() {
System.out.println("Validating spec (" + spec + ")");
SwaggerParseResult result = new OpenAPIParser().readLocation(spec, null, null);
List<String> messageList = result.getMessages();
Set<String> messages = new HashSet<String>(messageList);
Set<String> errors = new HashSet<String>(messageList);
Set<String> warnings = new HashSet<String>();
if (messages.size() > 0) {
StringBuilder sb = new StringBuilder();
sb.append(System.lineSeparator());
for (String message : messages) {
sb.append(String.format("\t- %s%s", message, System.lineSeparator()));
StringBuilder sb = new StringBuilder();
OpenAPI specification = result.getOpenAPI();
if (Boolean.TRUE.equals(recommend)) {
if (specification != null) {
// Add information about unused models to the warnings set.
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
if (unusedModels != null) {
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
}
}
}
if (errors.size() > 0) {
sb.append("Errors:").append(System.lineSeparator());
errors.forEach(msg ->
sb.append("\t-").append(msg).append(System.lineSeparator())
);
}
if (!warnings.isEmpty()) {
sb.append("Warnings: ").append(System.lineSeparator());
warnings.forEach(msg ->
sb.append("\t-").append(msg).append(System.lineSeparator())
);
}
if (!errors.isEmpty()) {
sb.append(System.lineSeparator());
sb.append("[error] Spec is invalid.");
sb.append("[error] Spec has ").append(errors.size()).append(" errors.");
System.err.println(sb.toString());
System.exit(1);
} else if (!warnings.isEmpty()) {
sb.append(System.lineSeparator());
sb.append("[info] Spec has ").append(warnings.size()).append(" recommendation(s).");
} else {
System.out.println("No validation errors detected.");
// we say "issues" here rather than "errors" to account for both errors and issues.
sb.append("No validation issues detected.");
}
System.out.println(sb.toString());
}
}

View File

@@ -1,4 +1,4 @@
openApiGeneratorVersion=3.0.1
openApiGeneratorVersion=3.0.2
# BEGIN placeholders
# these are just placeholders to allow contributors to build directly

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -16,5 +16,5 @@ gradle buildGoSdk
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=3.0.1-SNAPSHOT openApiValidate
gradle -PopenApiGeneratorVersion=3.0.1 openApiValidate
```

View File

@@ -1 +1 @@
openApiGeneratorVersion=3.0.1-SNAPSHOT
openApiGeneratorVersion=3.0.1

View File

@@ -11,7 +11,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<executions>
<execution>
<goals>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>openapi-generator-maven-plugin</artifactId>

View File

@@ -2,7 +2,7 @@ FROM openjdk:8-jre-alpine
WORKDIR /generator
COPY target/openapi-generator-online-3.0.1.jar /generator/openapi-generator-online.jar
COPY target/openapi-generator-online-3.0.2.jar /generator/openapi-generator-online.jar
ENV GENERATOR_HOST=http://localhost

View File

@@ -10,6 +10,6 @@ This is an example of building a OpenAPI-enabled server in Java using the Spring
The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox)
Start your server as an simple java application
Start your server as a simple java application
Change default port value in application.properties
Change default port value in application.properties

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>openapi-generator-online</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -210,7 +210,7 @@ public class DefaultCodegen implements CodegenConfig {
for (String name : allModels.keySet()) {
CodegenModel cm = allModels.get(name);
CodegenModel parent = allModels.get(cm.getParent());
// if a discriminator exists on the parent, don't add this child to the inheritance heirarchy
// if a discriminator exists on the parent, don't add this child to the inheritance hierarchy
// TODO Determine what to do if the parent discriminator name == the grandparent discriminator name
while (parent != null) {
if (parent.getChildren() == null) {
@@ -1201,7 +1201,7 @@ public class DefaultCodegen implements CodegenConfig {
*/
private static String getPrimitiveType(Schema schema) {
if (schema == null) {
throw new RuntimeException("schema cannnot be null in getPrimitiveType");
throw new RuntimeException("schema cannot be null in getPrimitiveType");
} else if (ModelUtils.isStringSchema(schema) && "number".equals(schema.getFormat())) {
// special handle of type: string, format: number
return "BigDecimal";
@@ -1300,7 +1300,7 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Determine the type alias for the given type if it exists. This feature
* was original developed for Java because the language does not have a aliasing
* was originally developed for Java because the language does not have an aliasing
* mechanism of its own but later extends to handle other languages
*
* @param name The type name.
@@ -2055,7 +2055,7 @@ public class DefaultCodegen implements CodegenConfig {
}
if (operation == null)
throw new RuntimeException("operation cannnot be null in fromOperation");
throw new RuntimeException("operation cannot be null in fromOperation");
// store the original operationId for plug-in
op.operationIdOriginal = operation.getOperationId();
@@ -3853,7 +3853,7 @@ public class DefaultCodegen implements CodegenConfig {
RequestBody requestBody = ModelUtils.getReferencedRequestBody(openAPI, operation.getRequestBody());
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) {
return Collections.emptySet(); // return emtpy set
return Collections.emptySet(); // return empty set
}
return requestBody.getContent().keySet();
}
@@ -4249,7 +4249,7 @@ public class DefaultCodegen implements CodegenConfig {
if (schema.getAdditionalProperties() != null) {// http body is map
LOGGER.error("Map should be supported. Please report to openapi-generator github repo about the issue.");
} else if (codegenProperty != null) {
LOGGER.warn("The folowing schema has undefined (null) baseType. " +
LOGGER.warn("The following schema has undefined (null) baseType. " +
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
"A correct 'consumes' for form parameters should be " +
"'application/x-www-form-urlencoded' or 'multipart/form-data'");

View File

@@ -1012,7 +1012,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String key : definitions.keySet()) {
Schema schema = definitions.get(key);
if (schema == null)
throw new RuntimeException("schema cannnot be null in processMoels");
throw new RuntimeException("schema cannot be null in processMoels");
CodegenModel cm = config.fromModel(key, schema, allDefinitions);
Map<String, Object> mo = new HashMap<String, Object>();
mo.put("model", cm);

View File

@@ -378,7 +378,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
/**
* Post process the media types (produces and consumes) for Ada code generator.
* <p>
* For each media type, add a adaMediaType member that gives the Ada enum constant
* For each media type, add an adaMediaType member that gives the Ada enum constant
* for the corresponding type.
*
* @param types the list of media types.

View File

@@ -341,7 +341,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
.build();
if (objs.containsKey("lambda")) {
LOGGER.warn("An property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
LOGGER.warn("A property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
"You'll likely need to use a custom template, " +
"see https://github.com/swagger-api/swagger-codegen#modifying-the-client-library-format. ");
objs.put("_lambda", lambdas);

View File

@@ -62,6 +62,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String SUPPORT_ASYNC = "supportAsync";
public static final String WITH_XML = "withXml";
public static final String SUPPORT_JAVA6 = "supportJava6";
public static final String DISABLE_HTML_ESCAPING = "disableHtmlEscaping";
protected String dateLibrary = "threetenbp";
protected boolean supportAsync = false;
@@ -93,7 +94,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected boolean serializeBigDecimalAsString = false;
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
protected boolean supportJava6 = false;
protected boolean supportJava6= false;
protected boolean disableHtmlEscaping = false;
public AbstractJavaCodegen() {
super();
@@ -185,6 +187,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
java8Mode.setEnum(java8ModeOptions);
cliOptions.add(java8Mode);
cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)"));
}
@Override
@@ -196,6 +199,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
additionalProperties.put(SUPPORT_JAVA6, supportJava6);
if (additionalProperties.containsKey(DISABLE_HTML_ESCAPING)) {
this.setDisableHtmlEscaping(Boolean.valueOf(additionalProperties.get(DISABLE_HTML_ESCAPING).toString()));
}
additionalProperties.put(DISABLE_HTML_ESCAPING, disableHtmlEscaping);
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
@@ -1222,6 +1229,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.supportAsync = enabled;
}
public void setDisableHtmlEscaping(boolean disabled) {
this.disableHtmlEscaping = disabled;
}
@Override
public String escapeQuotationMark(String input) {
// remove " to avoid code injection

View File

@@ -325,11 +325,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
} else if (ModelUtils.isDateTimeSchema(p)) {
return UNDEFINED_VALUE;
} else if (ModelUtils.isNumberSchema(p)) {
NumberSchema dp = (NumberSchema) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString();
}
return UNDEFINED_VALUE;
if (p.getDefault() != null) {
return p.getDefault().toString();
}
return UNDEFINED_VALUE;
} else if (ModelUtils.isIntegerSchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();

View File

@@ -74,7 +74,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
apiTemplateFiles.put("api-impl-source.mustache", ".cpp");
apiTemplateFiles.put("main-api-server.mustache", ".cpp");
embeddedTemplateDir = templateDir = "pistache-server";
embeddedTemplateDir = templateDir = "cpp-pistache-server";
cliOptions.clear();

View File

@@ -92,7 +92,7 @@ public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenCo
* Template Location. This is the location which templates will be read from. The generator
* will use the resource stream to attempt to read the templates.
*/
embeddedTemplateDir = templateDir = "qt5cpp";
embeddedTemplateDir = templateDir = "cpp-qt5-client";
// CLI options
addOption(CPP_NAMESPACE, CPP_NAMESPACE_DESC, this.cppNamespace);

View File

@@ -99,7 +99,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
apiTemplateFiles.put("api-header.mustache", ".h");
apiTemplateFiles.put("api-source.mustache", ".cpp");
embeddedTemplateDir = templateDir = "cpprest";
embeddedTemplateDir = templateDir = "cpp-rest-sdk-client";
cliOptions.clear();

View File

@@ -53,7 +53,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
apiTemplateFiles.put("api-header.mustache", ".h");
apiTemplateFiles.put("api-source.mustache", ".cpp");
embeddedTemplateDir = templateDir = "restbed";
embeddedTemplateDir = templateDir = "cpp-restbed-server";
cliOptions.clear();

View File

@@ -44,7 +44,7 @@ public class CppTizenClientCodegen extends DefaultCodegen implements CodegenConf
modelTemplateFiles.put("model-body.mustache", ".cpp");
apiTemplateFiles.put("api-header.mustache", ".h");
apiTemplateFiles.put("api-body.mustache", ".cpp");
embeddedTemplateDir = templateDir = "tizen";
embeddedTemplateDir = templateDir = "cpp-tizen-client";
modelPackage = "";
defaultIncludes = new HashSet<String>(

View File

@@ -110,6 +110,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
*/
supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml"));
supportingFiles.add(new SupportingFile("main.mustache", "", "main.go"));
supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));
supportingFiles.add(new SupportingFile("routers.mustache", apiPath, "routers.go"));
supportingFiles.add(new SupportingFile("logger.mustache", apiPath, "logger.go"));
writeOptional(outputFolder, new SupportingFile("README.mustache", apiPath, "README.md"));

View File

@@ -102,6 +102,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
protected String apiTestPath = "api/";
protected String modelTestPath = "model/";
protected boolean useES6 = false; // default is ES5
private String modelPropertyNaming = "camelCase";
public JavascriptClientCodegen() {
super();
@@ -206,6 +207,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(new CliOption(USE_ES6,
"use JavaScript ES6 (ECMAScript 6) (beta). Default is ES5.")
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
}
@Override
@@ -271,6 +273,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
if (additionalProperties.containsKey(EMIT_JS_DOC)) {
setEmitJSDoc(convertPropertyToBooleanAndWriteBack(EMIT_JS_DOC));
}
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
}
}
@Override
@@ -492,6 +497,22 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return toModelName(name) + ".spec";
}
public String getModelPropertyNaming() {
return this.modelPropertyNaming;
}
private String getNameUsingModelPropertyNaming(String name) {
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
case original: return name;
case camelCase: return camelize(name, true);
case PascalCase: return camelize(name);
case snake_case: return underscore(name);
default: throw new IllegalArgumentException("Invalid model property naming '" +
name + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
}
}
@Override
public String toVarName(String name) {
// sanitize name
@@ -508,7 +529,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
// camelize (lower first character) the variable name
// pet_id => petId
name = camelize(name, true);
name = getNameUsingModelPropertyNaming(name);
// for reserved word or word starting with number, append _
if (isReservedWord(name) || name.matches("^\\d.*")) {
@@ -613,6 +634,17 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return null;
}
public void setModelPropertyNaming(String naming) {
if ("original".equals(naming) || "camelCase".equals(naming) ||
"PascalCase".equals(naming) || "snake_case".equals(naming)) {
this.modelPropertyNaming = naming;
} else {
throw new IllegalArgumentException("Invalid model property naming '" +
naming + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
}
}
@Override
public String toDefaultValueWithParam(String name, Schema p) {
String type = normalizeType(getTypeDeclaration(p));
@@ -954,6 +986,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
}
String jsdocType = getJSDocType(operation);
operation.vendorExtensions.put("x-jsdoc-type", jsdocType);
// Format the return type correctly
if (operation.returnType != null) {
operation.vendorExtensions.put("x-return-type", normalizeType(operation.returnType));
}
}
}
return objs;

View File

@@ -229,7 +229,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen {
.build();
if (objs.containsKey("lambda")) {
LOGGER.warn("An property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
LOGGER.warn("A property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
"You'll likely need to use a custom template, " +
"see https://github.com/swagger-api/swagger-codegen#modifying-the-client-library-format. "); // TODO: update the URL
objs.put("_lambda", lambdas);

View File

@@ -77,6 +77,9 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
public RustServerCodegen() {
super();
// Show the generation timestamp by default
hideGenerationTimestamp = Boolean.FALSE;
// set the output folder here
outputFolder = "generated-code/rust-server";
@@ -529,19 +532,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
List<String> consumes = new ArrayList<String>();
/* comment out the following logic as there's no consume in operation/global definition
if (consumes != null) {
if (!consumes.isEmpty()) {
// use consumes defined in the operation
consumes = operation.getConsumes();
}
} else if (openAPI != null && openAPI.getConsumes() != null && swagger.getConsumes().size() > 0) {
// use consumes defined globally
consumes = swagger.getConsumes();
LOGGER.debug("No consumes defined in operation. Using global consumes (" + swagger.getConsumes() + ") for " + op.operationId);
}
*/
boolean consumesPlainText = false;
boolean consumesXml = false;
// if "consumes" is defined (per operation or using global definition)
@@ -569,19 +559,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
List<String> produces = new ArrayList<String>(getProducesInfo(openAPI, operation));
// if "consumes" is defined (per operation or using global definition)
/*
if (operation.getProduces() != null) {
if (operation.getProduces().size() > 0) {
// use produces defined in the operation
produces = operation.getProduces();
}
} else if (swagger != null && swagger.getProduces() != null && swagger.getProduces().size() > 0) {
// use produces defined globally
produces = swagger.getProduces();
LOGGER.debug("No produces defined in operation. Using global produces (" + swagger.getProduces() + ") for " + op.operationId);
}
*/
boolean producesXml = false;
boolean producesPlainText = false;
@@ -604,51 +581,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
op.hasProduces = true;
}
/* TODO move the following logic to postProcessOperations as there's no body/form parameter in OAS 3.0
if (op.bodyParam != null) {
if (paramHasXmlNamespace(op.bodyParam, definitions)) {
op.bodyParam.vendorExtensions.put("has_namespace", "true");
}
for (String key : definitions.keySet()) {
op.bodyParam.vendorExtensions.put("model_key", key);
}
// Default to consuming json
op.bodyParam.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase());
if (consumesXml) {
op.bodyParam.vendorExtensions.put("consumesXml", true);
} else if (consumesPlainText) {
op.bodyParam.vendorExtensions.put("consumesPlainText", true);
} else {
op.bodyParam.vendorExtensions.put("consumesJson", true);
}
}
for (CodegenParameter param : op.bodyParams) {
processParam(param, op);
if (paramHasXmlNamespace(param, definitions)) {
param.vendorExtensions.put("has_namespace", "true");
}
param.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase());
// Default to producing json if nothing else is specified
if (consumesXml) {
param.vendorExtensions.put("consumesXml", true);
} else if (consumesPlainText) {
param.vendorExtensions.put("consumesPlainText", true);
} else {
param.vendorExtensions.put("consumesJson", true);
}
}
for (CodegenParameter param : op.formParams) {
processParam(param, op);
}
*/
for (CodegenParameter param : op.headerParams) {
// If a header uses UUIDs, we need to import the UUID package.
if (param.dataType.equals("uuid::Uuid")) {
@@ -714,6 +646,77 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
return op;
}
@Override
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
for (CodegenOperation op : operationList) {
boolean consumesPlainText = false;
boolean consumesXml = false;
if (op.consumes != null) {
for (Map<String, String> consume : op.consumes) {
if (consume.get("mediaType") != null) {
String mediaType = consume.get("mediaType");
if (isMimetypeXml(mediaType)) {
additionalProperties.put("usesXml", true);
consumesXml = true;
} else if (isMimetypePlainText(mediaType)) {
consumesPlainText = true;
} else if (isMimetypeWwwFormUrlEncoded(mediaType)) {
additionalProperties.put("usesUrlEncodedForm", true);
}
}
}
}
if (op.bodyParam != null) {
// Default to consuming json
op.bodyParam.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase());
if (consumesXml) {
op.bodyParam.vendorExtensions.put("consumesXml", true);
} else if (consumesPlainText) {
op.bodyParam.vendorExtensions.put("consumesPlainText", true);
} else {
op.bodyParam.vendorExtensions.put("consumesJson", true);
}
}
for (CodegenParameter param : op.bodyParams) {
processParam(param, op);
param.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase());
// Default to producing json if nothing else is specified
if (consumesXml) {
param.vendorExtensions.put("consumesXml", true);
} else if (consumesPlainText) {
param.vendorExtensions.put("consumesPlainText", true);
} else {
param.vendorExtensions.put("consumesJson", true);
}
}
for (CodegenParameter param : op.formParams) {
processParam(param, op);
}
for (CodegenProperty header : op.responseHeaders) {
if (header.dataType.equals("uuid::Uuid")) {
additionalProperties.put("apiUsesUuid", true);
}
header.nameInCamelCase = toModelName(header.baseName);
}
additionalProperties.put("apiHasFile", true);
}
return objs;
}
@Override
public boolean isDataTypeFile(final String dataType) {
return dataType != null && dataType.equals(typeMapping.get("File").toString());
@@ -726,26 +729,22 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
Schema inner = ap.getItems();
String innerType = getTypeDeclaration(inner);
StringBuilder typeDeclaration = new StringBuilder(typeMapping.get("array")).append("<");
if (!StringUtils.isEmpty(inner.get$ref())) {
typeDeclaration.append("models::");
}
typeDeclaration.append(innerType).append(">");
return typeDeclaration.toString();
} else if (ModelUtils.isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties();
String innerType = getTypeDeclaration(inner);
StringBuilder typeDeclaration = new StringBuilder(typeMapping.get("map")).append("<").append(typeMapping.get("string")).append(", ");
if (!StringUtils.isEmpty(inner.get$ref())) {
typeDeclaration.append("models::");
}
typeDeclaration.append(innerType).append(">");
return typeDeclaration.toString();
} else if (!StringUtils.isEmpty(p.get$ref())) {
String datatype;
try {
datatype = p.get$ref();
if (datatype.indexOf("#/definitions/") == 0) {
datatype = toModelName(datatype.substring("#/definitions/".length()));
if (datatype.indexOf("#/components/schemas/") == 0) {
datatype = toModelName(datatype.substring("#/components/schemas/".length()));
datatype = "models::" + datatype;
}
} catch (Exception e) {
LOGGER.warn("Error obtaining the datatype from schema (model):" + p + ". Datatype default to Object");
@@ -756,50 +755,41 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
} else if (p instanceof FileSchema) {
return typeMapping.get("File").toString();
}
return super.getTypeDeclaration(p);
}
@Override
public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
CodegenParameter parameter = super.fromParameter(param, imports);
/* TODO need ot revise the logic below as there's no body parameter
if (param instanceof BodyParameter) {
BodyParameter bp = (BodyParameter) param;
Model model = bp.getSchema();
if (model instanceof RefModel) {
String name = ((RefModel) model).getSimpleRef();
name = toModelName(name);
// We need to be able to look up the model in the model definitions later.
parameter.vendorExtensions.put("uppercase_data_type", name.toUpperCase());
if (!parameter.isString && !parameter.isNumeric && !parameter.isByteArray &&
!parameter.isBinary && !parameter.isFile && !parameter.isBoolean &&
!parameter.isDate && !parameter.isDateTime && !parameter.isUuid &&
!parameter.isListContainer && !parameter.isMapContainer &&
!languageSpecificPrimitives.contains(parameter.dataType)) {
name = "models::" + getTypeDeclaration(name);
parameter.baseType = name;
parameter.dataType = name;
String refName = ((RefModel) model).get$ref();
if (refName.indexOf("#/definitions/") == 0) {
refName = refName.substring("#/definitions/".length());
}
parameter.vendorExtensions.put("refName", refName);
} else if (model instanceof ModelImpl) {
parameter.vendorExtensions.put("refName", ((ModelImpl) model).getName());
}
String name = "models::" + getTypeDeclaration(parameter.dataType);
parameter.dataType = name;
parameter.baseType = name;
}
*/
return parameter;
}
@Override
public CodegenProperty fromProperty(String name, Schema p) {
CodegenProperty property = super.fromProperty(name, p);
public void postProcessParameter(CodegenParameter parameter) {
// If this parameter is not a primitive type, prefix it with "models::"
// to ensure it's namespaced correctly in the Rust code.
if (!parameter.isString && !parameter.isNumeric && !parameter.isByteArray &&
!parameter.isBinary && !parameter.isFile && !parameter.isBoolean &&
!parameter.isDate && !parameter.isDateTime && !parameter.isUuid &&
!parameter.isListContainer && !parameter.isMapContainer &&
!languageSpecificPrimitives.contains(parameter.dataType)) {
/* need to revise the logic below. Is this for alias?
if (p instanceof RefProperty) {
property.datatype = "models::" + property.datatype;
String name = "models::" + getTypeDeclaration(parameter.dataType);
parameter.dataType = name;
parameter.baseType = name;
}
*/
return property;
}
@Override
@@ -1037,6 +1027,24 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
List<Object> models = (List<Object>) objs.get("models");
for (Object _mo : models) {
Map<String, Object> mo = (Map<String, Object>) _mo;
CodegenModel cm = (CodegenModel) mo.get("model");
if (cm.dataType != null && cm.dataType.equals("object")) {
// Object isn't a sensible default. Instead, we set it to
// 'null'. This ensures that we treat this model as a struct
// with multiple parameters.
cm.dataType = null;
} else if (cm.dataType != null) {
// We need to hack about with single-parameter models to get
// them recognised correctly.
cm.isAlias = false;
cm.dataType = typeMapping.get(cm.dataType);
}
}
return super.postProcessModelsEnum(objs);
}
@@ -1061,7 +1069,12 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
private void processParam(CodegenParameter param, CodegenOperation op) {
String example = null;
if (param.isString) {
if (param.isFile) {
param.vendorExtensions.put("formatString", "{:?}");
op.vendorExtensions.put("hasFile", true);
additionalProperties.put("apiHasFile", true);
example = "Box::new(stream::once(Ok(b\"hello\".to_vec()))) as Box<Stream<Item=_, Error=_> + Send>";
} else if (param.isString) {
if (param.dataFormat != null && param.dataFormat.equals("byte")) {
param.vendorExtensions.put("formatString", "\\\"{:?}\\\"");
example = "swagger::ByteArray(\"" + ((param.example != null) ? param.example : "") + "\".to_string().into_bytes())";
@@ -1082,11 +1095,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
} else if (param.isListContainer) {
param.vendorExtensions.put("formatString", "{:?}");
example = (param.example != null) ? param.example : "&Vec::new()";
} else if (param.isFile) {
param.vendorExtensions.put("formatString", "{:?}");
op.vendorExtensions.put("hasFile", true);
additionalProperties.put("apiHasFile", true);
example = "Box::new(stream::once(Ok(b\"hello\".to_vec()))) as Box<Stream<Item=_, Error=_> + Send>";
} else {
param.vendorExtensions.put("formatString", "{:?}");
if (param.example != null) {

View File

@@ -137,7 +137,7 @@ public class ModelUtils {
visitOpenAPI(openAPI, (s, t) -> {
if(s.get$ref() != null) {
String ref = getSimpleRef(s.get$ref());
if ("application/x-www-form-urlencoded".equalsIgnoreCase(t) ||
if ("application/x-www-form-urlencoded".equalsIgnoreCase(t) ||
"multipart/form-data".equalsIgnoreCase(t)) {
schemasUsedInFormParam.add(ref);
} else {
@@ -153,7 +153,7 @@ public class ModelUtils {
* {@link #getUnusedSchemas(OpenAPI)},
* {@link #getSchemasUsedOnlyInFormParam(OpenAPI)}, ...) to traverse all paths of an
* OpenAPI instance and call the visitor functional interface when a schema is found.
*
*
* @param openAPI specification
* @param visitor functional interface (can be defined as a lambda) called each time a schema is found.
*/
@@ -492,7 +492,7 @@ public class ModelUtils {
}
return schema;
}
public static Schema getSchema(OpenAPI openAPI, String name) {
if (name == null) {
return null;

View File

@@ -39,7 +39,7 @@ public class URLPathUtils {
LOGGER.warn("Server information seems not defined in the spec. Default to {}.", LOCAL_HOST);
return getDefaultUrl();
}
// TOOD need a way to obtain all server URLs
// TODO need a way to obtain all server URLs
final Server server = servers.get(0);
String url = sanitizeUrl(server.getUrl());
@@ -150,4 +150,4 @@ public class URLPathUtils {
return null;
}
}
}
}

View File

@@ -18,7 +18,7 @@ run the following command:
gprbuild -p -P{{projectName}}
```
After the build is successfull, you will get the server binary
After the build is successful, you will get the server binary
in bin/{{packageName}}-server and you can start it as follows:
```
./bin/{{packageName}}-server

View File

@@ -7,7 +7,7 @@ expanded class
feature -- Access
from_json (a_val:STRING; a_type: TYPE [detachable ANY] ): detachable ANY
-- Deserialize a a json representation `a_val' to an object
-- Deserialize a json representation `a_val' to an object
-- of type `a_type'
local
conv_from: JSON_BASIC_REFLECTOR_DESERIALIZER

View File

@@ -76,7 +76,11 @@ public class JSON {
})
{{/parent}}
;
return fireBuilder.createGsonBuilder();
GsonBuilder builder = fireBuilder.createGsonBuilder();
{{#disableHtmlEscaping}}
builder.disableHtmlEscaping();
{{/disableHtmlEscaping}}
return builder;
}
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {

View File

@@ -915,7 +915,7 @@ public class ApiClient {
* @param <T> Type
* @param response Response
* @param returnType Return type
* @throws ApiException If the response has a unsuccessful status code or
* @throws ApiException If the response has an unsuccessful status code or
* fail to deserialize the response body
* @return Type
*/

View File

@@ -13,6 +13,9 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
{{/jdk8-no-delegate}}
import org.springframework.http.ResponseEntity;
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
{{/useBeanValidation}}
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
@@ -50,6 +53,9 @@ import java.util.Optional;
import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
{{/async}}
{{>generatedAnnotation}}
{{#useBeanValidation}}
@Validated
{{/useBeanValidation}}
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
{{#operations}}
public interface {{classname}} {

View File

@@ -12,7 +12,7 @@ This is an example of building a OpenAPI-enabled server in Java using the Spring
The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox)
{{/useSpringfox}}
Start your server as an simple java application
Start your server as a simple java application
{{^reactive}}
You can view the api documentation in swagger-ui by pointing to
@@ -46,4 +46,4 @@ public interface PetClient extends PetApi {
}
```
{{/interfaceOnly}}
{{/interfaceOnly}}

View File

@@ -7,7 +7,6 @@ import java.util.Objects;
import java.io.Serializable;
{{/serializableModel}}
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
{{/useBeanValidation}}

View File

@@ -2,7 +2,6 @@
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
{{#useBeanValidation}}@Validated{{/useBeanValidation}}
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#serializableModel}}

View File

@@ -84,7 +84,7 @@
var authNames = [<#authMethods>'<name>'<#hasMore>, </hasMore></authMethods>];
var contentTypes = [<#consumes>'<& mediaType>'<#hasMore>, </hasMore></consumes>];
var accepts = [<#produces>'<& mediaType>'<#hasMore>, </hasMore></produces>];
var returnType = <#returnType><&returnType></returnType><^returnType>null</returnType>;
var returnType = <#vendorExtensions.x-return-type><&vendorExtensions.x-return-type></vendorExtensions.x-return-type><^vendorExtensions.x-return-type>null</vendorExtensions.x-return-type>;
return this.apiClient.callApi(
'<&path>', '<httpMethod>',

View File

@@ -15,7 +15,7 @@ import querystring from "querystring";
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
* @class
*/{{/emitJSDoc}}
export default class ApiClient {
class ApiClient {
constructor() {
{{#emitJSDoc}}/**
* The base URL against which to resolve every API call's (relative) path.
@@ -221,43 +221,6 @@ export default class ApiClient {
return newParams;
}
{{#emitJSDoc}}/**
* Enumeration of collection format separator strategies.
* @enum {String}
* @readonly
*/{{/emitJSDoc}}
static CollectionFormatEnum = {
{{#emitJSDoc}}/**
* Comma-separated values. Value: <code>csv</code>
* @const
*/{{/emitJSDoc}}
CSV: ',',
{{#emitJSDoc}}/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/{{/emitJSDoc}}
SSV: ' ',
{{#emitJSDoc}}/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/{{/emitJSDoc}}
TSV: '\t',
{{#emitJSDoc}}/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/{{/emitJSDoc}}
PIPES: '|',
{{#emitJSDoc}}/**
* Native array. Value: <code>multi</code>
* @const
*/{{/emitJSDoc}}
MULTI: 'multi'
};
{{#emitJSDoc}}/**
* Builds a string representation of an array-type actual parameter, according to the given collection format.
* @param {Array} param An array parameter.
@@ -597,8 +560,46 @@ export default class ApiClient {
};
}
{{#emitJSDoc}}/**
* Enumeration of collection format separator strategies.
* @enum {String}
* @readonly
*/{{/emitJSDoc}}
ApiClient.CollectionFormatEnum = {
{{#emitJSDoc}}/**
* Comma-separated values. Value: <code>csv</code>
* @const
*/{{/emitJSDoc}}
CSV: ',',
{{#emitJSDoc}}/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/{{/emitJSDoc}}
SSV: ' ',
{{#emitJSDoc}}/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/{{/emitJSDoc}}
TSV: '\t',
{{#emitJSDoc}}/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/{{/emitJSDoc}}
PIPES: '|',
{{#emitJSDoc}}/**
* Native array. Value: <code>multi</code>
* @const
*/{{/emitJSDoc}}
MULTI: 'multi'
};
{{#emitJSDoc}}/**
* The default API client implementation.
* @type {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient}
*/{{/emitJSDoc}}
ApiClient.instance = new ApiClient();
export default ApiClient;

View File

@@ -69,7 +69,7 @@ export default class <classname> {
let authNames = [<#authMethods>'<name>'<#hasMore>, </hasMore></authMethods>];
let contentTypes = [<#consumes>'<& mediaType>'<#hasMore>, </hasMore></consumes>];
let accepts = [<#produces>'<& mediaType>'<#hasMore>, </hasMore></produces>];
let returnType = <#returnType><&returnType></returnType><^returnType>null</returnType>;
let returnType = <#vendorExtensions.x-return-type><&vendorExtensions.x-return-type></vendorExtensions.x-return-type><^vendorExtensions.x-return-type>null</vendorExtensions.x-return-type>;
return this.apiClient.callApi(
'<&path>', '<httpMethod>',

View File

@@ -1,9 +1,4 @@
{{>licenseInfo}}
import ApiClient from '../ApiClient';
{{#imports}}import {{import}} from './{{import}}';
{{/imports}}
{{#models}}{{#model}}
{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}
{{/model}}{{/models}}
{{/imports}}{{#models}}{{#model}}{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}{{/model}}{{/models}}

View File

@@ -9,7 +9,7 @@ export default class {{classname}} {
* value: {{{value}}}
* @const
*/{{/emitJSDoc}}
{{name}} = {{{value}}};
"{{name}}" = {{{value}}};
{{/enumVars}}{{/allowableValues}}

View File

@@ -1,54 +1,49 @@
{{#models}}{{#model}}
{{#emitJSDoc}}/**
* The {{classname}} model module.
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
* @version {{projectVersion}}
*/{{/emitJSDoc}}
export default class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}extends Array {{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{
{{#models}}{{#model}}{{#emitJSDoc}}/**
* The {{classname}} model module.
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
* @version {{projectVersion}}
*/{{/emitJSDoc}}
class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}extends Array {{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{
{{#emitJSDoc}}/**
* Constructs a new <code>{{classname}}</code>.{{#description}}
* {{description}}{{/description}}
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
* @class{{#useInheritance}}{{#parent}}
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
* @param {{name}} {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{#description}}{{{description}}}{{/description}}{{/vendorExtensions.x-all-required}}
*/{{/emitJSDoc}}
constructor({{#vendorExtensions.x-all-required}}{{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}
* Constructs a new <code>{{classname}}</code>.{{#description}}
* {{description}}{{/description}}
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{#useInheritance}}{{#parent}}
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
* @param {{name}} {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{#description}}{{{description}}}{{/description}}{{/vendorExtensions.x-all-required}}
*/{{/emitJSDoc}}
constructor({{#vendorExtensions.x-all-required}}{{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { {{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}
super();
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}
{{#useInheritance}}
{{#parentModel}}{{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
{{#interfaceModels}}{{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/interfaceModels}}
{{/useInheritance}}
{{#vars}}{{#required}}this['{{baseName}}'] = {{name}};{{/required}}{{/vars}}
{{#parent}}{{^parentModel}}return this;{{/parentModel}}{{/parent}}
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}
{{#interfaceModels}}{{classname}}.initialize(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/interfaceModels}}{{/useInheritance}}
{{classname}}.initialize(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
}
{{#emitJSDoc}}/**
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
*/{{/emitJSDoc}}
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/{{/emitJSDoc}}
static initialize(obj{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}}) { {{#vars}}{{#required}}
obj['{{baseName}}'] = {{name}};{{/required}}{{/vars}}
}
{{#emitJSDoc}}/**
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
*/{{/emitJSDoc}}
static constructFromObject(data, obj) {
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
obj = obj || new {{classname}}();
obj = obj || new {{classname}}();{{#parent}}{{^parentModel}}
{{#parent}}{{^parentModel}}ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');{{/parentModel}}
{{/parent}}
{{#useInheritance}}{{#parentModel}}{{classname}}.constructFromObject(data, obj);{{/parentModel}}
{{#interfaces}}{{.}}.constructFromObject(data, obj);{{/interfaces}}
{{/useInheritance}}
ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}}
{{classname}}.constructFromObject(data, obj);{{/parentModel}}{{#interfaces}}
{{.}}.constructFromObject(data, obj);{{/interfaces}}{{/useInheritance}}
{{#vars}}
if (data.hasOwnProperty('{{baseName}}')) {
@@ -59,61 +54,49 @@ export default class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtension
return obj;
}
{{#vars}}
{{#emitJSDoc}}/**{{#description}}
* {{{description}}}{{/description}}
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
* @default {{{defaultValue}}}{{/defaultValue}}
*/{{/emitJSDoc}}
{{baseName}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
{{/vars}}
{{#useInheritance}}{{#interfaceModels}}
// Implement {{classname}} interface:
{{#allVars}}{{#emitJSDoc}}/**{{#description}}
* {{{description}}}{{/description}}
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
* @default {{{defaultValue}}}{{/defaultValue}}
*/{{/emitJSDoc}}
{{baseName}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
{{/allVars}}
{{/interfaceModels}}{{/useInheritance}}
{{#emitModelMethods}}{{#vars}}
{{#emitJSDoc}}/**{{#description}}
* Returns {{{description}}}{{/description}}{{#minimum}}
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
* maximum: {{maximum}}{{/maximum}}
* @return {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=>
*/{{/emitJSDoc}}
{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}}/**{{#description}}
* Returns {{{description}}}{{/description}}{{#minimum}}
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
* maximum: {{maximum}}{{/maximum}}
* @return {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=>
*/{{/emitJSDoc}}
{{getter}}() {
return this.{{baseName}};
}
{{#emitJSDoc}}/**{{#description}}
* Sets {{{description}}}{{/description}}
* @param {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{name}}{{#description}} {{{description}}}{{/description}}
*/{{/emitJSDoc}}
* Sets {{{description}}}{{/description}}
* @param {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{name}}{{#description}} {{{description}}}{{/description}}
*/{{/emitJSDoc}}
{{setter}}({{name}}) {
this['{{baseName}}'] = {{name}};
}
{{/vars}}{{/emitModelMethods}}
{{/vars}}{{/emitModelMethods}}{{/model}}
}
{{#vars}}{{#emitJSDoc}}/**{{#description}}
* {{{description}}}{{/description}}
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
* @default {{{defaultValue}}}{{/defaultValue}}
*/{{/emitJSDoc}}
{{classname}}.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
{{#vars}}
{{#isEnum}}
{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}
{{/isEnum}}
{{#items.isEnum}}
{{#items}}
{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}
{{/items}}
{{/items.isEnum}}
{{/vars}}
{{/model}}{{/models}}
}
{{#useInheritance}}{{#interfaceModels}}// Implement {{classname}} interface:
{{#allVars}}{{#emitJSDoc}}/**{{#description}}
* {{{description}}}{{/description}}
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
* @default {{{defaultValue}}}{{/defaultValue}}
*/{{/emitJSDoc}}
{{classname}}.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
{{#vars}}{{#isEnum}}{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}{{/items}}{{/items.isEnum}}{{/vars}}
export default {{classname}};
{{/models}}

View File

@@ -1,15 +1,15 @@
{{#emitJSDoc}}/**
* Allowed values for the <code>{{baseName}}</code> property.
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
* @readonly
*/{{/emitJSDoc}}
{{classname}}['{{datatypeWithEnum}}'] = {
{{#allowableValues}}{{#enumVars}}
{{#emitJSDoc}}/**
* Allowed values for the <code>{{baseName}}</code> property.
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
* @readonly
*/{{/emitJSDoc}}
static {{datatypeWithEnum}} = {
{{#allowableValues}}{{#enumVars}}
{{#emitJSDoc}}/**
* value: {{{value}}}
* @const
*/{{/emitJSDoc}}
"{{name}}": {{{value}}}{{^-last}},
{{/-last}}
{{/enumVars}}{{/allowableValues}}
};
* value: {{{value}}}
* @const
*/{{/emitJSDoc}}
"{{name}}": {{{value}}}{{^-last}},
{{/-last}}
{{/enumVars}}{{/allowableValues}}
};

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