Compare commits

..

1 Commits

Author SHA1 Message Date
William Cheng
fa3d863c8c uncomment haskell test 2020-07-31 15:00:23 +08:00
387 changed files with 2441 additions and 6942 deletions

View File

@@ -45,13 +45,9 @@ please create a Gist (https://gist.github.com) or upload it somewhere else and
link it here.
-->
##### Generation Details
##### Command line used for generation
<!--
Prefer CLI steps, including the language, libraries and various options.
Providing config-based settings allows for simpler testing across CLI and plugins.
For examples, see https://github.com/OpenAPITools/openapi-generator/tree/master/bin/configs
-->
<!-- including the language, libraries and various options -->
##### Steps to reproduce

View File

@@ -2,9 +2,8 @@
<!-- Please check the completed items below -->
### PR checklist
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand.
- [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`

View File

@@ -1,80 +0,0 @@
name: Check Supported Java Versions
on:
push:
branches:
- master
jobs:
build:
name: Build on JDK ${{ matrix.java }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [8, 11]
os: [ubuntu-latest]
include:
- java: 8
os: windows-latest
- java: 13
os: ubuntu-latest
# Need to update to Gradle version with v13 support in modules/openapi-generator-gradle-plugin/pom.xml
flags: -am -pl modules/openapi-generator-cli
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('modules/openapi-generator-gradle-plugin/pom.xml') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Maven
shell: bash
run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }}
- name: Test gradle
shell: bash
run: gradle -b modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle buildGoSdk --stacktrace
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
if: matrix.java == '8'
with:
name: artifact
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
verify:
name: Verifies integrity of the commit on ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Download build artifact
uses: actions/download-artifact@v1
with:
name: artifact
- name: Run Ensures Script
run: |
mkdir -p modules/openapi-generator-cli/target/
mv artifact/openapi-generator-cli.jar modules/openapi-generator-cli/target/
./bin/utils/ensure-up-to-date

3
.gitignore vendored
View File

@@ -173,9 +173,6 @@ samples/client/petstore/python-asyncio/.venv/
samples/client/petstore/python-asyncio/.pytest_cache/
samples/client/petstore/python-tornado/.venv/
# PHP
samples/server/petstore/php-lumen/lib/composer.lock
# ts
samples/client/petstore/typescript-angular2/npm/npm-debug.log
samples/client/petstore/typescript-node/npm/npm-debug.log

View File

@@ -77,13 +77,11 @@ before_install:
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# -- skip bash test to shorten build time
# Add bats test framework and cURL for Bash script integration tests
#- sudo add-apt-repository ppa:duggan/bats --yes
#- sudo apt-get update -qq
#- sudo apt-get install -qq bats
#- sudo apt-get install -qq curl
# -- skip bash test end
- 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
# install dart
#- sudo apt-get update
#- sudo apt-get install apt-transport-https
@@ -95,6 +93,9 @@ before_install:
- phpenv versions
- phpenv global 7.2.15
- php -v
# install perl module
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#- cpanm Test::Exception Test::More Log::Any LWP::UserAgent JSON URI:Query Module::Runtime DateTime Module::Find Moose::Role
# comment out below as installation failed in travis
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
@@ -106,11 +107,9 @@ before_install:
# install Qt5
- sudo apt install -y --no-install-recommends qt5-default
- cmake --version
# -- skip perl test to shorten build time
# perl dep
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
# -- skip perl test end
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
# show java version
@@ -150,6 +149,14 @@ script:
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
- mvn --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test maven plugin
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test gradle plugin
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
after_success:
# push to maven repo
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then

View File

@@ -4,7 +4,7 @@
- If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/openapitools/openapi-generator#getting-started)
- Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information. Failure to provide enough detail may result in slow response from the community.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information.
- Test with the latest master by building the JAR locally to see if the issue has already been addressed.
- You can also make a suggestion or ask a question by opening an "issue".
@@ -87,7 +87,8 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.

View File

@@ -8,7 +8,6 @@
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=master)](https://app.bitrise.io/app/4a2b10a819d12b67)
![Check Supported Java Versions](https://github.com/openapi-generator/openapi-generator/workflows/Check%20Supported%20Java%20Versions/badge.svg)
</div>
@@ -768,7 +767,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-07-20 - [Datadog API client libraries now available for Java and Go](https://www.datadoghq.com/blog/java-go-libraries/) by Jordan Obey at [Datadog Blog](https://www.datadoghq.com/blog)
- 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1)
- 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto)
- 2020-08-03 - [Criando Bibliotecas para APIs RESTful com OpenAPI, Swagger Editor e OpenAPI Generator](https://medium.com/@everisBrasil/criando-bibliotecas-para-apis-restful-com-openapi-swagger-editor-e-openapi-generator-75349a6420fd) by [everis Brasil (an NTT DATA Company)](https://medium.com/@everisBrasil)
## [6 - About Us](#table-of-contents)

View File

@@ -15,14 +15,14 @@ install:
# install gradle
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\gradle\gradle-5.6.4" )) {
if (!(Test-Path -Path "C:\gradle" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip',
'https://services.gradle.org/distributions/gradle-5.3.1-bin.zip',
'C:\gradle-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
}
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.3.1\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-Xmx4g
- cmd: SET JAVA_OPTS=-Xmx4g
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5

View File

@@ -5,5 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
targetFramework: netcoreapp2.0
useCompareNetObjects: true
license: BSD-2-Clause OR MIT
useCompareNetObjects: "true"

View File

@@ -1,8 +0,0 @@
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-retrofit2-rx3
library: jvm-retrofit2
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
artifactId: kotlin-petstore-retrofit2-rx3
useRxJava3: "true"

View File

@@ -1,4 +1,4 @@
generatorName: php-lumen
outputDir: samples/server/petstore/php-lumen
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/php-lumen

View File

@@ -8,7 +8,7 @@ sidebar_label: Guidelines
- If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/openapitools/openapi-generator#getting-started)
- Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information. Failure to provide enough detail may result in slow response from the community.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information.
- Test with the latest master by building the JAR locally to see if the issue has already been addressed.
- You can also make a suggestion or ask a question by opening an "issue".
@@ -91,7 +91,8 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.

View File

@@ -18,7 +18,7 @@ sidebar_label: aspnetcore
|modelClassModifier|Model Class Modifier can be nothing or partial| |partial|
|newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0|
|operationIsAsync|Set methods to async or sync (default).| |false|
|operationModifier|Operation Modifier can be virtual or abstract| |virtual|
|operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual|
|operationResultTask|Set methods result to Task&lt;&gt;.| |false|
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|

View File

@@ -5,7 +5,6 @@ sidebar_label: go-server
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|enumClassPrefix|Prefix enum with class name| |false|
|featureCORS|Enable Cross-Origin Resource Sharing middleware| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi|

View File

@@ -25,7 +25,6 @@ sidebar_label: kotlin
|useCoroutines|Whether to use the Coroutines adapter with the retrofit2 library.| |false|
|useRxJava|Whether to use the RxJava adapter with the retrofit2 library.| |false|
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false|
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library.| |false|
## IMPORT MAPPING

View File

@@ -61,35 +61,6 @@ task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valida
task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
----
[NOTE]
====
The tasks support Gradle Up-To-Date checking and Gradle Cache. Enable caching globally by setting `org.gradle.caching=true` in the `gradle.settings`
file or by passing the command line property `--build-cache` when executing on the command line.
Disable up-to-date checks and caching by setting the following property when using the extension:
.Disable caching for extension
[source,groovy]
----
tasks.withType(org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
outputs.upToDateWhen { false }
outputs.cacheIf { false }
}
----
Disable up-to-date checks and caching for a custom task:
.Disable caching for custom task
[source,groovy]
----
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
outputs.upToDateWhen { false }
outputs.cacheIf { false }
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
}
----
====
== Plugin Setup
//# RELEASE_VERSION

View File

@@ -1,5 +1,5 @@
#Thu Jan 30 22:14:34 EST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists

View File

@@ -1,18 +1,18 @@
# Local Spec Sample
This example assumes you have Gradle 5.6.4+ installed. No gradle wrapper is provided in samples.
This example assumes you have Gradle 4.7+ installed. No gradle wrapper is provided in samples.
First, publish the openapi-generator-gradle-plugin locally via `./gradlew assemble publishToMavenLocal` in the module directory.
First, publish the openapi-generator-gradle-plugin locally via `./gradlew assemble install` in the module directory.
Then, run the following tasks in this example directory.
```bash
gradle openApiGenerate # expected outcome: BUILD SCCESSFUL
gradle openApiMeta # expected outcome: BUILD SCCESSFUL
gradle openApiValidate # expected outcome: BUILD FAILED
gradle buildGoSdk # expected outcome: BUILD SCCESSFUL
gradle buildDotnetSdk # expected outcome: BUILD SCCESSFUL
gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
gradle openApiGenerate
gradle openApiMeta
gradle openApiValidate
gradle buildGoSdk
gradle buildDotnetSdk
gradle generateGoWithInvalidSpec
```
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:

View File

@@ -55,9 +55,9 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
)
val generators = extensions.create(
"openApiGenerators",
OpenApiGeneratorGeneratorsExtension::class.java,
project
"openApiGenerators",
OpenApiGeneratorGeneratorsExtension::class.java,
project
)
generate.outputDir.set("$buildDir/generate-resources/main")

View File

@@ -317,7 +317,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
}
@Suppress("MemberVisibilityCanBePrivate")
fun applyDefaults() {
fun applyDefaults(){
releaseNote.set("Minor update")
modelNamePrefix.set("")
modelNameSuffix.set("")

View File

@@ -19,14 +19,7 @@ package org.openapitools.generator.gradle.plugin.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import org.gradle.internal.logging.text.StyledTextOutput
@@ -39,6 +32,7 @@ import org.openapitools.codegen.DefaultGenerator
import org.openapitools.codegen.config.CodegenConfigurator
import org.openapitools.codegen.config.GlobalSettings
/**
* A task which generates the desired code.
*
@@ -49,73 +43,63 @@ import org.openapitools.codegen.config.GlobalSettings
* @author Jim Schubert
*/
@Suppress("UnstableApiUsage")
@CacheableTask
open class GenerateTask : DefaultTask() {
/**
* The verbosity of generation
*/
@Optional
@Input
@get:Internal
val verbose = project.objects.property<Boolean>()
/**
* Whether or not an input specification should be validated upon generation.
*/
@Optional
@Input
@get:Internal
val validateSpec = project.objects.property<Boolean>()
/**
* The name of the generator which will handle codegen. (see "openApiGenerators" task)
*/
@Optional
@Input
@get:Internal
val generatorName = project.objects.property<String>()
/**
* The output target directory into which code will be generated.
*/
@Optional
@get:OutputDirectory
@get:Internal
val outputDir = project.objects.property<String>()
@Suppress("unused")
@get:Internal
@set:Option(option = "input", description = "The input specification.")
@Input
var input: String? = null
set(value) {
inputSpec.set(value)
}
/**
* The Open API 2.0/3.x specification location.
*/
@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:Internal
val inputSpec = project.objects.property<String>()
/**
* The template directory holding a custom template.
*/
@Optional
@Input
@get:Internal
val templateDir = project.objects.property<String?>()
/**
* Adds authorization headers when fetching the OpenAPI definitions remotely.
* Pass in a URL-encoded string of name:header with a comma separating multiple values
*/
@Optional
@Input
@get:Internal
val auth = project.objects.property<String>()
/**
* Sets specified global properties.
*/
@Optional
@Input
@get:Internal
val globalProperties = project.objects.mapProperty<String, String>()
/**
@@ -123,185 +107,159 @@ open class GenerateTask : DefaultTask() {
* File content should be in a json format { "optionKey":"optionValue", "optionKey1":"optionValue1"...}
* Supported options can be different for each language. Run config-help -g {generator name} command for language specific config options.
*/
@Optional
@Input
@get:Internal
val configFile = project.objects.property<String>()
/**
* Specifies if the existing files should be overwritten during the generation.
*/
@Optional
@Input
@get:Internal
val skipOverwrite = project.objects.property<Boolean?>()
/**
* Package for generated classes (where supported)
*/
@Optional
@Input
@get:Internal
val packageName = project.objects.property<String>()
/**
* Package for generated api classes
*/
@Optional
@Input
@get:Internal
val apiPackage = project.objects.property<String>()
/**
* Package for generated models
*/
@Optional
@Input
@get:Internal
val modelPackage = project.objects.property<String>()
/**
* Prefix that will be prepended to all model names. Default is the empty string.
*/
@Optional
@Input
@get:Internal
val modelNamePrefix = project.objects.property<String>()
/**
* Suffix that will be appended to all model names. Default is the empty string.
*/
@Optional
@Input
@get:Internal
val modelNameSuffix = project.objects.property<String>()
/**
* Sets instantiation type mappings.
*/
@Optional
@Input
@get:Internal
val instantiationTypes = project.objects.mapProperty<String, String>()
/**
* Sets mappings between OpenAPI spec types and generated code types.
*/
@Optional
@Input
@get:Internal
val typeMappings = project.objects.mapProperty<String, String>()
/**
* Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value.
* You can also have multiple occurrences of this option.
*/
@Optional
@Input
@get:Internal
val additionalProperties = project.objects.mapProperty<String, String>()
/**
* Sets server variable for server URL template substitution, in the format of name=value,name=value.
* You can also have multiple occurrences of this option.
*/
@Optional
@Input
@get:Internal
val serverVariables = project.objects.mapProperty<String, String>()
/**
* Specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double.
*/
@Optional
@Input
@get:Internal
val languageSpecificPrimitives = project.objects.listProperty<String>()
/**
* Specifies mappings between a given class and the import that should be used for that class.
*/
@Optional
@Input
@get:Internal
val importMappings = project.objects.mapProperty<String, String>()
/**
* Root package for generated code.
*/
@Optional
@Input
@get:Internal
val invokerPackage = project.objects.property<String>()
/**
* GroupId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Internal
val groupId = project.objects.property<String>()
/**
* ArtifactId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Internal
val id = project.objects.property<String>()
/**
* Artifact version in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Internal
val version = project.objects.property<String>()
/**
* Reference the library template (sub-template) of a generator.
*/
@Optional
@Input
@get:Internal
val library = project.objects.property<String?>()
/**
* Git host, e.g. gitlab.com.
*/
@Optional
@Input
@get:Internal
val gitHost = project.objects.property<String?>()
/**
* Git user ID, e.g. openapitools.
*/
@Optional
@Input
@get:Internal
val gitUserId = project.objects.property<String?>()
/**
* Git repo ID, e.g. openapi-generator.
*/
@Optional
@Input
@get:Internal
val gitRepoId = project.objects.property<String?>()
/**
* Release note, default to 'Minor update'.
*/
@Optional
@Input
@get:Internal
val releaseNote = project.objects.property<String?>()
/**
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
*/
@Optional
@Input
@get:Internal
val httpUserAgent = project.objects.property<String?>()
/**
* Specifies how a reserved name should be escaped to.
*/
@Optional
@Input
@get:Internal
val reservedWordsMappings = project.objects.mapProperty<String, String>()
/**
* Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
*/
@Optional
@Input
@get:Internal
val ignoreFileOverride = project.objects.property<String?>()
/**
* Remove prefix of operationId, e.g. config_getId => getId
*/
@Optional
@Input
@get:Internal
val removeOperationIdPrefix = project.objects.property<Boolean?>()
/**
@@ -313,8 +271,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val apiFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -324,8 +281,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val modelFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -338,8 +294,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val supportingFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -350,8 +305,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val generateModelTests = project.objects.property<Boolean>()
/**
@@ -362,8 +316,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val generateModelDocumentation = project.objects.property<Boolean>()
/**
@@ -374,8 +327,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val generateApiTests = project.objects.property<Boolean>()
/**
@@ -386,23 +338,21 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Internal
val generateApiDocumentation = project.objects.property<Boolean>()
/**
* A special-case setting which configures some generators with XML support. In some cases,
* this forces json OR xml, so the default here is false.
*/
@Optional
@Input
@get:Internal
val withXml = project.objects.property<Boolean>()
/**
* To write all log messages (not just errors) to STDOUT
*/
@Optional
@Input
@get:Internal
val logToStderr = project.objects.property<Boolean>()
/**
@@ -411,15 +361,13 @@ open class GenerateTask : DefaultTask() {
* LANG_POST_PROCESS_FILE (e.g. GO_POST_PROCESS_FILE, SCALA_POST_PROCESS_FILE). Please open an issue if your target
* generator does not support this functionality.
*/
@Optional
@Input
@get:Internal
val enablePostProcessFile = project.objects.property<Boolean>()
/**
* To skip spec validation. When true, we will skip the default behavior of validating a spec before generation.
*/
@Optional
@Input
@get:Internal
val skipValidateSpec = project.objects.property<Boolean>()
/**
@@ -427,22 +375,19 @@ open class GenerateTask : DefaultTask() {
* definitions generated as top-level Array-of-items, List-of-items, Map-of-items definitions.
* When true, A model representation either containing or extending the array,list,map (depending on specific generator implementation) will be generated.
*/
@Optional
@Input
@get:Internal
val generateAliasAsModel = project.objects.property<Boolean>()
/**
* A dynamic map of options specific to a generator.
*/
@Optional
@Input
@get:Internal
val configOptions = project.objects.mapProperty<String, String>()
/**
* Templating engine: "mustache" (default) or "handlebars" (beta)
*/
@Optional
@Input
@get:Internal
val engine = project.objects.property<String?>()
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {

View File

@@ -19,18 +19,15 @@ package org.openapitools.generator.gradle.plugin.tasks
import com.samskivert.mustache.Mustache
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
import org.gradle.internal.logging.text.StyledTextOutput
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.kotlin.dsl.property
import org.openapitools.codegen.CodegenConfig
import org.openapitools.codegen.CodegenConstants
import org.openapitools.codegen.SupportingFile
import org.openapitools.codegen.TemplateManager
import org.openapitools.codegen.*
import org.openapitools.codegen.api.TemplatePathLocator
import org.openapitools.codegen.templating.CommonTemplateContentLocator
import org.openapitools.codegen.templating.GeneratorTemplateContentLocator
import org.openapitools.codegen.templating.MustacheEngineAdapter
import org.openapitools.codegen.templating.TemplateManagerOptions
import java.io.File
@@ -42,16 +39,15 @@ import java.nio.charset.Charset
*
* @author Jim Schubert
*/
@CacheableTask
open class MetaTask : DefaultTask() {
@get:Input
@get:Internal
val generatorName = project.objects.property<String>()
@get:Input
@get:Internal
val packageName = project.objects.property<String>()
@get:OutputDirectory
@get:Internal
val outputFolder = project.objects.property<String>()
@Suppress("unused")
@@ -96,9 +92,9 @@ open class MetaTask : DefaultTask() {
val outputFile = File(destinationFolder, it.destinationFilename)
val templateProcessor = TemplateManager(
TemplateManagerOptions(false, false),
MustacheEngineAdapter(),
arrayOf(CommonTemplateContentLocator("codegen"))
TemplateManagerOptions(false, false),
MustacheEngineAdapter(),
arrayOf(CommonTemplateContentLocator("codegen"))
)
val template = templateProcessor.getFullTemplateContents(it.templateFile)

View File

@@ -23,12 +23,7 @@ import io.swagger.v3.parser.core.models.ParseOptions
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.logging.Logging
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import org.gradle.internal.logging.text.StyledTextOutput
@@ -54,12 +49,10 @@ import org.openapitools.codegen.validations.oas.RuleConfiguration
* @author Jim Schubert
*/
open class ValidateTask : DefaultTask() {
@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:Internal
var inputSpec = project.objects.property<String>()
@Optional
@Input
@get:Internal
var recommend = project.objects.property<Boolean?>()
@Suppress("unused")
@@ -82,11 +75,12 @@ open class ValidateTask : DefaultTask() {
val options = ParseOptions()
options.isResolve = true
val result = OpenAPIParser().readLocation(spec, null, options)
val messages = result.messages.toSet()
val out = services.get(StyledTextOutputFactory::class.java).create("openapi")
val ruleConfiguration = RuleConfiguration()
ruleConfiguration.isEnableRecommendations = recommendations

View File

@@ -7,7 +7,7 @@ import java.io.File
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class GenerateTaskDslTest : TestBase() {
class GenerateTaskDslTest : TestBase() {
override var temp: File = createTempDir(javaClass.simpleName)
private val defaultBuildGradle = """
@@ -46,18 +46,18 @@ class GenerateTaskDslTest : TestBase() {
assertTrue(result.output.contains("Successfully generated code to"), "User friendly generate notice is missing.")
listOf(
"build/kotlin/.openapi-generator-ignore",
"build/kotlin/docs/PetsApi.md",
"build/kotlin/docs/Error.md",
"build/kotlin/docs/Pet.md",
"build/kotlin/README.md",
"build/kotlin/build.gradle",
"build/kotlin/.openapi-generator/VERSION",
"build/kotlin/settings.gradle",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Pet.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Error.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/api/PetsApi.kt",
"build/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt"
"build/kotlin/.openapi-generator-ignore",
"build/kotlin/docs/PetsApi.md",
"build/kotlin/docs/Error.md",
"build/kotlin/docs/Pet.md",
"build/kotlin/README.md",
"build/kotlin/build.gradle",
"build/kotlin/.openapi-generator/VERSION",
"build/kotlin/settings.gradle",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Pet.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Error.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/api/PetsApi.kt",
"build/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt"
).map {
val f = File(temp, it)
assertTrue(f.exists() && f.isFile, "An expected file was not generated when invoking the generation.")
@@ -67,61 +67,6 @@ class GenerateTaskDslTest : TestBase() {
"Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}")
}
@Test
fun `openApiGenerate should used up-to-date instead of regenerate`() {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(defaultBuildGradle, projectFiles)
// Act
val resultFirstRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate")
.withPluginClasspath()
.build()
val resultSecondRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate")
.withPluginClasspath()
.build()
// Assert
assertTrue(resultFirstRun.output.contains("Task ':openApiGenerate' is not up-to-date"), "First run should not be up-to-date")
assertTrue(resultSecondRun.output.contains("Task :openApiGenerate UP-TO-DATE"), "Task of second run should be up-to-date")
}
@Test
fun `openApiGenerate should use cache instead of regenerate`() {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(defaultBuildGradle, projectFiles)
// Act
val resultFirstRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--build-cache")
.withPluginClasspath()
.build()
// delete the build directory from the last run
File(temp, "build/kotlin").deleteRecursively()
// re-run
val resultSecondRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--build-cache")
.withPluginClasspath()
.build()
// Assert
assertTrue(resultFirstRun.output.contains("Task ':openApiGenerate' is not up-to-date"), "First run should not be up-to-date")
assertTrue(resultSecondRun.output.contains("Task :openApiGenerate FROM-CACHE"), "Task of second run should be from cache")
}
@Test
fun `openApiValidate should fail on invalid spec`() {
// Arrange
@@ -183,10 +128,10 @@ class GenerateTaskDslTest : TestBase() {
}
@Test
fun `openapiGenerate should attempt to set handlebars when specified as engine`() {
fun `openapiGenerate should attempt to set handlebars when specified as engine`(){
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject("""
@@ -206,16 +151,16 @@ class GenerateTaskDslTest : TestBase() {
// Act
val result = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--stacktrace")
.withPluginClasspath()
.buildAndFail()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--stacktrace")
.withPluginClasspath()
.buildAndFail()
// Assert
// rather than write out full handlebars generator templates, we'll just test that the configurator has set handlebars as the engine.
assertTrue(result.output.contains("HandlebarsException"), "Stack should expose an exception for missing templates.")
assertTrue(result.output.contains("handlebars"), "Build should have attempted to use handlebars.")
assertEquals(TaskOutcome.FAILED, result.task(":openApiGenerate")?.outcome,
"Expected a failed run, but found ${result.task(":openApiGenerate")?.outcome}")
"Expected a failed run, but found ${result.task(":openApiGenerate")?.outcome}")
}
}

View File

@@ -15,8 +15,8 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<spring-boot-version>2.2.9.RELEASE</spring-boot-version>
<springfox-version>3.0.0</springfox-version>
<spring-boot-version>2.0.7.RELEASE</spring-boot-version>
<springfox-version>2.8.0</springfox-version>
<junit-version>4.13</junit-version>
<jackson-version>2.10.2</jackson-version>
</properties>
@@ -105,17 +105,13 @@
<version>${springfox-version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

View File

@@ -23,7 +23,6 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -61,9 +60,4 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
}
};
}
@Bean
ForwardedHeaderFilter forwardedHeaderFilter() {
return new ForwardedHeaderFilter();
}
}

View File

@@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@WebMvcTest(GenApiController.class)
public class GenApiControllerTest {
private static final String OPENAPI_URL = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/v4.3.1/modules/openapi-generator/src/test/resources/petstore.json";
private static final String OPENAPI_URL = "http://petstore.swagger.io/v2/swagger.json";
private static final String UUID_REGEX = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}";
@Autowired
@@ -43,7 +43,7 @@ public class GenApiControllerTest {
public void getLanguages(String type, String expected) throws Exception {
mockMvc.perform(get("/api/gen/" + type))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.[*]").value(hasItem(expected)));
}
@@ -72,7 +72,7 @@ public class GenApiControllerTest {
private void getOptions(String type, String name) throws Exception {
mockMvc.perform(get("/api/gen/" + type + "/" + name))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.sortParamsByRequiredFlag.opt").value("sortParamsByRequiredFlag"));
}
@@ -88,10 +88,10 @@ public class GenApiControllerTest {
private void generateAndDownload(String type, String name) throws Exception {
String result = mockMvc.perform(post("http://test.com:1234/api/gen/" + type + "/" + name)
.contentType(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX)))
.andExpect(jsonPath("$.link").value(matchesPattern("http\\:\\/\\/test.com\\:1234\\/api\\/gen\\/download\\/" + UUID_REGEX)))
.andReturn().getResponse().getContentAsString();
@@ -107,13 +107,13 @@ public class GenApiControllerTest {
@Test
public void generateWIthForwardedHeaders() throws Exception {
String result = mockMvc.perform(post("http://test.com:1234/api/gen/clients/java")
.contentType(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.header("X-Forwarded-Proto", "https")
.header("X-Forwarded-Host", "forwarded.com")
.header("X-Forwarded-Port", "5678")
.content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX)))
.andExpect(jsonPath("$.link").value(matchesPattern("https\\:\\/\\/forwarded.com\\:5678\\/api\\/gen\\/download\\/" + UUID_REGEX)))
.andReturn().getResponse().getContentAsString();

View File

@@ -5653,11 +5653,8 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("debugging fromRequestBodyToFormParameters= " + body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
List<String> allRequired = new ArrayList<String>();
Map<String, Schema> properties = new LinkedHashMap<>();
addProperties(properties, allRequired, schema);
if (!properties.isEmpty()) {
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
Map<String, Schema> properties = schema.getProperties();
for (Map.Entry<String, Schema> entry : properties.entrySet()) {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
// key => property name

View File

@@ -17,10 +17,6 @@
package org.openapitools.codegen;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.callbacks.Callback;
@@ -29,7 +25,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,17 +36,6 @@ public class InlineModelResolver {
private OpenAPI openapi;
private Map<String, Schema> addedModels = new HashMap<String, Schema>();
private Map<String, String> generatedSignature = new HashMap<String, String>();
// structure mapper sorts properties alphabetically on write to ensure models are
// serialized consistently for lookup of existing models
private static ObjectMapper structureMapper;
static {
structureMapper = Json.mapper().copy();
structureMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
structureMapper.writer(new DefaultPrettyPrinter());
}
static Logger LOGGER = LoggerFactory.getLogger(InlineModelResolver.class);
void flatten(OpenAPI openapi) {
@@ -504,25 +488,15 @@ public class InlineModelResolver {
}
private String matchGenerated(Schema model) {
try {
String json = structureMapper.writeValueAsString(model);
if (generatedSignature.containsKey(json)) {
return generatedSignature.get(json);
}
} catch (JsonProcessingException e) {
e.printStackTrace();
String json = Json.pretty(model);
if (generatedSignature.containsKey(json)) {
return generatedSignature.get(json);
}
return null;
}
private void addGenerated(String name, Schema model) {
try {
String json = structureMapper.writeValueAsString(model);
generatedSignature.put(json, name);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
generatedSignature.put(Json.pretty(model), name);
}
/**
@@ -646,45 +620,13 @@ public class InlineModelResolver {
}
XML xml = object.getXml();
Map<String, Schema> properties = object.getProperties();
// NOTE:
// No need to null check setters below. All defaults in the new'd Schema are null, so setting to null would just be a noop.
Schema model = new Schema();
model.setType(object.getType());
// Even though the `format` keyword typically applies to primitive types only,
// the JSON schema specification states `format` can be used for any model type instance
// including object types.
model.setFormat(object.getFormat());
model.setDescription(description);
model.setExample(example);
model.setName(object.getName());
model.setXml(xml);
model.setRequired(object.getRequired());
model.setNullable(object.getNullable());
model.setDiscriminator(object.getDiscriminator());
model.setWriteOnly(object.getWriteOnly());
model.setUniqueItems(object.getUniqueItems());
model.setTitle(object.getTitle());
model.setReadOnly(object.getReadOnly());
model.setPattern(object.getPattern());
model.setNot(object.getNot());
model.setMinProperties(object.getMinProperties());
model.setMinLength(object.getMinLength());
model.setMinItems(object.getMinItems());
model.setMinimum(object.getMinimum());
model.setMaxProperties(object.getMaxProperties());
model.setMaxLength(object.getMaxLength());
model.setMaxItems(object.getMaxItems());
model.setMaximum(object.getMaximum());
model.setExternalDocs(object.getExternalDocs());
model.setExtensions(object.getExtensions());
model.setExclusiveMinimum(object.getExclusiveMinimum());
model.setExclusiveMaximum(object.getExclusiveMaximum());
model.setExample(object.getExample());
model.setDeprecated(object.getDeprecated());
if (properties != null) {
flattenProperties(openAPI, properties, path);
model.setProperties(properties);

View File

@@ -798,7 +798,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
Schema<?> items = getSchemaItems((ArraySchema) schema);
String typeDeclaration = getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, items));
String typeDeclaration = getTypeDeclaration(items);
Object java8obj = additionalProperties.get("java8");
if (java8obj != null) {
Boolean java8 = Boolean.valueOf(java8obj.toString());

View File

@@ -70,7 +70,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0");
protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)");
private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract");
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual or abstract");
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual, abstract or partial");
private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial");
private boolean generateBody = true;
private CliOption buildTarget = new CliOption("buildTarget", "Target to build an application or library");

View File

@@ -476,7 +476,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
+ "/pattern/modifiers convention. " + pattern + " is not valid.");
}
String regex = pattern.substring(1, i).replace("'", "\'").replace("\"", "\"\"");
String regex = pattern.substring(1, i).replace("'", "\'");
List<String> modifiers = new ArrayList<String>();
// perl requires an explicit modifier to be culture specific and .NET is the reverse.

View File

@@ -137,32 +137,44 @@ public class GoClientCodegen extends AbstractGoCodegen {
if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) {
setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString()));
additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment);
if (withGoCodegenComment) {
additionalProperties.put(WITH_GO_CODEGEN_COMMENT, "true");
}
}
if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) {
setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString()));
additionalProperties.put(WITH_AWSV4_SIGNATURE, withAWSV4Signature);
if (withAWSV4Signature) {
additionalProperties.put(WITH_AWSV4_SIGNATURE, "true");
}
}
if (additionalProperties.containsKey(WITH_XML)) {
setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
additionalProperties.put(WITH_XML, withXml);
if (withXml) {
additionalProperties.put(WITH_XML, "true");
}
}
if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) {
setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString()));
additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix);
if (enumClassPrefix) {
additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, "true");
}
}
if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) {
setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString()));
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule);
if (isGoSubmodule) {
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true");
}
}
if (additionalProperties.containsKey(STRUCT_PREFIX)) {
setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString()));
additionalProperties.put(STRUCT_PREFIX, structPrefix);
if (structPrefix) {
additionalProperties.put(STRUCT_PREFIX, "true");
}
}
}

View File

@@ -17,7 +17,12 @@
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.features.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,8 +83,6 @@ public class GoServerCodegen extends AbstractGoCodegen {
optFeatureCORS.defaultValue(corsFeatureEnabled.toString());
cliOptions.add(optFeatureCORS);
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC));
/*
* Models. You can write model files using the modelTemplateFiles map.
* if you want to create one template for file, you can do so here.
@@ -101,7 +104,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
/*
* Service templates. You can write services for each Api file with the apiTemplateFiles map.
These services are skeletons built to implement the logic of your api using the
These services are skeletons built to implement the logic of your api using the
expected parameters and response.
*/
apiTemplateFiles.put(
@@ -163,11 +166,13 @@ public class GoServerCodegen extends AbstractGoCodegen {
if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof Integer) {
this.setServerPort((int) additionalProperties.get("serverPort"));
} else if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof String) {
} else if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof String){
try {
this.setServerPort(Integer.parseInt(additionalProperties.get("serverPort").toString()));
additionalProperties.put("serverPort", serverPort);
} catch (NumberFormatException e) {
}
catch (NumberFormatException e)
{
LOGGER.warn("serverPort is not a valid integer... defaulting to {}", serverPort);
additionalProperties.put("serverPort", serverPort);
}
@@ -180,13 +185,6 @@ public class GoServerCodegen extends AbstractGoCodegen {
additionalProperties.put("featureCORS", corsFeatureEnabled);
}
if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) {
setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString()));
if (enumClassPrefix) {
additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, true);
}
}
modelPackage = packageName;
apiPackage = packageName;

View File

@@ -51,7 +51,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
public static final String USE_RX_JAVA = "useRxJava";
public static final String USE_RX_JAVA2 = "useRxJava2";
public static final String USE_RX_JAVA3 = "useRxJava3";
public static final String USE_COROUTINES = "useCoroutines";
public static final String DO_NOT_USE_RX_AND_COROUTINES = "doNotUseRxAndCoroutines";
@@ -66,7 +65,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
protected String collectionType = CollectionType.LIST.value;
protected boolean useRxJava = false;
protected boolean useRxJava2 = false;
protected boolean useRxJava3 = false;
protected boolean useCoroutines = false;
// backwards compatibility for openapi configs that specify neither rx1 nor rx2
// (mustache does not allow for boolean operators so we need this extra field)
@@ -200,7 +198,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library."));
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA2, "Whether to use the RxJava2 adapter with the retrofit2 library."));
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA3, "Whether to use the RxJava3 adapter with the retrofit2 library."));
cliOptions.add(CliOption.newBoolean(USE_COROUTINES, "Whether to use the Coroutines adapter with the retrofit2 library."));
}
@@ -219,7 +216,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
public void setUseRxJava(boolean useRxJava) {
if (useRxJava) {
this.useRxJava2 = false;
this.useRxJava3 = false;
this.doNotUseRxAndCoroutines = false;
this.useCoroutines = false;
}
@@ -229,28 +225,16 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
public void setUseRxJava2(boolean useRxJava2) {
if (useRxJava2) {
this.useRxJava = false;
this.useRxJava3 = false;
this.doNotUseRxAndCoroutines = false;
this.useCoroutines = false;
}
this.useRxJava2 = useRxJava2;
}
public void setUseRxJava3(boolean useRxJava3) {
if (useRxJava3) {
this.useRxJava = false;
this.useRxJava2 = false;
this.doNotUseRxAndCoroutines = false;
this.useCoroutines = false;
}
this.useRxJava3 = useRxJava3;
}
public void setDoNotUseRxAndCoroutines(boolean doNotUseRxAndCoroutines) {
if (doNotUseRxAndCoroutines) {
this.useRxJava = false;
this.useRxJava2 = false;
this.useRxJava3 = false;
this.useCoroutines = false;
}
this.doNotUseRxAndCoroutines = doNotUseRxAndCoroutines;
@@ -260,7 +244,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
if (useCoroutines) {
this.useRxJava = false;
this.useRxJava2 = false;
this.useRxJava3 = false;
this.doNotUseRxAndCoroutines = false;
}
this.useCoroutines = useCoroutines;
@@ -290,7 +273,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
boolean hasRx = additionalProperties.containsKey(USE_RX_JAVA);
boolean hasRx2 = additionalProperties.containsKey(USE_RX_JAVA2);
boolean hasRx3 = additionalProperties.containsKey(USE_RX_JAVA3);
boolean hasCoroutines = additionalProperties.containsKey(USE_COROUTINES);
int optionCount = 0;
if (hasRx) {
@@ -299,9 +281,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
if (hasRx2) {
optionCount++;
}
if (hasRx3) {
optionCount++;
}
if (hasCoroutines) {
optionCount++;
}
@@ -309,18 +288,16 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
// RxJava & Coroutines
if (hasConflict) {
LOGGER.warn("You specified RxJava versions 1 and 2 and 3 or Coroutines together, please choose one of them.");
LOGGER.warn("You specified both RxJava versions 1 and 2 or Coroutines together, please choose one them.");
} else if (hasRx) {
this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString()));
} else if (hasRx2) {
this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString()));
} else if (hasRx3) {
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
} else if (hasCoroutines) {
this.setUseCoroutines(Boolean.valueOf(additionalProperties.get(USE_COROUTINES).toString()));
}
if (!hasRx && !hasRx2 && !hasRx3 && !hasCoroutines) {
if (!hasRx && !hasRx2 && !hasCoroutines) {
setDoNotUseRxAndCoroutines(true);
additionalProperties.put(DO_NOT_USE_RX_AND_COROUTINES, true);
}
@@ -627,13 +604,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
}
// import okhttp3.MultipartBody if any parameter is a file
for (CodegenParameter param : operation.allParams) {
if (Boolean.TRUE.equals(param.isFile)) {
operations.put("x-kotlin-multipart-import", true);
}
}
if (usesRetrofit2Library() && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) {
operation.path = operation.path.substring(1);
}

View File

@@ -1,18 +1,21 @@
package org.openapitools.codegen.languages;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.DefaultCodegen;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.*;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.parameters.Parameter;
import java.io.File;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import static org.openapitools.codegen.utils.StringUtils.escape;
public class MarkdownDocumentationCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PROJECT_NAME = "projectName";
@@ -46,37 +49,4 @@ public class MarkdownDocumentationCodegen extends DefaultCodegen implements Code
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
// TODO: Fill this out.
}
@Override
protected void initalizeSpecialCharacterMapping() {
// escape only those symbols that can mess up markdown
specialCharReplacements.put("\\", "\\\\");
specialCharReplacements.put("/", "\\/");
specialCharReplacements.put("`", "\\`");
specialCharReplacements.put("*", "\\*");
specialCharReplacements.put("_", "\\_");
specialCharReplacements.put("[", "\\[");
specialCharReplacements.put("]", "\\]");
// todo Current markdown api and model mustache templates display properties and parameters in tables. Pipe
// symbol in a table can be commonly escaped with a backslash (e.g. GFM supports this). However, in some cases
// it may be necessary to choose a different approach.
specialCharReplacements.put("|", "\\|");
}
/**
* Works identically to {@link DefaultCodegen#toParamName(String)} but doesn't camelize.
*
* @param name Codegen property object
* @return the sanitized parameter name
*/
@Override
public String toParamName(String name) {
if (reservedWords.contains(name)) {
return escapeReservedWord(name);
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) {
return escape(name, specialCharReplacements, null, null);
}
return name;
}
}

View File

@@ -105,18 +105,6 @@ public class PhpLumenServerCodegen extends AbstractPhpCodegen {
* are available in models, apis, and supporting files
*/
additionalProperties.put("apiVersion", apiVersion);
}
@Override
public void processOpts() {
super.processOpts();
// reset supporting files defined in AbstractPhpCodegen
supportingFiles.clear();
// AbstractPhpCodegen generates .gitignore in output folder
// current build needs .gitignore in a "lib" folder which is srcBasePath
supportingFiles.add(new SupportingFile("gitignore", srcBasePath, ".gitignore"));
/*
* Supporting Files. You can write single files for the generator with the
@@ -124,11 +112,7 @@ public class PhpLumenServerCodegen extends AbstractPhpCodegen {
* it will be processed by the template engine. Otherwise, it will be copied
*/
supportingFiles.add(new SupportingFile(".env.example", srcBasePath, ".env.example"));
supportingFiles.add(new SupportingFile("storage_logs_gitignore", srcBasePath + File.separator + "storage" + File.separator + "logs", ".gitignore"));
supportingFiles.add(new SupportingFile("storage_logs_gitignore", srcBasePath + File.separator + "storage" + File.separator + "app", ".gitignore"));
supportingFiles.add(new SupportingFile("storage_logs_gitignore", srcBasePath + File.separator + "storage" + File.separator + "framework" + File.separator + "views", ".gitignore"));
supportingFiles.add(new SupportingFile("storage_framework_cache_gitignore", srcBasePath + File.separator + "storage" + File.separator + "framework" + File.separator + "cache", ".gitignore"));
supportingFiles.add(new SupportingFile("storage_logs_gitignore", srcBasePath + File.separator + "storage" + File.separator + "framework" + File.separator + "cache" + File.separator + "data", ".gitignore"));
supportingFiles.add(new SupportingFile("storage_logs_.gitignore", srcBasePath + File.separator + "storage" + File.separator + "logs", ".gitignore"));
supportingFiles.add(new SupportingFile("artisan", srcBasePath, "artisan"));
supportingFiles.add(new SupportingFile("composer.mustache", srcBasePath, "composer.json"));
supportingFiles.add(new SupportingFile("readme.md", srcBasePath, "readme.md"));
@@ -158,9 +142,6 @@ public class PhpLumenServerCodegen extends AbstractPhpCodegen {
supportingFiles.add(new SupportingFile("routes.mustache", srcBasePath + File.separator + "routes", "web.php"));
supportingFiles.add(new SupportingFile("ExampleTest.php", srcBasePath + File.separator + "tests", "ExampleTest.php"));
supportingFiles.add(new SupportingFile("TestCase.php", srcBasePath + File.separator + "tests", "TestCase.php"));
supportingFiles.add(new SupportingFile("editorconfig", srcBasePath, ".editorconfig"));
supportingFiles.add(new SupportingFile("styleci", srcBasePath, ".styleci.yml"));
supportingFiles.add(new SupportingFile("phpunit.xml", srcBasePath, "phpunit.xml"));
}
// override with any special post-processing

View File

@@ -148,14 +148,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return {{classname}}.schemas;
}
/**
* Set the instance that matches the anyOf child schema, check
* the instance parameter is valid against the anyOf child schemas:
* {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}
*
* It could be an instance of the 'anyOf' schemas.
* The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf).
*/
@Override
public void setActualInstance(Object instance) {
{{#isNullable}}
@@ -174,29 +166,4 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/anyOf}}
throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}");
}
/**
* Get the actual instance, which can be the following:
* {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}
*
* @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}})
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
{{#anyOf}}
/**
* Get the actual instance of `{{{.}}}`. If the actual instanct is not `{{{.}}}`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `{{{.}}}`
* @throws ClassCastException if the instance is not `{{{.}}}`
*/
public {{{.}}} get{{{.}}}() throws ClassCastException {
return ({{{.}}})super.getActualInstance();
}
{{/anyOf}}
}

View File

@@ -137,9 +137,9 @@ ext {
{{#hasOAuthMethods}}
scribejava_apis_version = "6.9.0"
{{/hasOAuthMethods}}
{{#hasHttpSignatureMethods}}
tomitribe_http_signatures_version = "1.5"
{{/hasHttpSignatureMethods}}
{{#hasHttpBasicMethods}}
tomitribe_http_signatures_version = "1.3"
{{/hasHttpBasicMethods}}
}
dependencies {
@@ -161,9 +161,9 @@ dependencies {
{{#hasOAuthMethods}}
compile "com.github.scribejava:scribejava-apis:$scribejava_apis_version"
{{/hasOAuthMethods}}
{{#hasHttpSignatureMethods}}
{{#hasHttpBasicMethods}}
compile "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version"
{{/hasHttpSignatureMethods}}
{{/hasHttpBasicMethods}}
{{#supportJava6}}
compile "commons-io:commons-io:$commons_io_version"
compile "org.apache.commons:commons-lang3:$commons_lang3_version"

View File

@@ -28,9 +28,9 @@ lazy val root = (project in file(".")).
{{#hasOAuthMethods}}
"com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile",
{{/hasOAuthMethods}}
{{#hasHttpSignatureMethods}}
"org.tomitribe" % "tomitribe-http-signatures" % "1.5" % "compile",
{{/hasHttpSignatureMethods}}
{{#hasHttpBasicMethods}}
"org.tomitribe" % "tomitribe-http-signatures" % "1.3" % "compile",
{{/hasHttpBasicMethods}}
{{^java8}}
"com.brsanthu" % "migbase64" % "2.2",
{{/java8}}

View File

@@ -183,8 +183,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}
* the instance parameter is valid against the oneOf child schemas.
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
@@ -208,28 +207,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}");
}
/**
* Get the actual instance, which can be the following:
* {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}
*
* @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}})
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
{{#oneOf}}
/**
* Get the actual instance of `{{{.}}}`. If the actual instanct is not `{{{.}}}`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `{{{.}}}`
* @throws ClassCastException if the instance is not `{{{.}}}`
*/
public {{{.}}} get{{{.}}}() throws ClassCastException {
return ({{{.}}})super.getActualInstance();
}
{{/oneOf}}
}

View File

@@ -1083,9 +1083,6 @@ public class ApiClient {
} catch (ApiException e) {
callback.onFailure(e, response.code(), response.headers().toMultimap());
return;
} catch (Exception e) {
callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap());
return;
}
callback.onSuccess(result, response.code(), response.headers().toMultimap());
}

View File

@@ -134,19 +134,19 @@ public class {{classname}} {
formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
{{/hasMore}}{{/formParams}}{{/hasFormParams}}
final String[] localVarAccepts = { {{#hasProduces}}
final String[] accepts = { {{#hasProduces}}
{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
{{/hasProduces}} };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
{{/hasProduces}}};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { {{#hasConsumes}}
{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
{{/hasConsumes}} };
{{/hasConsumes}}};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
{{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};{{/returnType}}
return apiClient.invokeAPI(path, HttpMethod.{{httpMethod}}, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.{{httpMethod}}, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
}
{{/operation}}
}

View File

@@ -1,32 +1,10 @@
package {{apiPackage}};
/**
* The exception that can be used to store the HTTP status code returned by an API response.
*/
{{>generatedAnnotation}}
public class ApiException extends Exception {
/** The HTTP status code. */
public class ApiException extends Exception{
private int code;
/**
* Constructor.
*
* @param code The HTTP status code.
* @param msg The error message.
*/
public ApiException(int code, String msg) {
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
/**
* Get the HTTP status code.
*
* @return The HTTP status code.
*/
public int getCode() {
return code;
}
}

View File

@@ -1,32 +1,10 @@
package {{apiPackage}};
/**
* The exception that can be used to store the HTTP status code returned by an API response.
*/
{{>generatedAnnotation}}
public class ApiException extends Exception {
/** The HTTP status code. */
public class ApiException extends Exception{
private int code;
/**
* Constructor.
*
* @param code The HTTP status code.
* @param msg The error message.
*/
public ApiException(int code, String msg) {
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
/**
* Get the HTTP status code.
*
* @return The HTTP status code.
*/
public int getCode() {
return code;
}
}

View File

@@ -1,32 +1,10 @@
package {{apiPackage}};
/**
* The exception that can be used to store the HTTP status code returned by an API response.
*/
{{>generatedAnnotation}}
public class ApiException extends Exception {
/** The HTTP status code. */
public class ApiException extends Exception{
private int code;
/**
* Constructor.
*
* @param code The HTTP status code.
* @param msg The error message.
*/
public ApiException(int code, String msg) {
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
/**
* Get the HTTP status code.
*
* @return The HTTP status code.
*/
public int getCode() {
return code;
}
}

View File

@@ -541,15 +541,12 @@
{{/usePromises}} };
{{#emitJSDoc}} /**
* Parses an ISO-8601 string representation or epoch representation of a date value.
* Parses an ISO-8601 string representation of a date value.
* @param {String} str The date value as a string.
* @returns {Date} The parsed date object.
*/
{{/emitJSDoc}} exports.parseDate = function(str) {
if (isNaN(str)) {
return new Date(str.replace(/T/i, ' '));
}
return new Date(+str);
return new Date(str.replace(/T/i, ' '));
};
{{#emitJSDoc}} /**

View File

@@ -519,15 +519,12 @@ class ApiClient {
}
{{#emitJSDoc}}/**
* Parses an ISO-8601 string representation or epoch representation of a date value.
* Parses an ISO-8601 string representation of a date value.
* @param {String} str The date value as a string.
* @returns {Date} The parsed date object.
*/{{/emitJSDoc}}
static parseDate(str) {
if (isNaN(str)) {
return new Date(str);
}
return new Date(+str);
return new Date(str);
}
{{#emitJSDoc}}/**

View File

@@ -14,7 +14,7 @@ namespace {{packageName}}
/// <param name="args"></param>
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
CreateWebHostBuilder(args).Build().Run();
}
/// <summary>
@@ -22,7 +22,7 @@ namespace {{packageName}}
/// </summary>
/// <param name="args"></param>
/// <returns>IHostBuilder</returns>
public static IHostBuilder CreateHostBuilder(string[] args) =>
public static IHostBuilder CreateWebHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
@@ -30,4 +30,4 @@ namespace {{packageName}}
.UseUrls("http://0.0.0.0:{{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}8080{{/serverPort}}/");
});
}
}
}

View File

@@ -448,7 +448,7 @@ namespace {{packageName}}.Client
}
{{#supportsAsync}}
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration)
{
RestClient client = new RestClient(_baseUrl);
@@ -479,7 +479,7 @@ namespace {{packageName}}.Client
InterceptRequest(req);
var response = await client.ExecuteAsync<T>(req, cancellationToken);
var response = await client.ExecuteAsync<T>(req);
InterceptResponse(req, response);
@@ -526,12 +526,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), config);
}
/// <summary>
@@ -541,12 +540,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), config);
}
/// <summary>
@@ -556,12 +554,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), config);
}
/// <summary>
@@ -571,12 +568,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), config);
}
/// <summary>
@@ -586,12 +582,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), config);
}
/// <summary>
@@ -601,12 +596,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), config);
}
/// <summary>
@@ -616,12 +610,11 @@ namespace {{packageName}}.Client
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), config, cancellationToken);
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), config);
}
#endregion IAsynchronousClient
{{/supportsAsync}}

View File

@@ -21,12 +21,6 @@ namespace {{packageName}}.Client
/// <value>The error content (Http response body).</value>
public object ErrorContent { get; private set; }
/// <summary>
/// Gets or sets the HTTP headers
/// </summary>
/// <value>HTTP headers</value>
public Multimap<string, string> Headers { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
@@ -48,12 +42,10 @@ namespace {{packageName}}.Client
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
/// <param name="headers">HTTP Headers.</param>
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
public ApiException(int errorCode, string message, object errorContent = null) : base(message)
{
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
this.Headers = headers;
}
}

View File

@@ -47,7 +47,7 @@ namespace {{packageName}}.Client
{
return new ApiException(status,
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
response.RawContent, response.Headers);
response.RawContent);
}
{{^netStandard}}if (status == 0)
{

View File

@@ -19,10 +19,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> GetAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> GetAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
@@ -30,10 +29,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PostAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> PostAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
@@ -41,10 +39,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PutAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> PutAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
@@ -52,10 +49,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> DeleteAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> DeleteAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
@@ -63,10 +59,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> HeadAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> HeadAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
@@ -74,10 +69,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> OptionsAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> OptionsAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
@@ -85,10 +79,9 @@ namespace {{packageName}}.Client
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PatchAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Task<ApiResponse<T>> PatchAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
}
}
{{^supportsAsync}}*/{{/supportsAsync}}

View File

@@ -61,12 +61,9 @@ namespace {{packageName}}.{{apiPackage}}
/// {{notes}}
/// </remarks>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#returnType}}System.Threading.Tasks.Task<{{{returnType}}}>{{/returnType}}{{^returnType}}System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <returns>Task of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#returnType}}System.Threading.Tasks.Task<{{{returnType}}}>{{/returnType}}{{^returnType}}System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
/// <summary>
/// {{summary}}
@@ -75,12 +72,9 @@ namespace {{packageName}}.{{apiPackage}}
/// {{notes}}
/// </remarks>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/operation}}
#endregion Asynchronous Operations
}
@@ -382,27 +376,22 @@ namespace {{packageName}}.{{apiPackage}}
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#returnType}}public async System.Threading.Tasks.Task<{{{returnType}}}>{{/returnType}}{{^returnType}}public async System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <returns>Task of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#returnType}}public async System.Threading.Tasks.Task<{{{returnType}}}>{{/returnType}}{{^returnType}}public async System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{
{{#returnType}}{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);
return localVarResponse.Data;{{/returnType}}{{^returnType}}await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);{{/returnType}}
{{#returnType}}{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = await {{operationId}}AsyncWithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return localVarResponse.Data;{{/returnType}}{{^returnType}}await {{operationId}}AsyncWithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/returnType}}
}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
public async System.Threading.Tasks.Task<{{packageName}}.Client.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
public async System.Threading.Tasks.Task<{{packageName}}.Client.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{
{{#allParams}}
{{#required}}
@@ -545,7 +534,7 @@ namespace {{packageName}}.{{apiPackage}}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration, cancellationToken);
var localVarResponse = await this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{

View File

@@ -23,9 +23,9 @@
{{#termsOfService}}
<copyright>{{termsOfService}}</copyright>
{{/termsOfService}}
{{#license}}
<license type="expression">{{{license}}}</license>
{{/license}}
{{#licenseUrl}}
<licenseUrl>{{licenseUrl}}</licenseUrl>
{{/licenseUrl}}
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>

View File

@@ -72,7 +72,7 @@ namespace {{packageName}}.{{apiPackage}}
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}CancellationToken cancellationToken = default(CancellationToken));
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}CancellationToken cancellationToken = default(CancellationToken));
{{/operation}}
#endregion Asynchronous Operations
{{/supportsAsync}}
@@ -340,8 +340,8 @@ namespace {{packageName}}.{{apiPackage}}
/// <returns>Task of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#returnType}}public async System.Threading.Tasks.Task<{{{returnType}}}>{{/returnType}}{{^returnType}}public async System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}CancellationToken cancellationToken = default(CancellationToken))
{
{{#returnType}}ApiResponse<{{{returnType}}}> localVarResponse = await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);
return localVarResponse.Data;{{/returnType}}{{^returnType}}await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);{{/returnType}}
{{#returnType}}ApiResponse<{{{returnType}}}> localVarResponse = await {{operationId}}AsyncWithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);
return localVarResponse.Data;{{/returnType}}{{^returnType}}await {{operationId}}AsyncWithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);{{/returnType}}
}
@@ -352,7 +352,7 @@ namespace {{packageName}}.{{apiPackage}}
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
public async System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}CancellationToken cancellationToken = default(CancellationToken))
public async System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}CancellationToken cancellationToken = default(CancellationToken))
{
{{#allParams}}
{{#required}}

View File

@@ -23,9 +23,9 @@
{{#termsOfService}}
<copyright>{{termsOfService}}</copyright>
{{/termsOfService}}
{{#license}}
<license type="expression">{{{license}}}</license>
{{/license}}
{{#licenseUrl}}
<licenseUrl>{{licenseUrl}}</licenseUrl>
{{/licenseUrl}}
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>

View File

@@ -89,19 +89,19 @@ class {{classname}} {
(json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
{{/isMapContainer}}
{{^isMapContainer}}
{{#isNumber}}
{{#isDouble}}
{{name}} = (json['{{baseName}}'] == null) ?
null :
json['{{baseName}}'].toDouble();
{{/isNumber}}
{{^isNumber}}
{{/isDouble}}
{{^isDouble}}
{{^isEnum}}
{{name}} = json['{{baseName}}'];
{{/isEnum}}
{{#isEnum}}
{{name}} = {{classname}}{{{enumName}}}.fromJson(json['{{baseName}}']);
{{/isEnum}}
{{/isNumber}}
{{/isDouble}}
{{/isMapContainer}}
{{/isListContainer}}
{{/complexType}}

View File

@@ -26,14 +26,12 @@ type api{{operationId}}Request struct {
{{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}}
}
{{#allParams}}
{{^isPathParam}}
{{#allParams}}{{^isPathParam}}
func (r api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) api{{operationId}}Request {
r.{{paramName}} = &{{paramName}}
return r
}
{{/isPathParam}}
{{/allParams}}
{{/isPathParam}}{{/allParams}}
/*
{{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}}
{{#notes}}
@@ -53,9 +51,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParam
/*
Execute executes the request
{{#returnType}}
@return {{{.}}}
{{/returnType}}
{{#returnType}} @return {{{.}}}{{/returnType}}
*/
func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) {
var (
@@ -64,9 +60,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
{{#returnType}}
localVarReturnValue {{{.}}}
{{/returnType}}
{{#returnType}}localVarReturnValue {{{.}}}{{/returnType}}
)
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}")
@@ -81,12 +75,10 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
{{#allParams}}
{{#required}}
{{^isPathParam}}
{{#required}}{{^isPathParam}}
if r.{{paramName}} == nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified")
}
{{/isPathParam}}
}{{/isPathParam}}
{{#minItems}}
if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements")

View File

@@ -17,7 +17,7 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
{{/isNullable}}
{{#discriminator}}
{{#mappedModels}}
{{#-first}}
{{#-first}}
// use discriminator value to speed up the lookup
var jsonDict map[string]interface{}
err := json.Unmarshal(data, &jsonDict)
@@ -25,7 +25,7 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.")
}
{{/-first}}
{{/-first}}
// check if the discriminator value is '{{{mappingName}}}'
if jsonDict["{{{propertyBaseName}}}"] == "{{{mappingName}}}" {
// try to unmarshal JSON data into {{{modelName}}}

View File

@@ -40,7 +40,7 @@ const (
// The 'Host' header, as defined in RFC 2616, section 14.23.
HttpHeaderHost string = "Host"
// The 'Date' header.
HttpHeaderDate string = "Date"
HttpHeaderDate string = "Date"
// The digest header, as defined in RFC 3230, section 4.3.2.
HttpHeaderDigest string = "Digest"
// The HTTP Authorization header, as defined in RFC 7235, section 4.2.
@@ -106,7 +106,7 @@ type HttpSignatureAuth struct {
SigningScheme string // The signature scheme, when signing HTTP requests. Supported value is 'hs2019'.
// The signature algorithm, when signing HTTP requests.
// Supported values are RSASSA-PKCS1-v1_5, RSASSA-PSS.
SigningAlgorithm string
SigningAlgorithm string
SignedHeaders []string // A list of HTTP headers included when generating the signature for the message.
// SignatureMaxValidity specifies the maximum duration of the signature validity.
// The value is used to set the '(expires)' signature parameter in the HTTP request.

View File

@@ -41,49 +41,32 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
{{/hasFormParams}}{{#hasPathParams}}
params := mux.Vars(r){{/hasPathParams}}{{#hasQueryParams}}
query := r.URL.Query(){{/hasQueryParams}}{{#allParams}}{{#isPathParam}}{{#isLong}}
{{paramName}}, err := parseInt64Parameter(params["{{paramName}}"])
if err != nil {
w.WriteHeader(500)
return
}{{/isLong}}{{#isInteger}}
{{paramName}}, err := parseInt32Parameter(params["{{paramName}}"])
{{paramName}}, err := parseIntParameter(params["{{paramName}}"])
if err != nil {
w.WriteHeader(500)
return
}
{{/isInteger}}{{^isLong}}{{^isInteger}}
{{paramName}} := params["{{paramName}}"]{{/isInteger}}{{/isLong}}{{/isPathParam}}{{#isQueryParam}}{{#isLong}}
{{paramName}}, err := parseInt64Parameter(query.Get("{{paramName}}"))
{{/isLong}}{{^isLong}}
{{paramName}} := params["{{paramName}}"]{{/isLong}}{{/isPathParam}}{{#isQueryParam}}{{#isLong}}
{{paramName}}, err := parseIntParameter(query.Get("{{paramName}}"))
if err != nil {
w.WriteHeader(500)
return
}
{{/isLong}}{{#isInteger}}
{{paramName}}, err := parseInt32Parameter(query.Get("{{paramName}}"))
if err != nil {
w.WriteHeader(500)
return
}
{{/isInteger}}{{^isLong}}{{^isInteger}}
{{paramName}} := {{#isListContainer}}strings.Split({{/isListContainer}}query.Get("{{paramName}}"){{#isListContainer}}, ","){{/isListContainer}}{{/isInteger}}{{/isLong}}{{/isQueryParam}}{{#isFormParam}}{{#isFile}}
{{/isLong}}{{^isLong}}
{{paramName}} := {{#isListContainer}}strings.Split({{/isListContainer}}query.Get("{{paramName}}"){{#isListContainer}}, ","){{/isListContainer}}{{/isLong}}{{/isQueryParam}}{{#isFormParam}}{{#isFile}}
{{paramName}}, err := ReadFormFileToTempFile(r, "{{paramName}}")
if err != nil {
w.WriteHeader(500)
return
}
{{/isFile}}{{#isLong}}
{{paramName}}, err := parseInt64Parameter( r.FormValue("{{paramName}}"))
{{paramName}}, err := parseIntParameter( r.FormValue("{{paramName}}"))
if err != nil {
w.WriteHeader(500)
return
}
{{/isLong}}{{#isInteger}}
{{paramName}}, err := parseInt32Parameter( r.FormValue("{{paramName}}"))
if err != nil {
w.WriteHeader(500)
return
}
{{/isInteger}}{{^isFile}}{{^isLong}}
{{/isLong}}{{^isFile}}{{^isLong}}
{{paramName}} := r.FormValue("{{paramName}}"){{/isLong}}{{/isFile}}{{/isFormParam}}{{#isHeaderParam}}
{{paramName}} := r.Header.Get("{{paramName}}"){{/isHeaderParam}}{{#isBodyParam}}
{{paramName}} := &{{dataType}}{}

View File

@@ -11,7 +11,7 @@ type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/form
const (
{{#allowableValues}}
{{#enumVars}}
{{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}}
{{name}} {{{classname}}} = {{{value}}}
{{/enumVars}}
{{/allowableValues}}
){{/isEnum}}{{^isEnum}}{{#description}}

View File

@@ -88,16 +88,7 @@ func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error) {
return file, nil
}
// parseInt64Parameter parses a sting parameter to an int64
func parseInt64Parameter(param string) (int64, error) {
// parseIntParameter parses a sting parameter to an int64
func parseIntParameter(param string) (int64, error) {
return strconv.ParseInt(param, 10, 64)
}
// parseInt32Parameter parses a sting parameter to an int32
func parseInt32Parameter(param string) (int32, error) {
val, err := strconv.ParseInt(param, 10, 32)
if err != nil {
return -1, err
}
return int32(val), nil
}

View File

@@ -7,7 +7,6 @@ import (
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
_bytes "bytes"
{{#imports}} "{{import}}"
{{/imports}}
)
@@ -310,7 +309,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
}

View File

@@ -1,32 +1,10 @@
package {{apiPackage}};
/**
* The exception that can be used to store the HTTP status code returned by an API response.
*/
{{>generatedAnnotation}}
public class ApiException extends Exception {
/** The HTTP status code. */
public class ApiException extends Exception{
private int code;
/**
* Constructor.
*
* @param code The HTTP status code.
* @param msg The error message.
*/
public ApiException(int code, String msg) {
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
/**
* Get the HTTP status code.
*
* @return The HTTP status code.
*/
public int getCode() {
return code;
}
}

View File

@@ -17,9 +17,6 @@ buildscript {
{{#useRxJava2}}
ext.rxJava2Version = '2.2.17'
{{/useRxJava2}}
{{#useRxJava3}}
ext.rxJava3Version = '3.0.4'
{{/useRxJava3}}
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -101,10 +98,6 @@ dependencies {
compile "io.reactivex.rxjava2:rxjava:$rxJava2Version"
compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
{{/useRxJava2}}
{{#useRxJava3}}
compile "io.reactivex.rxjava3:rxjava:$rxJava3Version"
compile "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
{{/useRxJava3}}
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
{{#gson}}
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"

View File

@@ -24,16 +24,10 @@ import rx.Observable
{{#useRxJava2}}
import io.reactivex.Single
{{/useRxJava2}}
{{#useRxJava3}}
import io.reactivex.rxjava3.core.Single;
{{/useRxJava3}}
{{^returnType}}
{{#useRxJava2}}
import io.reactivex.Completable
{{/useRxJava2}}
{{#useRxJava3}}
import io.reactivex.rxjava3.core.Completable;
{{/useRxJava3}}
{{/returnType}}
{{/doNotUseRxAndCoroutines}}
@@ -41,12 +35,6 @@ import io.reactivex.rxjava3.core.Completable;
{{/imports}}
{{#operations}}
{{#x-kotlin-multipart-import}}
{{^isMultipart}}
import okhttp3.MultipartBody
{{/isMultipart}}
{{/x-kotlin-multipart-import}}
interface {{classname}} {
{{#operation}}
/**
@@ -78,8 +66,8 @@ interface {{classname}} {
{{/prioritizedContentTypes}}
{{/formParams}}
@{{httpMethod}}("{{{path}}}")
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{^allParams}}){{/allParams}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}){{/hasMore}}{{/allParams}}: {{^doNotUseRxAndCoroutines}}{{#useRxJava}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useRxJava}}{{#useRxJava2}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava2}}{{#useRxJava3}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava3}}{{#useCoroutines}}Response<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useCoroutines}}{{/doNotUseRxAndCoroutines}}{{#doNotUseRxAndCoroutines}}Call<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/doNotUseRxAndCoroutines}}
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{^allParams}}){{/allParams}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}){{/hasMore}}{{/allParams}}: {{^doNotUseRxAndCoroutines}}{{#useRxJava}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useRxJava}}{{#useRxJava2}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava2}}{{#useCoroutines}}Response<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useCoroutines}}{{/doNotUseRxAndCoroutines}}{{#doNotUseRxAndCoroutines}}Call<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/doNotUseRxAndCoroutines}}
{{/operation}}
}
{{/operations}}
{{/operations}}

View File

@@ -32,9 +32,6 @@ import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
{{#useRxJava2}}
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
{{/useRxJava2}}
{{#useRxJava3}}
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
{{/useRxJava3}}
{{#gson}}
import com.google.gson.Gson
import com.google.gson.GsonBuilder
@@ -48,8 +45,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory
{{#nonPublicApi}}internal {{/nonPublicApi}}class ApiClient(
private var baseUrl: String = defaultBasePath,
private val okHttpClientBuilder: OkHttpClient.Builder? = null,
private val serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder,
private val okHttpClient : OkHttpClient? = null
private val serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder
) {
private val apiAuthorizations = mutableMapOf<String, Interceptor>()
var logger: ((String) -> Unit)? = null
@@ -66,9 +62,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory
{{/useRxJava}}
{{#useRxJava2}}
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
{{/useRxJava2}}{{#useRxJava3}}
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
{{/useRxJava3}}
{{/useRxJava2}}
{{#moshi}}
.addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build()))
{{/moshi}}
@@ -287,9 +281,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory
}
fun <S> createService(serviceClass: Class<S>): S {
var usedClient: OkHttpClient? = null
this.okHttpClient?.let { usedClient = it } ?: run {usedClient = clientBuilder.build()}
return retrofitBuilder.client(usedClient).build().create(serviceClass)
return retrofitBuilder.client(clientBuilder.build()).build().create(serviceClass)
}
private fun normalizeBaseUrl() {

View File

@@ -1,8 +1,6 @@
APP_NAME=Lumen
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_KEY=
APP_TIMEZONE=UTC
LOG_CHANNEL=stack
@@ -16,4 +14,4 @@ DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
QUEUE_DRIVER=sync

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Providers;
use App\User;

View File

@@ -1,6 +1,11 @@
<?php
{{>licenseInfoLumen}}
/*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace App\Http\Middleware;
use Closure;

View File

@@ -1,6 +1,11 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace App\Http\Controllers;
use Laravel\Lumen\Routing\Controller as BaseController;

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Events;
use Illuminate\Queue\SerializesModels;

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Providers;
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
@@ -13,8 +12,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
\App\Events\ExampleEvent::class => [
\App\Listeners\ExampleListener::class,
'App\Events\ExampleEvent' => [
'App\Listeners\ExampleListener',
],
];
}

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Http\Controllers;
class ExampleController extends Controller

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Events;
class ExampleEvent extends Event

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Jobs;
class ExampleJob extends Job

View File

@@ -1,11 +1,10 @@
<?php
{{>licenseInfoLumen}}
namespace App\Listeners;
use App\Events\ExampleEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class ExampleListener
{
@@ -22,7 +21,7 @@ class ExampleListener
/**
* Handle the event.
*
* @param \App\Events\ExampleEvent $event
* @param ExampleEvent $event
* @return void
*/
public function handle(ExampleEvent $event)

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
namespace App\Http\Middleware;
use Closure;

View File

@@ -1,6 +1,5 @@
<?php
{{>licenseInfoLumen}}
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;

View File

@@ -1,14 +1,19 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Validation\ValidationException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@@ -29,27 +34,23 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @param \Exception $e
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
public function report(Exception $e)
{
parent::report($exception);
parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws \Throwable
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Throwable $exception)
public function render($request, Exception $e)
{
return parent::render($request, $exception);
return parent::render($request, $e);
}
}

View File

@@ -1,12 +1,11 @@
<?php
{{>licenseInfoLumen}}
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
abstract class Job implements ShouldQueue
{

View File

@@ -1,6 +1,11 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;

View File

@@ -1,23 +1,17 @@
<?php
{{>licenseInfoLumen}}
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(User::class, function (Faker $faker) {
$factory->define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->email,

View File

@@ -1,9 +1,6 @@
<?php
{{>licenseInfoLumen}}
use Laravel\Lumen\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
abstract class TestCase extends Laravel\Lumen\Testing\TestCase
{
/**
* Creates the application.

View File

@@ -1,15 +1,22 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Database\Eloquent\Model;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
class User extends Model implements AuthenticatableContract, AuthorizableContract
class User extends Model implements
AuthenticatableContract,
AuthorizableContract
{
use Authenticatable, Authorizable;

View File

@@ -1,13 +1,18 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
require_once __DIR__.'/../vendor/autoload.php';
(new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
dirname(__DIR__)
))->bootstrap();
date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
try {
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
//
}
/*
|--------------------------------------------------------------------------
@@ -21,7 +26,7 @@ date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
*/
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
realpath(__DIR__.'/../')
);
// $app->withFacades();
@@ -49,19 +54,6 @@ $app->singleton(
App\Console\Kernel::class
);
/*
|--------------------------------------------------------------------------
| Register Config Files
|--------------------------------------------------------------------------
|
| Now we will register the "app" configuration file. If the file exists in
| your configuration directory it will be loaded; otherwise, we'll load
| the default version. You may register other files below as needed.
|
*/
$app->configure('app');
/*
|--------------------------------------------------------------------------
| Register Middleware
@@ -74,7 +66,7 @@ $app->configure('app');
*/
// $app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
// App\Http\Middleware\ExampleMiddleware::class
// ]);
// $app->routeMiddleware([
@@ -113,4 +105,6 @@ $app->router->group([
require __DIR__.'/../routes/web.php';
});
$app->withFacades();
return $app;

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env php
<?php
{{>licenseInfoLumen}}
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;

View File

@@ -24,26 +24,29 @@
],
"type": "project",
"require": {
"php": "^7.2.5",
"laravel/lumen-framework": "^7.2"
"php": ">=7.1.3",
"laravel/lumen-framework": "5.6.*",
"vlucas/phpdotenv": "~2.2"
},
"require-dev": {
"fzaninotto/faker": "^1.9",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^8.0 || ^9.0"
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~7.0",
"mockery/mockery": "~1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
"tests/",
"database/"
]
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
@@ -52,10 +55,5 @@
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
"prefer-stable": true
}

View File

@@ -1,15 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

View File

@@ -1,6 +1,8 @@
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
.phpunit.result.cache
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock

View File

@@ -1,6 +1,11 @@
<?php
{{>licenseInfoLumen}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
|--------------------------------------------------------------------------
| Create The Application

View File

@@ -1,7 +1,7 @@
/**
* {{{appName}}}
* {{{appDescription}}}
* PHP version 7.2.5
* PHP version 7.1.3
*
* {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}}
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}

View File

@@ -1,3 +0,0 @@
/**
* The Lumen framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
*/

View File

@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/app.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
@@ -14,8 +20,9 @@
</whitelist>
</filter>
<php>
<ini name="error_reporting" value="E_ALL" />
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

View File

@@ -1,7 +1,7 @@
# OpenAPITools generated server
## Requirements
* PHP 7.2.5 or newer
* PHP 7.1.3 or newer
## Overview
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the
@@ -18,15 +18,9 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how
Switch to the generated Lumen server stub directory.
Using `composer update` to install the framework and dependencies via [Composer](http://getcomposer.org/).
### Init App Config
Use `.env.example` as starting point for a new application config:
```console
$ composer run post-root-package-install
```
## Note
The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after executing `composer update`.
The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after excuting `composer update`.
Or there would be errors during service or model migration.
### Running the generated server stub

View File

@@ -1,23 +1,11 @@
<?php
{{>licenseInfo}}
{{>licenseInfoLumen}}
{{#apiInfo}}/**
* {{appName}}
* @version {{appVersion}}
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$router->get('/', function () use ($router) {
return $router->app->version();
});
@@ -31,8 +19,8 @@ $router->get('/', function () use ($router) {
* Notes: {{notes}}
*/
$router->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', '{{classname}}@{{operationId}}');
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}

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