diff --git a/.github/workflows/samples-java-client-jdk11.yaml b/.github/workflows/samples-java-client-jdk11.yaml index 11eb1fb933cd..a8d60c39b35d 100644 --- a/.github/workflows/samples-java-client-jdk11.yaml +++ b/.github/workflows/samples-java-client-jdk11.yaml @@ -73,6 +73,7 @@ jobs: - samples/client/petstore/java/resttemplate-swagger2/ - samples/openapi3/client/petstore/java/jersey2-java8-swagger2/ - samples/client/others/java/okhttp-gson-oneOf/ + - samples/client/echo_api/java/okhttp-gson-user-defined-templates/ - samples/client/others/java/resttemplate-useAbstractionForFiles/ - samples/client/others/java/webclient-useAbstractionForFiles/ - samples/client/others/java/jersey2-oneOf-duplicates/ diff --git a/.github/workflows/samples-php8.yaml b/.github/workflows/samples-php8.yaml index 82ead5c953a6..0d2941f6e3ce 100644 --- a/.github/workflows/samples-php8.yaml +++ b/.github/workflows/samples-php8.yaml @@ -4,9 +4,11 @@ on: push: paths: - samples/server/petstore/php-symfony/SymfonyBundle-php/** + - samples/server/petstore/php-flight/** pull_request: paths: - samples/server/petstore/php-symfony/SymfonyBundle-php/** + - samples/server/petstore/php-flight/** jobs: build: name: Build PHP projects @@ -17,6 +19,7 @@ jobs: sample: # servers - samples/server/petstore/php-symfony/SymfonyBundle-php/ + - samples/server/petstore/php-flight/ steps: - uses: actions/checkout@v4 - name: Setup PHP with tools diff --git a/README.md b/README.md index 89b69acd3651..ce5e47055f5c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@
-[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.5.0`): +[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.6.0`): [![Build Status](https://api.travis-ci.com/OpenAPITools/openapi-generator.svg?branch=master&status=passed)](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator) @@ -126,8 +126,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20 | OpenAPI Generator Version | Release Date | Notes | | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- | -| 7.5.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.5.0-SNAPSHOT/) | 12.04.2024 | Minor release with breaking changes (with fallback) | -| [7.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.4.0) (latest stable release) | 11.03.2024 | Minor release with breaking changes (with fallback) | +| 7.6.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.6.0-SNAPSHOT/) | 17.54.2024 | Minor release with breaking changes (with fallback) | +| [7.5.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.5.0) (latest stable release) | 17.04.2024 | Minor release with breaking changes (with fallback) | | [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) | | [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) | | [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) | @@ -190,16 +190,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum): -JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar` +JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar` For **Mac/Linux** users: ```sh -wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar -O openapi-generator-cli.jar +wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar -O openapi-generator-cli.jar ``` For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. ``` -Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -705,6 +705,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [REST United](https://restunited.com) - [Robocorp](https://www.robocorp.com) - [Robotinfra](https://www.robotinfra.com) +- [SearchApi](https://www.searchapi.io/) - [SmartHR](https://smarthr.co.jp/) - [Sony Interactive Entertainment](https://www.sie.com/en/index.html) - [Splitit](https://www.splitit.com/) @@ -931,6 +932,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2023-12-10 - [UnityでOpenAPI Generatorを使う](https://www.youtube.com/watch?v=CbNwKVV5LRM) by [Soup Tori](https://www.youtube.com/@souptori8417) - 2024-03-04 - [Generating TypeScript Types with OpenAPI for REST API Consumption](https://www.pullrequest.com/blog/generating-typescript-types-with-openapi-for-rest-api-consumption/) by [PullRequest](https://www.pullrequest.com/) - 2024-03-07 - [Fully typed Web Apps with OpenAPI (Part 1)](https://medium.com/@gfox1984/fully-typed-web-apps-with-openapi-part-1-595d55766670) by [Guillaume Renard](https://medium.com/@gfox1984) +- 2024-03-08 - [Laravel OpenAPIによる "辛くない" スキーマ駆動開発](https://fortee.jp/phperkaigi-2024/proposal/9e2e6c38-d078-4efa-99b4-83ebf9033b34) by [KentarouTakeda](https://twitter.com/KentarouTakeda) ## [6 - About Us](#table-of-contents) diff --git a/bin/configs/java-okhttp-user-defined-templates.yaml b/bin/configs/java-okhttp-user-defined-templates.yaml new file mode 100644 index 000000000000..495cae7bdfcf --- /dev/null +++ b/bin/configs/java-okhttp-user-defined-templates.yaml @@ -0,0 +1,17 @@ +generatorName: java +outputDir: samples/client/echo_api/java/okhttp-gson-user-defined-templates +library: okhttp-gson +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + hideGenerationTimestamp: "true" +files: + README.md: + destinationFilename: info.md + api_doc.mustache: + templateType: APIDocs + destinationFilename: Documentation.md + pojo.mustache: + templateType: Model + folder: modelCopy + destinationFilename: .java diff --git a/bin/configs/jaxrs-spec-quarkus-mutiny.yaml b/bin/configs/jaxrs-spec-quarkus-mutiny.yaml new file mode 100644 index 000000000000..5620523e027f --- /dev/null +++ b/bin/configs/jaxrs-spec-quarkus-mutiny.yaml @@ -0,0 +1,15 @@ +generatorName: jaxrs-spec +outputDir: samples/server/petstore/jaxrs-spec-quarkus-mutiny +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec +additionalProperties: + artifactId: jaxrs-spec-petstore-server + serializableModel: "true" + hideGenerationTimestamp: "true" + implicitHeadersRegex: (api_key|enum_header_string) + generateBuilders: "true" + useMicroProfileOpenAPIAnnotations: "true" + useAsync: "true" + useMutiny: "true" + library: "quarkus" + dateLibrary: "java8-localdatetime" diff --git a/bin/configs/manual/rust-axum-petstore-with-fake-endpoints-models-for-testing.yaml b/bin/configs/manual/rust-axum-petstore-with-fake-endpoints-models-for-testing.yaml index 69ca39092e45..5a537e65b85c 100644 --- a/bin/configs/manual/rust-axum-petstore-with-fake-endpoints-models-for-testing.yaml +++ b/bin/configs/manual/rust-axum-petstore-with-fake-endpoints-models-for-testing.yaml @@ -7,4 +7,6 @@ additionalProperties: hideGenerationTimestamp: "true" packageName: petstore-with-fake-endpoints-models-for-testing publishRustRegistry: crates-io -enablePostProcessFile: true \ No newline at end of file +globalProperties: + skipFormModel: false +enablePostProcessFile: true diff --git a/bin/configs/manual/rust-axum-petstore.yaml b/bin/configs/manual/rust-axum-petstore.yaml index 3149c7418582..179e370639a5 100644 --- a/bin/configs/manual/rust-axum-petstore.yaml +++ b/bin/configs/manual/rust-axum-petstore.yaml @@ -6,4 +6,6 @@ generateAliasAsModel: true additionalProperties: hideGenerationTimestamp: "true" packageName: petstore +globalProperties: + skipFormModel: false enablePostProcessFile: true diff --git a/bin/configs/php-flight.yaml b/bin/configs/php-flight.yaml new file mode 100644 index 000000000000..2c3dedc1911d --- /dev/null +++ b/bin/configs/php-flight.yaml @@ -0,0 +1,6 @@ +generatorName: php-flight +outputDir: samples/server/petstore/php-flight +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/php-flight +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/docs/generators.md b/docs/generators.md index 749f43f15dbf..03c75077a3ac 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -120,6 +120,7 @@ The following generators are available: * [kotlin-spring](generators/kotlin-spring.md) * [kotlin-vertx (beta)](generators/kotlin-vertx.md) * [nodejs-express-server (beta)](generators/nodejs-express-server.md) +* [php-flight (experimental)](generators/php-flight.md) * [php-laravel](generators/php-laravel.md) * [php-lumen](generators/php-lumen.md) * [php-mezzio-ph](generators/php-mezzio-ph.md) diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 82b1b863e73c..1de80c28200a 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -78,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useBeanValidation|Use BeanValidation API annotations| |true| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useMicroProfileOpenAPIAnnotations|Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.| |false| +|useMutiny|Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useSwaggerAnnotations|Whether to generate Swagger annotations.| |true| |useTags|use tags for creating interface and controller classnames| |false| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 6572bfa72474..87563f7c6bee 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -78,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useBeanValidation|Use BeanValidation API annotations| |true| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useMicroProfileOpenAPIAnnotations|Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.| |false| +|useMutiny|Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useSwaggerAnnotations|Whether to generate Swagger annotations.| |true| |useTags|use tags for creating interface and controller classnames| |false| diff --git a/docs/generators/php-flight.md b/docs/generators/php-flight.md new file mode 100644 index 000000000000..8b7c90a069be --- /dev/null +++ b/docs/generators/php-flight.md @@ -0,0 +1,270 @@ +--- +title: Documentation for the php-flight Generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | php-flight | pass this to the generate command after -g | +| generator stability | EXPERIMENTAL | | +| generator type | SERVER | | +| generator language | PHP | | +| generator default templating engine | mustache | | +| helpTxt | Generates a PHP Flight Framework server library. | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| +|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| +|modelPackage|package for generated models| |null| +|packageName|The main package name for classes. e.g. GeneratedPetstore| |null| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|srcBasePath|The directory to serve as source root.| |null| +|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |camelCase| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|array| +|map|array| + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Uuid|✗| +|Array|✓|OAS2,OAS3 +|Null|✗|OAS3 +|AnyType|✗|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✗|ToolingExtension +|MapOfModel|✗|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✗|ToolingExtension +|MapOfCollectionOfEnum|✗|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✗|OAS2 +|FormMultipart|✗|OAS2 +|Cookie|✗|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✗|OAS2,OAS3 +|Union|✗|OAS3 +|allOf|✗|OAS2,OAS3 +|anyOf|✗|OAS3 +|oneOf|✗|OAS3 +|not|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 +|SignatureAuth|✗|OAS3 +|AWSV4Signature|✗|ToolingExtension + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✗|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 38d6dfc8e79b..34586dfbdaf0 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -4,7 +4,7 @@ org.openapitools openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index 401a1bbfac91..fd3b6ad2e98f 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -6,7 +6,7 @@ openapi-generator-project org.openapitools - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 00144d2daccf..fb74722df473 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid [source,group] ---- plugins { - id "org.openapi.generator" version "7.2.0" + id "org.openapi.generator" version "7.5.0" } ---- diff --git a/modules/openapi-generator-gradle-plugin/gradle.properties b/modules/openapi-generator-gradle-plugin/gradle.properties index 058e1378b755..a85cc37ce54e 100644 --- a/modules/openapi-generator-gradle-plugin/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/gradle.properties @@ -1,5 +1,5 @@ # RELEASE_VERSION -openApiGeneratorVersion=7.5.0-SNAPSHOT +openApiGeneratorVersion=7.6.0-SNAPSHOT # /RELEASE_VERSION # BEGIN placeholders diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index aaec04392fd8..3e84f3d2f731 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -4,7 +4,7 @@ org.openapitools openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties index ac2809b7a732..7a8b3c854c6e 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties @@ -1,3 +1,3 @@ # RELEASE_VERSION -openApiGeneratorVersion=7.5.0-SNAPSHOT +openApiGeneratorVersion=7.6.0-SNAPSHOT # /RELEASE_VERSION diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index 1700662a76e9..cc8500ceb95c 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 7.2.0 + 7.5.0 diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index a46e69ef6c6f..1961f1d8f0d7 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/examples/kotlin.xml b/modules/openapi-generator-maven-plugin/examples/kotlin.xml index 3203f7500543..2b8f2891b179 100644 --- a/modules/openapi-generator-maven-plugin/examples/kotlin.xml +++ b/modules/openapi-generator-maven-plugin/examples/kotlin.xml @@ -15,7 +15,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml index 680e90d82a98..f1aeef072f2f 100644 --- a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml +++ b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml @@ -19,7 +19,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml index 617d2f66938f..7e22c0c81de3 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml index 8aba10c00e5d..bcab0c62aeac 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml @@ -13,7 +13,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/examples/spring.xml b/modules/openapi-generator-maven-plugin/examples/spring.xml index e16c4615be2a..a5bcbc35d488 100644 --- a/modules/openapi-generator-maven-plugin/examples/spring.xml +++ b/modules/openapi-generator-maven-plugin/examples/spring.xml @@ -20,7 +20,7 @@ org.openapitools openapi-generator-maven-plugin - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index 930eb55e6df8..29d1eb27ccd6 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.openapitools openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator-online/README.md b/modules/openapi-generator-online/README.md index 2c77fa3c69c3..6d731ceffa9c 100644 --- a/modules/openapi-generator-online/README.md +++ b/modules/openapi-generator-online/README.md @@ -54,4 +54,4 @@ The `GENERATOR_HOST` variable is used here to ensure download links generated by ## Environment `GENERATOR_HOST` can be set to force the scheme/host/port used for download link generation. In most cases, this environment variable is not -necessary to be set and the download link will be generated to match the originating request. The variable is provided simply as a fallback. \ No newline at end of file +necessary to be set and the download link will be generated to match the originating request. The variable is provided simply as a fallback. diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index 1c92546162d0..fee18406f0f7 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -4,7 +4,7 @@ org.openapitools openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 7b0bdad0ea81..dbb884301b74 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -4,7 +4,7 @@ org.openapitools openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT ../.. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 77b8134762fe..a90dc165cb68 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -52,6 +52,7 @@ import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.examples.ExampleGenerator; import org.openapitools.codegen.languages.PhpNextgenClientCodegen; +import org.openapitools.codegen.languages.RustAxumServerCodegen; import org.openapitools.codegen.languages.RustServerCodegen; import org.openapitools.codegen.meta.FeatureSet; import org.openapitools.codegen.meta.GeneratorMetadata; @@ -3619,9 +3620,9 @@ protected List getAllOfDescendants(String thisSchemaName) { Map vendorExtensions = cs.getExtensions(); String mappingName = Optional.ofNullable(vendorExtensions) - .map(ve -> ve.get("x-discriminator-value")) - .map(discriminatorValue -> (String) discriminatorValue) - .orElse(currentSchemaName); + .map(ve -> ve.get("x-discriminator-value")) + .map(discriminatorValue -> (String) discriminatorValue) + .orElse(currentSchemaName); MappedModel mm = new MappedModel(mappingName, toModelName(currentSchemaName), !mappingName.equals(currentSchemaName)); descendentSchemas.add(mm); } @@ -3648,11 +3649,11 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch // the future.. String propertyType = Optional.ofNullable(schema.getProperties()) - .map(p -> (Schema) p.get(discriminatorPropertyName)) - .map(Schema::get$ref) - .map(ModelUtils::getSimpleRef) - .map(this::toModelName) - .orElseGet(() -> typeMapping.get("string")); + .map(p -> (Schema) p.get(discriminatorPropertyName)) + .map(Schema::get$ref) + .map(ModelUtils::getSimpleRef) + .map(this::toModelName) + .orElseGet(() -> typeMapping.get("string")); discriminator.setPropertyType(propertyType); // check to see if the discriminator property is an enum string @@ -4742,7 +4743,7 @@ public CodegenOperation fromOperation(String path, contentType = contentType.toLowerCase(Locale.ROOT); } if (contentType != null && - (contentType.startsWith("application/x-www-form-urlencoded") || + ((!(this instanceof RustAxumServerCodegen) && contentType.startsWith("application/x-www-form-urlencoded")) || contentType.startsWith("multipart"))) { // process form parameters formParams = fromRequestBodyToFormParameters(requestBody, imports); @@ -6794,12 +6795,12 @@ protected List> buildEnumVars(List values, String da String enumValue = isDataTypeString(dataType) ? enumUnknownDefaultCaseName : // This is a dummy value that attempts to avoid collisions with previously specified cases. - // Int.max / 192 - // The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums. - // [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md) - // Since this functionality was born in the Swift 5 generator and latter on broth to all generators - // https://github.com/OpenAPITools/openapi-generator/pull/11013 - String.valueOf(11184809); + // Int.max / 192 + // The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums. + // [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md) + // Since this functionality was born in the Swift 5 generator and latter on broth to all generators + // https://github.com/OpenAPITools/openapi-generator/pull/11013 + String.valueOf(11184809); enumVar.put("name", toEnumVarName(enumName, dataType)); enumVar.put("value", toEnumValue(enumValue, dataType)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java index 5856b1b0c2cb..c1fd7e15adaa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java @@ -333,13 +333,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) { /** * Internal method to set the generateToSchema parameter. - * + *

* Basically we're generating ToSchema instances (generically) for all schemas. * However, if any of the contained datatypes doesn't have the ToSchema instance, * we cannot generate it for its "ancestor" type. * This is the case with the "Data.Aeson.Value" type: it doesn't (and cannot) have * a Swagger-compatible ToSchema instance. So we have to detect its presence "downstream" * the current schema, and if we find it we just don't generate any ToSchema instance. + * * @param model */ private void setGenerateToSchema(CodegenModel model) { @@ -356,7 +357,7 @@ private void setGenerateToSchema(CodegenModel model) { List children = model.getChildren(); if (children != null) { - for(CodegenModel child : children) { + for (CodegenModel child : children) { setGenerateToSchema(child); } } @@ -512,7 +513,7 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op // Query parameters appended to routes for (CodegenParameter param : op.queryParams) { String paramType = param.dataType; - if (param.contentType == "application/json") { + if ("application/json".equals(param.contentType)) { if (param.isArray) { paramType = "[JSONQueryParam " + paramType.substring(1, paramType.length() - 1) + "]"; } else { @@ -554,7 +555,7 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op path.add("Header \"" + param.baseName + "\" " + param.dataType); String paramType = param.dataType; - if (param.contentType == "application/json") { + if ("application/json".equals(param.contentType)) { if (param.isArray) { paramType = "(JSONQueryParam " + paramType.substring(1, paramType.length() - 1) + ")"; } else { @@ -721,5 +722,7 @@ public void postProcessFile(File file, String fileType) { } @Override - public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.HASKELL; } + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.HASKELL; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 69627170d693..373ac795d862 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -38,6 +38,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String GENERATE_POM = "generatePom"; public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations"; public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations"; + public static final String USE_MUTINY = "useMutiny"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; public static final String GENERATE_BUILDERS = "generateBuilders"; @@ -53,6 +54,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { private boolean generateBuilders = false; private boolean useSwaggerAnnotations = true; private boolean useMicroProfileOpenAPIAnnotations = false; + private boolean useMutiny = false; protected boolean useGzipFeature = false; private boolean useJackson = false; @@ -120,6 +122,7 @@ public JavaJAXRSSpecServerCodegen() { cliOptions.add(CliOption.newBoolean(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, "Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.", useMicroProfileOpenAPIAnnotations)); cliOptions.add(CliOption.newString(OPEN_API_SPEC_FILE_LOCATION, "Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.")); cliOptions.add(CliOption.newBoolean(SUPPORT_ASYNC, "Wrap responses in CompletionStage type, allowing asynchronous computation (requires JAX-RS 2.1).", supportAsync)); + cliOptions.add(CliOption.newBoolean(USE_MUTINY, "Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.", useMutiny)); } @Override @@ -167,6 +170,12 @@ public void processOpts() { writePropertyBack(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, useMicroProfileOpenAPIAnnotations); } + if (QUARKUS_LIBRARY.equals(library)) { + if (additionalProperties.containsKey(USE_MUTINY)) { + useMutiny = Boolean.parseBoolean(additionalProperties.get(USE_MUTINY).toString()); + } + writePropertyBack(USE_MUTINY, useMutiny); + } if (additionalProperties.containsKey(GENERATE_BUILDERS)) { generateBuilders = Boolean.parseBoolean(additionalProperties.get(GENERATE_BUILDERS).toString()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index c2dd6a40516e..51a325bd9e64 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -957,7 +957,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List typeHintable = new HashSet<>( + Arrays.asList( + "array", + "bool", + "float", + "int", + "string" + ) + ); + + public PhpFlightServerCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON)) + .securityFeatures(EnumSet.of( + SecurityFeature.BasicAuth, + SecurityFeature.BearerToken, + SecurityFeature.ApiKey, + SecurityFeature.OAuth2_Implicit)) + .excludeDataTypeFeatures( + DataTypeFeature.MapOfCollectionOfEnum, + DataTypeFeature.MapOfEnum, + DataTypeFeature.MapOfCollectionOfModel, + DataTypeFeature.MapOfModel) + .excludeParameterFeatures( + ParameterFeature.FormMultipart, + ParameterFeature.FormUnencoded, + ParameterFeature.Cookie) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .excludeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism + ) + ); + + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.EXPERIMENTAL) + .build(); + + embeddedTemplateDir = templateDir = "php-flight"; + + // clear import mapping (from default generator) as slim does not use it + // at the moment + importMapping.clear(); + + srcBasePath = ""; + + defaultIncludes = new HashSet<>( + Arrays.asList( + "\\DateTime" + ) + ); + + variableNamingConvention = "camelCase"; + artifactVersion = "1.0.0"; + setInvokerPackage("OpenAPIServer"); + testPackage = invokerPackage + "\\Test"; + apiPackage = invokerPackage + "\\" + apiDirName; + modelPackage = invokerPackage + "\\" + modelDirName; + outputFolder = "generated-code" + File.separator + "php-flight"; + + // no doc files + modelDocTemplateFiles.clear(); + apiDocTemplateFiles.clear(); + apiTestTemplateFiles.clear(); + + embeddedTemplateDir = templateDir = "php-flight"; + + cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC) + .defaultValue(Boolean.TRUE.toString())); + cliOptions.stream().filter(o -> Objects.equals(o.getOpt(), VARIABLE_NAMING_CONVENTION)).findFirst().ifPresent(o -> o.defaultValue("camelCase")); + } + + @Override + public CodegenType getTag() { + return CodegenType.SERVER; + } + + @Override + public String getName() { + return "php-flight"; + } + + @Override + public String getHelp() { + return "Generates a PHP Flight Framework server library."; + } + + @Override + public String apiFileFolder() { + if (apiPackage.startsWith(invokerPackage + "\\")) { + // need to strip out invokerPackage from path + return (outputFolder + File.separator + toSrcPath(StringUtils.removeStart(apiPackage, invokerPackage + "\\"), srcBasePath)); + } + return (outputFolder + File.separator + toSrcPath(apiPackage, srcBasePath)); + } + + @Override + public String modelFileFolder() { + if (modelPackage.startsWith(invokerPackage + "\\")) { + // need to strip out invokerPackage from path + return (outputFolder + File.separator + toSrcPath(StringUtils.removeStart(modelPackage, invokerPackage + "\\"), srcBasePath)); + } + return (outputFolder + File.separator + toSrcPath(modelPackage, srcBasePath)); + } + + @Override + public void processOpts() { + super.processOpts(); + + inlineSchemaOption.put("RESOLVE_INLINE_ENUMS", "true"); + + // add trailing slash for mustache templates + additionalProperties.put("relativeSrcBasePath", srcBasePath.isEmpty() ? "" : srcBasePath + "/"); + additionalProperties.put("modelSrcPath", "." + "/" + toSrcPath(modelPackage, srcBasePath)); + additionalProperties.put("apiSrcPath", "." + "/" + toSrcPath(apiPackage, srcBasePath)); + additionalProperties.put("testSrcPath", "." + "/" + toSrcPath(testPackage, srcBasePath)); + additionalProperties.put("escapedModelPackage", modelPackage.replace("\\", "\\\\")); + + if (additionalProperties.containsKey("testPackage")) { + // Update model package to contain the specified model package name and the invoker package + testPackage = invokerPackage + "\\" + (String) additionalProperties.get("testPackage"); + } + additionalProperties.put("testPackage", testPackage); + + supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json")); + supportingFiles.add(new SupportingFile("phpunit.mustache", "", "phpunit.xml.dist")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("register_routes.mustache", toSrcPath(invokerPackage, srcBasePath), "RegisterRoutes.php")); + supportingFiles.add(new SupportingFile("register_routes_test.mustache", toSrcPath(testPackage, srcBasePath), "RegisterRoutesTest.php")); + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); + operationList.forEach(operation -> { + operation.vendorExtensions.put("x-path", mapToFlightPath(operation.path)); + String returnType = operation.responses.stream().filter(r -> r.is2xx && r.dataType != null).map(r -> this.getTypeHint(r.dataType, false, false)).filter(t -> !t.isEmpty()).map(t -> t + "|null").findFirst().orElse("void"); + operation.vendorExtensions.put("x-return-type", returnType); + operation.vendorExtensions.put("x-return-type-is-void", returnType.equals("void")); + operation.vendorExtensions.put("x-return-type-comment", + operation.responses.stream().filter(r -> r.is2xx && r.dataType != null).map(r -> this.getTypeHint(r.dataType, true, false)).filter(t -> !t.isEmpty()).map(t -> t+"|null").findFirst().orElse("void")); + operation.vendorExtensions.put("x-nonFormParams", operation.allParams.stream().filter(p -> !p.isFormParam).toArray()); + + operation.allParams.forEach(param -> { + param.vendorExtensions.put("x-parameter-type", param.required ? getTypeHint(param.dataType, false, false) : getTypeHintNullable(param.dataType, false)); + String commentType = param.required ? getTypeHint(param.dataType, true, false) : getTypeHintNullable(param.dataType, false); + param.vendorExtensions.put("x-comment-type", commentType); + param.vendorExtensions.put("x-comment-type-escaped", commentType.replace("\\", "\\\\")); + }); + }); + escapeMediaType(operationList); + return objs; + } + + private String mapToFlightPath(String path) { + return path.replaceAll("\\{([^}]+)}", "@$1"); + } + + @Override + public ModelsMap postProcessModels(ModelsMap objs) { + objs = super.postProcessModels(objs); + + ModelMap models = objs.getModels().get(0); + CodegenModel model = models.getModel(); + + // Simplify model var type + for (CodegenProperty var : model.vars) { + if (var.dataType != null) { + // Determine if the parameter type is supported as a type hint and make it available + // to the templating engine + var.vendorExtensions.put("x-parameter-type", var.required ? getTypeHint(var.dataType, false, true) : getTypeHintNullable(var.dataType, true)); + var.vendorExtensions.put("x-comment-type", var.required ? getTypeHint(var.dataType, true, true) : getTypeHintNullableForComments(var.dataType, true)); + } + } + + return objs; + } + + protected String getTypeHintNullable(String type, boolean modelContext) { + String typeHint = getTypeHint(type, false, modelContext); + if (!typeHint.equals("")) { + return "?" + typeHint; + } + + return typeHint; + } + + protected String getTypeHintNullableForComments(String type, boolean modelContext) { + String typeHint = getTypeHint(type, true, modelContext); + if (!typeHint.equals("")) { + return typeHint + "|null"; + } + + return typeHint; + } + + protected String getTypeHint(String type, boolean forComments, boolean modelContext) { + // Type hint array types + if (type.endsWith("[]")) { + if (forComments) { + //Make type hints for array in comments. Call getTypeHint recursive for extractSimpleName for models + String typeWithoutArray = type.substring(0, type.length() - 2); + return this.getTypeHint(typeWithoutArray, true, modelContext) + "[]"; + } else { + return "array"; + } + } + + // Check if the type is a native type that is type hintable in PHP + if (typeHintable.contains(type)) { + return type; + } + + // Default includes are referenced by their fully-qualified class name (including namespace) + if (defaultIncludes.contains(type)) { + return type; + } + + // Model classes are assumed to be imported and we reference them by their class name + if (isModelClass(type)) { + // This parameter is an instance of a model + return modelContext ? extractSimpleName(type) : type; + } + + // PHP does not support type hinting for this parameter data type + return ""; + } + + protected Boolean isModelClass(String type) { + return Boolean.valueOf(type.contains(modelPackage())); + } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return toAbstractName("DefaultApi"); + } + return toAbstractName(camelize(name) + "Api"); + } + + @Override + public String toApiTestFilename(String name) { + if (name.length() == 0) { + return "DefaultApiTest"; + } + return camelize(name) + "ApiTest"; + } + + @Override + public CodegenOperation fromOperation(String path, + String httpMethod, + Operation operation, + List servers) { + CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); + op.path = encodePath(path); + return op; + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java index 67126e407c07..1ae0739ad57e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java @@ -134,7 +134,7 @@ public String toDefaultValue(Schema p) { @Override public String testPackage() { - return "src/test/scala"; + return "jvm/src/test/scala"; } public String toModelTestFilename(String name) { @@ -166,8 +166,8 @@ public void processOpts() { modelPackage = ensureProp(CodegenConstants.MODEL_PACKAGE, basePackage + ".model"); - final String apiPath = "src/main/scala/" + apiPackage.replace('.', '/'); - final String modelPath = "src/main/scala/" + modelPackage.replace('.', '/'); + final String apiPath = "jvm/src/main/scala/" + apiPackage.replace('.', '/'); + final String modelPath = "shared/src/main/scala/" + modelPackage.replace('.', '/'); final List appFullPath = Arrays.stream(apiPath.split("/")).collect(Collectors.toList()); final String appFolder = String.join("/", appFullPath.subList(0, appFullPath.size() - 1)); @@ -186,7 +186,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("Dockerfile.mustache", "example", "Dockerfile")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - supportingFiles.add(new SupportingFile("bulidAndPublish.yml.mustache", "", ".github/workflows/bulidAndPublish.yml")); + supportingFiles.add(new SupportingFile("buildAndPublish.yml.mustache", "", ".github/workflows/buildAndPublish.yml")); supportingFiles.add(new SupportingFile("build.sc.mustache", "", "build.sc")); supportingFiles.add(new SupportingFile(".scalafmt.conf.mustache", "", ".scalafmt.conf")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); @@ -274,6 +274,16 @@ public String apiFilename(String templateName, String tag) { } } + @Override + public String apiFileFolder() { + return outputFolder + "/jvm/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar); + } + + @Override + public String modelFileFolder() { + return outputFolder + "/shared/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar); + } + static String capitalise(String p) { if (p.length() < 2) { return p.toUpperCase(Locale.ROOT); @@ -323,7 +333,7 @@ public void processOpenAPI(OpenAPI openAPI) { String jsonOpenAPI = SerializerUtils.toJsonString(openAPI); try { - String outputFile = getOutputDir() + "/" + getResourceFolder() + "/openapi.json"; + String outputFile = getOutputDir() + "/jvm/" + getResourceFolder() + "/openapi.json"; FileUtils.writeStringToFile(new File(outputFile), jsonOpenAPI, StandardCharsets.UTF_8); LOGGER.info("wrote file to {}", outputFile); } catch (Exception e) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 0b1883308223..6bc75f0e6390 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -340,6 +340,12 @@ public ModelsMap postProcessModels(ModelsMap objs) { this.processCodeGenModel(cm); } + // Add supporting file only if we plan to generate files in /models + if (!objs.isEmpty() && !addedModelIndex) { + addedModelIndex = true; + supportingFiles.add(new SupportingFile("models.index.mustache", modelPackage().replace('.', File.separatorChar), "index.ts")); + } + return objs; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache index 5b0f260635d1..f9f13cac22f8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache @@ -62,7 +62,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} public {{classname}}( {{#readOnlyVars}} - {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nillable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}{{#required}}, required = true{{/required}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nillable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(value = JSON_PROPERTY_{{nameInSnakeCase}}{{#required}}, required = true{{/required}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} {{/readOnlyVars}} ) { {{#readOnlyVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache index d45774cacc21..8f40dc3a9e7f 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache @@ -15,8 +15,13 @@ import io.swagger.annotations.*; {{/useSwaggerAnnotations}} {{#supportAsync}} +{{#useMutiny}} +import io.smallrye.mutiny.Uni; +{{/useMutiny}} +{{^useMutiny}} import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletableFuture; +{{/useMutiny}} {{/supportAsync}} import java.io.InputStream; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache index 96c81be32634..5bd7a3e4e607 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache @@ -40,6 +40,6 @@ {{^vendorExtensions.x-java-is-response-void}}@org.eclipse.microprofile.openapi.annotations.media.Content(schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = {{{baseType}}}.class{{#vendorExtensions.x-microprofile-open-api-return-schema-container}}, type = {{{.}}} {{/vendorExtensions.x-microprofile-open-api-return-schema-container}}{{#vendorExtensions.x-microprofile-open-api-return-unique-items}}, uniqueItems = true {{/vendorExtensions.x-microprofile-open-api-return-unique-items}})){{/vendorExtensions.x-java-is-response-void}} }){{^-last}},{{/-last}}{{/responses}} }){{/hasProduces}}{{/useMicroProfileOpenAPIAnnotations}} - public {{#supportAsync}}CompletionStage<{{/supportAsync}}Response{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) { - return {{#supportAsync}}CompletableFuture.supplyAsync(() -> {{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}}; + public {{#supportAsync}}{{#useMutiny}}Uni{{/useMutiny}}{{^useMutiny}}CompletionStage{{/useMutiny}}<{{/supportAsync}}Response{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) { + return {{#supportAsync}}{{#useMutiny}}Uni.createFrom().item({{/useMutiny}}{{^useMutiny}}CompletableFuture.supplyAsync(() -> {{/useMutiny}}{{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}}; } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache index d8fffd4846f9..ef91cc3dfb27 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache @@ -44,6 +44,9 @@ {{#useSwaggerAnnotations}} 1.6.10 {{/useSwaggerAnnotations}} +{{#useMutiny}} + 1.2.1 +{{/useMutiny}} @@ -109,6 +112,14 @@ provided {{/useSwaggerAnnotations}} +{{#useMutiny}} + + io.smallrye + smallrye-rest-client + ${smallrye.rest.client.version} + test + +{{/useMutiny}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/returnAsyncTypeInterface.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/returnAsyncTypeInterface.mustache new file mode 100644 index 000000000000..93f1098e48da --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/returnAsyncTypeInterface.mustache @@ -0,0 +1 @@ +{{#useMutiny}}Uni{{/useMutiny}}{{^useMutiny}}CompletionStage{{/useMutiny}}<{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{#returnContainer}}{{#isMap}}Map{{/isMap}}{{#isArray}}{{{returnContainer}}}<{{{returnBaseType}}}>{{/isArray}}{{/returnContainer}}{{^returnContainer}}{{{returnBaseType}}}{{/returnContainer}}{{/returnResponse}}> \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 9849aa702f36..3521954fc48b 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -91,6 +91,7 @@ org.openapitools.codegen.languages.OpenAPIYamlGenerator org.openapitools.codegen.languages.PlantumlDocumentationCodegen org.openapitools.codegen.languages.PerlClientCodegen org.openapitools.codegen.languages.PhpClientCodegen +org.openapitools.codegen.languages.PhpFlightServerCodegen org.openapitools.codegen.languages.PhpNextgenClientCodegen org.openapitools.codegen.languages.PhpLaravelServerCodegen org.openapitools.codegen.languages.PhpLumenServerCodegen diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache index 9d1dd4b7ba62..067a6f9b64ca 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache @@ -300,14 +300,14 @@ {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ParsedValue{{#required}}.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} {{#oneOf}} {{^vendorExtensions.x-duplicated-data-type}} if ({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{/vendorExtensions.x-duplicated-data-type}} {{#-last}} diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/go.mod.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/go.mod.mustache index 1b225bbafefa..640f93d74485 100644 --- a/modules/openapi-generator/src/main/resources/go-gin-server/go.mod.mustache +++ b/modules/openapi-generator/src/main/resources/go-gin-server/go.mod.mustache @@ -24,7 +24,7 @@ require ( github.com/ugorji/go/codec v1.2.11 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/protobuf v1.33.0 // indirect diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache index c0cfd07749b1..77db3bd6efa0 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache @@ -29,7 +29,7 @@ 1.4.13 4.13.2 2.1.0-beta.124 - 2.3.5.Final + 2.3.12.Final 2.2.0 4.5.13 4.1.2 diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache index 8576bee5b430..d99122333d66 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache @@ -59,10 +59,10 @@ import kotlinx.serialization.* {{/imports}} {{#operations}} -{{#x-koltin-import-models}} -import {{{packageName}}}.models.* +{{#x-kotlin-import-models}} +import {{{modelPackage}}}.* -{{/x-koltin-import-models}} +{{/x-kotlin-import-models}} {{#x-kotlin-multipart-import}} {{^isMultipart}} import okhttp3.MultipartBody diff --git a/modules/openapi-generator/src/main/resources/php-flight/README.mustache b/modules/openapi-generator/src/main/resources/php-flight/README.mustache new file mode 100644 index 000000000000..d510c3a55354 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/README.mustache @@ -0,0 +1,10 @@ +## Requirements + +PHP 8.1 and later + +## Installation & Usage + +1. Set up flight as usual - see [Flight documentation](https://docs.flightphp.com/install) +2. Generate using the OpenAPI generator +3. Subclass some/all generated `Abstract*Api` and overwrite the methods you'd like handled. When implementing the `*Stream` methods, make sure to stream the response and not implement the non-stream method. +4. Register routes for your subclassed apis: `RegisterRoutes::registerRoutes(new MyApiHandler());` diff --git a/modules/openapi-generator/src/main/resources/php-flight/api.mustache b/modules/openapi-generator/src/main/resources/php-flight/api.mustache new file mode 100644 index 000000000000..a0b146bd07dc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/api.mustache @@ -0,0 +1,57 @@ +licenseInfo}} + +namespace {{apiPackage}}; + + +{{#operations}}abstract class {{classname}} +{ + + {{#operation}} + /** + * Operation {{{operationId}}} + * Path: {{{path}}} + * + {{#summary}} + * {{{summary}}} + * + {{/summary}} + {{#vendorExtensions.x-nonFormParams}} + * @param {{vendorExtensions.x-parameter-type}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} + {{/vendorExtensions.x-nonFormParams}} + * + * @return {{vendorExtensions.x-return-type-comment}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}({{#vendorExtensions.x-nonFormParams}}{{vendorExtensions.x-parameter-type}} ${{paramName}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-nonFormParams}}): {{vendorExtensions.x-return-type}} + { + throw new \Exception('Not implemented'); + } + + {{#returnContainer}} + /** + * Operation {{{operationId}}} (stream) + * + {{#summary}} + * {{{summary}}} + * + {{/summary}} + {{#vendorExtensions.x-nonFormParams}} + * @param {{vendorExtensions.x-parameter-type}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/vendorExtensions.x-nonFormParams}} + * + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}Stream({{#vendorExtensions.x-nonFormParams}}{{vendorExtensions.x-parameter-type}} ${{paramName}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-nonFormParams}}): void + { + throw new \Exception('Not implemented'); + } + {{/returnContainer}} +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/php-flight/composer.mustache b/modules/openapi-generator/src/main/resources/php-flight/composer.mustache new file mode 100644 index 000000000000..d922daab923e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/composer.mustache @@ -0,0 +1,39 @@ +{ + {{#composerPackageName}} + "name": "{{{.}}}", + {{/composerPackageName}} + "description": "{{appDescription}}.", + "keywords": ["openapi", "php", "framework", "flightphp"], + {{#artifactVersion}} + "version": "{{.}}", + {{/artifactVersion}} + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], + "type": "library", + "require": { + "php": "^8.1.0", + "flightphp/core": "^3.5.1", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true + }, + "autoload": { + "psr-4": { + "{{escapedInvokerPackage}}\\": "" + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/modules/openapi-generator/src/main/resources/php-flight/gitignore b/modules/openapi-generator/src/main/resources/php-flight/gitignore new file mode 100644 index 000000000000..931a98c71bd1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/gitignore @@ -0,0 +1,28 @@ +# 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 + +# phplint tool creates cache file which is not necessary in a codebase +/.phplint-cache + +# Do not commit local PHPUnit config +/phpunit.xml +/.phpunit.result.cache + +# Do not commit local PHP_CodeSniffer config +/phpcs.xml + +# Application config may contain sensitive data +/config/**/*.* +!/config/.htaccess +!/config/dev/default.inc.php +!/config/prod/default.inc.php + +# Logs folder +/logs/**/*.* +!/logs/.htaccess diff --git a/modules/openapi-generator/src/main/resources/php-flight/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/php-flight/licenseInfo.mustache new file mode 100644 index 000000000000..c10b59eaab8a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + {{#appName}} + * {{{.}}} + {{/appName}} + * PHP version 8.x + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://github.com/openapitools/openapi-generator + */ + +/** + {{#appDescription}} + * {{{.}}} + {{/appDescription}} + {{#version}} + * The version of the OpenAPI document: {{{.}}} + {{/version}} + {{#infoEmail}} + * Contact: {{{.}}} + {{/infoEmail}} + * Generated by: https://github.com/openapitools/openapi-generator.git + */ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-flight/model.mustache b/modules/openapi-generator/src/main/resources/php-flight/model.mustache new file mode 100644 index 000000000000..c0fd08c25c56 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/model.mustache @@ -0,0 +1,31 @@ +partial_header}} + +namespace {{modelPackage}}; + +/** + * Class representing the {{classname}} model. + * +{{#description}} + * {{.}} + * +{{/description}} + * @package {{modelPackage}} + * @author OpenAPI Generator team + */ +{{#isEnum}}{{>model_enum}}{{/isEnum}} +{{^isEnum}}{{>model_generic}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/php-flight/model_enum.mustache b/modules/openapi-generator/src/main/resources/php-flight/model_enum.mustache new file mode 100644 index 000000000000..b12428b10e2d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/model_enum.mustache @@ -0,0 +1,8 @@ +enum {{classname}}: {{dataType}} +{ +{{#allowableValues}} + {{#enumVars}} + case {{{name}}} = {{{value}}}; + {{/enumVars}} +{{/allowableValues}} +} diff --git a/modules/openapi-generator/src/main/resources/php-flight/model_generic.mustache b/modules/openapi-generator/src/main/resources/php-flight/model_generic.mustache new file mode 100644 index 000000000000..9748119501dc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/model_generic.mustache @@ -0,0 +1,90 @@ +class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} implements \JsonSerializable +{ + {{#vars}}{{>model_variables}} + {{/vars}} + /** + * Constructor + * +{{#vars}} + * @param {{vendorExtensions.x-comment-type}} ${{name}} +{{/vars}} + */ + public function __construct({{#vars}}{{vendorExtensions.x-parameter-type}} ${{name}}{{^-last}}, {{/-last}}{{/vars}}) + { + {{#vars}} + $this->{{name}} = ${{name}}; + {{/vars}} + } + + public static function fromArray(array $data): self + { + return new self( + {{#vars}} + {{#isDateTime}} + isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/isDateTime}} + {{#isEnum}} + isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/isEnum}} + {{#isEnumRef}} + isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/isEnumRef}} + {{#isModel}} + isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/isModel}} + {{#isArray}} + {{#items.isEnumRef}} + isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/items.isEnumRef}} + {{#items.isModel}} + isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/items.isModel}} + {{#items.isDateTime}} + isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}}, {{/last}} + {{/items.isDateTime}} + {{^items.isEnumRef}} + {{^items.isModel}} + {{^items.isDateTime}} + $data['{{baseName}}'] ?? null{{^last}}, {{/last}} + {{/items.isDateTime}} + {{/items.isModel}} + {{/items.isEnumRef}} + {{/isArray}} + {{^isEnumRef}} + {{^isEnum}} + {{^isModel}} + {{^isArray}} + {{^isDateTime}} + $data['{{baseName}}'] ?? null{{^last}}, {{/last}} + {{/isDateTime}} + {{/isArray}} + {{/isModel}} + {{/isEnum}} + {{/isEnumRef}} + {{/vars}} + ); + } + + public function jsonSerialize(): mixed { + return [ + {{#vars}} + {{#isDateTime}} + '{{baseName}}' => $this->{{name}}?->format('c'){{^last}}, {{/last}} + {{/isDateTime}} + {{#isArray}} + {{#items.isDateTime}} + '{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}}, {{/last}} + {{/items.isDateTime}} + {{^items.isDateTime}} + '{{baseName}}' => $this->{{name}}{{^last}}, {{/last}} + {{/items.isDateTime}} + {{/isArray}} + {{^isDateTime}} + {{^isArray}} + '{{baseName}}' => $this->{{name}}{{^last}}, {{/last}} + {{/isArray}} + {{/isDateTime}} + {{/vars}} + ]; + } +} diff --git a/modules/openapi-generator/src/main/resources/php-flight/model_variables.mustache b/modules/openapi-generator/src/main/resources/php-flight/model_variables.mustache new file mode 100644 index 000000000000..259ce295ea70 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/model_variables.mustache @@ -0,0 +1,113 @@ + /** + {{#description}} + * {{.}} + * + {{/description}} + * @var {{{vendorExtensions.x-comment-type}}} + * @SerializedName("{{baseName}}") +{{#required}} + * @Assert\NotNull() + {{^isPrimitiveType}} + * @Assert\Valid() + {{/isPrimitiveType}} +{{/required}} +{{#isEnum}} + {{#isContainer}} + * @Assert\All({ + {{#items}} + * @Assert\Choice({ {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} }) + {{/items}} + * }) + {{/isContainer}} + {{^isContainer}} + * @Assert\Choice({ {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} }) + {{/isContainer}} +{{/isEnum}} +{{#isContainer}} + * @Assert\All({ + {{#items}} + * @Assert\Type("{{dataType}}") + {{/items}} + * }) + {{#isMap}} + {{#items}} + * @Type("array") + {{/items}} + {{/isMap}} + {{^isMap}} + {{#items}} + {{#isEnumRef}} + * @Accessor(getter="getSerialized{{nameInPascalCase}}") + * @Type("array") + {{/isEnumRef}} + {{^isEnumRef}} + * @Type("array<{{dataType}}>") + {{/isEnumRef}} + {{/items}} + {{/isMap}} +{{/isContainer}} +{{^isContainer}} + {{#isDate}} + * @Assert\Type("\Date") + * @Type("DateTime<'Y-m-d'>") + {{/isDate}} + {{#isDateTime}} + * @Assert\Type("\DateTime")) + * @Type("DateTime") + {{/isDateTime}} + {{#isEnumRef}} + * @Accessor(getter="getSerialized{{nameInPascalCase}}") + * @Type("string") + {{/isEnumRef}} + {{^isDate}} + {{^isDateTime}} + {{^isEnumRef}} + * @Assert\Type("{{dataType}}") + * @Type("{{dataType}}") + {{/isEnumRef}} + {{/isDateTime}} + {{/isDate}} +{{/isContainer}} +{{#hasValidation}} + {{#maxLength}} + * @Assert\Length( + * max = {{.}} + * ) + {{/maxLength}} + {{#minLength}} + * @Assert\Length( + * min = {{.}} + * ) + {{/minLength}} + {{#minimum}} + {{#exclusiveMinimum}} + * @Assert\GreaterThan({{minimum}}) + {{/exclusiveMinimum}} + {{^exclusiveMinimum}} + * @Assert\GreaterThanOrEqual({{minimum}}) + {{/exclusiveMinimum}} + {{/minimum}} + {{#maximum}} + {{#exclusiveMaximum}} + * @Assert\LessThan({{maximum}}) + {{/exclusiveMaximum}} + {{^exclusiveMaximum}} + * @Assert\LessThanOrEqual({{maximum}}) + {{/exclusiveMaximum}} + {{/maximum}} + {{#pattern}} + * @Assert\Regex("/{{.}}/") + {{/pattern}} + {{#maxItems}} + * @Assert\Count( + * max = {{.}} + * ) + {{/maxItems}} + {{#minItems}} + * @Assert\Count( + * min = {{.}} + * ) + {{/minItems}} +{{/hasValidation}} + */ + public {{{vendorExtensions.x-parameter-type}}} ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}; diff --git a/modules/openapi-generator/src/main/resources/php-flight/partial_header.mustache b/modules/openapi-generator/src/main/resources/php-flight/partial_header.mustache new file mode 100644 index 000000000000..01bb4a845c99 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/partial_header.mustache @@ -0,0 +1,14 @@ +/** + {{#appName}} + * {{{.}}} + * + {{/appName}} + {{#appDescription}} + * {{{.}}} + * + {{/appDescription}} + * {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}} + * {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}} + * Generated by: https://github.com/openapitools/openapi-generator.git + * + */ diff --git a/modules/openapi-generator/src/main/resources/php-flight/phpunit.mustache b/modules/openapi-generator/src/main/resources/php-flight/phpunit.mustache new file mode 100644 index 000000000000..f7df0c08377d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/phpunit.mustache @@ -0,0 +1,28 @@ + + + + + {{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}} + {{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}} + . + + + {{#lambda.forwardslash}}{{testSrcPath}}{{/lambda.forwardslash}} + + + + + {{#lambda.forwardslash}}{{testSrcPath}}{{/lambda.forwardslash}} + + + + + + diff --git a/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache new file mode 100644 index 000000000000..c66e90b42b98 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache @@ -0,0 +1,85 @@ +licenseInfo}} + +namespace {{invokerPackage}}; +{{#apiInfo}} + +class RegisterRoutes { + + static public function registerRoutes({{#apis}}\{{apiPackage}}\{{classname}}{{^-last}}|{{/-last}}{{/apis}} $handler): void + { + $reflectionClass = new \ReflectionClass($handler); + + {{#apis}} + {{#operations}} + {{#operation}} + if (declaresMethod($reflectionClass, '{{operationId}}') && declaresMethod($reflectionClass, '{{operationId}}Stream')) { + throw new \Exception('Operation {{operationId}} cannot be both streaming and non-streaming'); + } + if (declaresMethod($reflectionClass, '{{operationId}}')) { + \Flight::route('{{httpMethod}} {{vendorExtensions.x-path}}', function ({{#pathParams}}string ${{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) use ($handler) { + $r = \Flight::request(); + {{^vendorExtensions.x-return-type-is-void}}$result = {{/vendorExtensions.x-return-type-is-void}}$handler->{{operationId}}( + {{#vendorExtensions.x-nonFormParams}} + parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}} + {{/vendorExtensions.x-nonFormParams}} + ); + {{^vendorExtensions.x-return-type-is-void}} + if ($result === null) { + \Flight::halt(204); + } else { + \Flight::json($result); + } + {{/vendorExtensions.x-return-type-is-void}} + {{#vendorExtensions.x-return-type-is-void}} + \Flight::halt(204); + {{/vendorExtensions.x-return-type-is-void}} + }); + } + {{#returnContainer}} + if (declaresMethod($reflectionClass, '{{operationId}}Stream')) { + \Flight::route('{{httpMethod}} {{vendorExtensions.x-path}}', function ({{#pathParams}}string ${{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) use ($handler) { + $r = \Flight::request(); + $handler->{{operationId}}Stream( + {{#vendorExtensions.x-nonFormParams}} + parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}} + {{/vendorExtensions.x-nonFormParams}} + ); + // ignore return value: streaming expected + })->streamWithHeaders(['Content-Type' => 'application/json']); + } + {{/returnContainer}} + + {{/operation}} + {{/operations}} + {{/apis}} + } +} + +{{/apiInfo}} + +function parseParam(mixed $param, string $type) +{ + $nonNullType = str_replace('?', '', $type); + if ($param === null) { + return null; + } elseif ($nonNullType === 'int') { + return intval($param); + } elseif ($nonNullType === 'float') { + return floatval($param); + } elseif ($nonNullType === 'bool') { + return filter_var($param, FILTER_VALIDATE_BOOLEAN); + } elseif (str_ends_with($type, '[]')) { + return array_map(fn($el) => parseParam($el, substr($type, 0, -2)), $param); + } elseif (str_starts_with($nonNullType, '\\{{escapedModelPackage}}')) { + return new $nonNullType($param); + } else { + return $param; + } +} + +function declaresMethod(\ReflectionClass $reflectionClass, string $methodName): bool +{ + return $reflectionClass->hasMethod($methodName) && $reflectionClass->getMethod($methodName)->getDeclaringClass()->getName() === $reflectionClass->getName(); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-flight/register_routes_test.mustache b/modules/openapi-generator/src/main/resources/php-flight/register_routes_test.mustache new file mode 100644 index 000000000000..c50fbade9c5b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-flight/register_routes_test.mustache @@ -0,0 +1,31 @@ +licenseInfo}} + +{{#apiInfo}} +namespace {{testPackage}}; + +class RegisterRoutesTest extends \PHPUnit\Framework\TestCase { +{{#apis}} + public function testRegisterRoutes{{classname}}(): void + { + $handler = new class extends \{{apiPackage}}\{{classname}} { + {{#operations}} + {{#operation}} + {{#-first}} + public function {{operationId}}({{#vendorExtensions.x-nonFormParams}}{{^isFormParam}}{{vendorExtensions.x-parameter-type}} ${{paramName}}{{^-last}}, {{/-last}}{{/isFormParam}}{{/vendorExtensions.x-nonFormParams}}): {{vendorExtensions.x-return-type}} + { + {{^vendorExtensions.x-return-type-is-void}} + return null; + {{/vendorExtensions.x-return-type-is-void}} + } + {{/-first}} + {{/operation}} + {{/operations}} + }; + \{{invokerPackage}}\RegisterRoutes::registerRoutes($handler); + $this->assertTrue(true); + } +{{/apis}} +} +{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache b/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache index ae0a5ae12e54..4af110c5e634 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache @@ -1,23 +1,45 @@ -name := "{{artifactId}}" -organization:="{{groupId}}" -version := "0.0.1-SNAPSHOT" -scalaVersion := "3.3.1" -scalafmtOnCompile := true -libraryDependencies ++= Seq( - "com.lihaoyi" %% "cask" % "0.9.2" , - "com.lihaoyi" %% "upickle" % "3.2.0", - "org.scalatest" %% "scalatest" % "3.2.18" % Test +ThisBuild / name := "{{artifactId}}" +ThisBuild / organization := "{{groupId}}" +ThisBuild / version := "0.0.1-SNAPSHOT" +ThisBuild / scalaVersion := "3.4.1" +ThisBuild / scalafmtOnCompile := true + +// Common settings +lazy val commonSettings = Seq( + libraryDependencies ++= Seq( + "com.lihaoyi" %%% "upickle" % "3.2.0", + "org.scalatest" %%% "scalatest" % "3.2.18" % Test + ) ) -publishMavenStyle := true + +lazy val app = crossProject(JSPlatform, JVMPlatform).in(file(".")). + settings(commonSettings). + jvmSettings( + libraryDependencies += "com.lihaoyi" %% "cask" % "0.9.2" + ). + jsSettings( + scalaJSUseMainModuleInitializer := true, + ) + + +lazy val root = project.in(file(".")). + aggregate(app.js, app.jvm). + settings( + publish := {}, + publishLocal := {}, + ) + + +ThisBuild / publishMavenStyle := true val githubUser = "{{{gitUserId}}}" val githubRepo = "{{{gitRepoId}}}" -publishTo := Some("GitHub Package Registry" at s"https://maven.pkg.github.com/$githubUser/$githubRepo") +ThisBuild / publishTo := Some("GitHub Package Registry" at s"https://maven.pkg.github.com/$githubUser/$githubRepo") sys.env.get("GITHUB_TOKEN") match { case Some(token) if !token.isEmpty => - credentials += Credentials( + ThisBuild / credentials += Credentials( "GitHub Package Registry", "maven.pkg.github.com", githubUser, diff --git a/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache b/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache index a31414db150c..86f838c35377 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache +++ b/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache @@ -28,8 +28,8 @@ object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule { ivy"com.lihaoyi::upickle:3.2.0" ) - override def sources = T.sources(millSourcePath / os.up / "src" / "main" / "scala") - override def resources = T.sources(millSourcePath / os.up / "src" / "main" / "resources") + override def sources = T.sources(millSourcePath / os.up / "shared" / "src" / "main" / "scala") + override def resources = T.sources(millSourcePath / os.up / "shared" / "src" / "main" / "resources") object test extends SbtModuleTests { def ivyDeps = Agg( diff --git a/modules/openapi-generator/src/main/resources/scala-cask/buildAndPublish.yml.mustache b/modules/openapi-generator/src/main/resources/scala-cask/buildAndPublish.yml.mustache new file mode 100644 index 000000000000..1df721e73653 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/scala-cask/buildAndPublish.yml.mustache @@ -0,0 +1,38 @@ +name: Scala CI with sbt + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache sbt dependencies + uses: actions/cache@v2 + with: + path: | + ~/.ivy2/cache + ~/.sbt + ~/.m2 + key: ${{{openbrackets}}} runner.os {{{closebrackets}}}-sbt-${{{openbrackets}}} hashFiles('**/*.sbt') {{{closebrackets}}} + restore-keys: | + ${{{openbrackets}}} runner.os {{{closebrackets}}}-sbt- + + - name: Build with sbt + run: sbt clean compile test + + - name: Publish to GitHub Packages + run: sbt publish + env: + GITHUB_TOKEN: ${{{openbrackets}}} secrets.GITHUB_TOKEN {{{closebrackets}}} diff --git a/modules/openapi-generator/src/main/resources/scala-cask/project/plugins.sbt b/modules/openapi-generator/src/main/resources/scala-cask/project/plugins.sbt index 4f3f02c2de45..ece317dfad9b 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/project/plugins.sbt +++ b/modules/openapi-generator/src/main/resources/scala-cask/project/plugins.sbt @@ -1,3 +1,4 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6") - -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") \ No newline at end of file +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift5/Models.mustache b/modules/openapi-generator/src/main/resources/swift5/Models.mustache index 9a8af56a8af1..3bd5e1c4f6c5 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Models.mustache @@ -130,9 +130,9 @@ extension NullEncodable: Codable where Wrapped: Codable { } {{/useAlamofire}} {{^useAlamofire}} - private var task: URLSessionTask? + private var task: URLSessionDataTaskProtocol? - internal func set(task: URLSessionTask) { + internal func set(task: URLSessionDataTaskProtocol) { lock.lock() defer { lock.unlock() } self.task = task diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index 0c8cc2863cd7..a17db02e6892 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -12,11 +12,33 @@ import MobileCoreServices import UniformTypeIdentifiers #endif +// Protocol defined for a session data task. This allows mocking out the URLSessionProtocol below since +// you may not want to create or return a real URLSessionDataTask. +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol URLSessionDataTaskProtocol { + func resume() + + var taskIdentifier: Int { get } + + var progress: Progress { get } + + func cancel() +} + +// Protocol allowing implementations to alter what is returned or to test their implementations. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol URLSessionProtocol { - func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask + // Task which performs the network fetch. Expected to be from URLSession.dataTask(with:completionHandler:) such that a network request + // is sent off when `.resume()` is called. + func dataTaskFromProtocol(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol +} + +extension URLSession: URLSessionProtocol { + // Passthrough to URLSession.dataTask(with:completionHandler) since URLSessionDataTask conforms to URLSessionDataTaskProtocol and fetches the network data. + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func dataTaskFromProtocol(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void) -> any URLSessionDataTaskProtocol { + return dataTask(with: request, completionHandler: completionHandler) + } } -extension URLSession: URLSessionProtocol {} +extension URLSessionDataTask: URLSessionDataTaskProtocol {} class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -136,7 +158,7 @@ private var credentialStore = SynchronizedDictionary() } } - let dataTask = urlSession.dataTask(with: request) { data, response, error in + let dataTask = urlSession.dataTaskFromProtocol(with: request) { data, response, error in apiResponseQueue.async { self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) cleanupRequest() diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache index 43207b65e305..232acaf3ea43 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache @@ -2,9 +2,17 @@ export interface {{classname}}{{#allParents}}{{#-first}} extends {{/-first}}{{{. {{#vars}} {{#description}} /** - * {{{.}}} + * {{{description}}} + {{#deprecated}} + * @deprecated + {{/deprecated}} */ {{/description}} + {{^description}} + {{#deprecated}} + /** @deprecated */ + {{/deprecated}} + {{/description}} {{#isReadOnly}}readonly {{/isReadOnly}}{{{name}}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; {{/vars}} }{{>modelGenericEnums}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache index 004fc11fdae8..aa594015c7f9 100755 --- a/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache @@ -118,50 +118,10 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any, ? configuration.isJsonMime(requestOptions.headers['Content-Type']) : nonString; return needsSerialization - ? JSON.stringify(value !== undefined ? convertMapsAndSetsToPlain(value) : {}) + ? JSON.stringify(value !== undefined ? value : {}) : (value || ""); } -function convertMapsAndSetsToPlain(value: any): any { - if (typeof Set === "undefined") return value; - if (typeof Map === "undefined") return value; - if (typeof value !== "object" || !value) { - return value; - } - if (value instanceof Set) { - return Array.from(value).map(item => convertMapsAndSetsToPlain(item)); - } - if (value instanceof Map) { - const entries: Array<[string, any]> = []; - value.forEach((value: any, key: any) => { - entries.push([key, convertMapsAndSetsToPlain(value)]) - }); - return objectFromEntries(entries); - } - if (Array.isArray(value)) { - return value.map(it => convertMapsAndSetsToPlain(it)); - } - return objectFromEntries(objectEntries(value) - .map(([k, v]) => [k, convertMapsAndSetsToPlain(v)])); -} - -/** - * Ponyfill for Object.entries - */ -function objectEntries(object: Record): Array<[string, any]> { - return Object.keys(object).map(key => [key, object[key]]); -} - -/** - * Ponyfill for Object.fromEntries - */ -function objectFromEntries(entries: any): Record { - return [...entries].reduce((object, [key, val]) => { - object[key] = val; - return object; - }, {}); -} - /** * * @export diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache index 0aeeaa782550..005aabdff6c8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache @@ -3,7 +3,7 @@ import { DynamicModule, Module, Global, Provider } from '@nestjs/common'; import { HttpModule, HttpService } from '@nestjs/axios'; {{/useAxiosHttpModule}} {{^useAxiosHttpModule}} -import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common'; +import { DynamicModule, HttpService, HttpModule, Module, Global, Provider } from '@nestjs/common'; {{/useAxiosHttpModule}} import { AsyncConfiguration, Configuration, ConfigurationFactory } from './configuration'; diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache index 064978b97537..fee3b7ff2023 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -9,11 +9,12 @@ import { HttpService } from '@nestjs/axios'; import { HttpService, Inject, Injectable, Optional } from '@nestjs/common'; {{/useAxiosHttpModule}} import { AxiosResponse } from 'axios'; -import { Observable } from 'rxjs'; +import { Observable, from, of, switchMap } from 'rxjs'; {{#imports}} import { {{classname}} } from '../{{filename}}'; {{/imports}} import { Configuration } from '../configuration'; +import { COLLECTION_FORMATS } from '../variables'; {{#withInterfaces}} import { {{classname}}Interface } from './{{classFilename}}Interface'; {{/withInterfaces}} @@ -117,6 +118,8 @@ export class {{classname}} { {{/isArray}} {{/headerParams}} + let accessTokenObservable: Observable = of(null); + {{#authMethods}} // authentication ({{name}}) required {{#isApiKey}} @@ -144,17 +147,16 @@ export class {{classname}} { {{/isBasicBasic}} {{#isBasicBearer}} if (typeof this.configuration.accessToken === 'function') { - headers['Authorization'] = `Bearer ${this.configuration.accessToken()}`; + accessTokenObservable = from(Promise.resolve(this.configuration.accessToken())); } else if (this.configuration.accessToken) { - headers['Authorization'] = `Bearer ${this.configuration.accessToken}`; + accessTokenObservable = from(Promise.resolve(this.configuration.accessToken)); } {{/isBasicBearer}} {{#isOAuth}} if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers['Authorization'] = 'Bearer ' + accessToken; + accessTokenObservable = typeof this.configuration.accessToken === 'function' + ? from(Promise.resolve(this.configuration.accessToken())) + : from(Promise.resolve(this.configuration.accessToken)) } {{/isOAuth}} @@ -224,18 +226,26 @@ export class {{classname}} { {{/formParams}} {{/hasFormParams}} - return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}} - {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}} - { -{{#hasQueryParams}} - params: queryParameters, -{{/hasQueryParams}} -{{#isResponseFile}} - responseType: "blob", -{{/isResponseFile}} - withCredentials: this.configuration.withCredentials, - headers: headers - } + return accessTokenObservable.pipe( + switchMap((accessToken) => { + if (accessToken) { + headers['Authorization'] = `Bearer ${accessToken}`; + } + + return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}} + {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}} + { + {{#hasQueryParams}} + params: queryParameters, + {{/hasQueryParams}} + {{#isResponseFile}} + responseType: "blob", + {{/isResponseFile}} + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + }) ); } {{/operation}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index cd0bc10c8f16..49e254d311d7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -1891,6 +1891,38 @@ public void testMicroprofileGenerateCorrectJsonbCreator_issue12622() throws Exce .containsWithNameAndAttributes("JsonbProperty", ImmutableMap.of("value", "\"c\"")); } + @Test + public void testMicroprofileGenerateCorrectJacksonGenerator_issue18336() throws Exception { + Map properties = new HashMap<>(); + properties.put(JavaClientCodegen.MICROPROFILE_REST_CLIENT_VERSION, "3.0"); + properties.put(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON); + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + + .setAdditionalProperties(properties) + .setGeneratorName("java") + .setLibrary(JavaClientCodegen.MICROPROFILE) + .setInputSpec("src/test/resources/bugs/issue_18336.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + DefaultGenerator generator = new DefaultGenerator(); + Map files = generator.opts(clientOptInput).generate().stream() + .collect(Collectors.toMap(File::getName, Function.identity())); + + JavaFileAssert.assertThat(files.get("Pet.java")) + .assertConstructor("String") + .assertConstructorAnnotations() + .containsWithName("JsonCreator") + .toConstructor() + .hasParameter("name") + .assertParameterAnnotations() + .containsWithNameAndAttributes("JsonProperty", ImmutableMap.of("value", "JSON_PROPERTY_NAME", "required", "true")); + } + @Test public void testJavaClientDefaultValues_issueNoNumber() throws Exception { Map properties = new HashMap<>(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java index c11931e8a4fd..d63754a27470 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java @@ -808,6 +808,103 @@ public void generateApiForQuarkusWithGzipFeature() throws Exception { ); } + @Test + public void generateApiForQuarkusWithoutMutiny() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/issue_4832.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(SUPPORT_ASYNC, true); + codegen.additionalProperties().put(USE_TAGS, true); //And use tags to generate everything in PingApi.java + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); //Using JavaJAXRSSpecServerCodegen + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); //When generating files + + //Then the java files are compilable + validateJavaSourceFiles(files); + + //And the generated class contains CompletionStage + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PingApi.java"); + TestUtils.assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PingApi.java"), + "CompletionStage pingGetBoolean", //Support primitive types response + "CompletionStage pingGetInteger" //Support primitive types response + ); + } + + @Test + public void generateApiForQuarkusWithMutinyApi() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/issue_4832.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(USE_TAGS, true); //And use tags to generate everything in PingApi.java + codegen.additionalProperties().put(SUPPORT_ASYNC, true); + codegen.additionalProperties().put(INTERFACE_ONLY, true); + codegen.additionalProperties().put(USE_MUTINY, true); + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); //Using JavaJAXRSSpecServerCodegen + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); //When generating files + + //Then the java files are compilable + validateJavaSourceFiles(files); + + //And the generated class contains CompletionStage + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PingApi.java"); + TestUtils.assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PingApi.java"), + "Uni pingGetBoolean", //Support primitive types response + "Uni pingGetInteger" //Support primitive types response + ); + } + + + @Test + public void generateApiForQuarkusWithMutinyImpl() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/issue_4832.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(USE_TAGS, true); //And use tags to generate everything in PingApi.java + codegen.additionalProperties().put(SUPPORT_ASYNC, true); + codegen.additionalProperties().put(USE_MUTINY, true); + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); //Using JavaJAXRSSpecServerCodegen + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); //When generating files + + //Then the java files are compilable + validateJavaSourceFiles(files); + + //And the generated class contains CompletionStage + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PingApi.java"); + TestUtils.assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PingApi.java"), + "Uni pingGetBoolean", //Support primitive types response + "Uni pingGetInteger" //Support primitive types response + ); + } + @Test public void testHandleRequiredAndReadOnlyPropertiesCorrectly() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/flight/PhpFlightServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/flight/PhpFlightServerCodegenTest.java new file mode 100644 index 000000000000..cbba0a00ed84 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/flight/PhpFlightServerCodegenTest.java @@ -0,0 +1,74 @@ +package org.openapitools.codegen.php.flight; + +import java.io.File; +import java.nio.file.Files; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.config.CodegenConfigurator; +import org.testng.annotations.Test; + +public class PhpFlightServerCodegenTest { + + @Test + public void shouldGenerateModel() throws Exception { + Map properties = new HashMap<>(); + + File output = Files.createTempDirectory("test").toFile(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php-flight") + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/petstore-php-flight.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(clientOptInput).generate(); + + TestUtils.ensureContainsFile(files, output, "Api/AbstractPetApi.php"); + TestUtils.ensureContainsFile(files, output, "Model/Pet.php"); + TestUtils.ensureContainsFile(files, output, "Model/StandaloneEnum.php"); + TestUtils.ensureContainsFile(files, output, "Model/PetStatus.php"); // inline enum + TestUtils.ensureContainsFile(files, output, "README.md"); + TestUtils.ensureContainsFile(files, output, "RegisterRoutes.php"); + + java.nio.file.Path petModelFile = files.stream().filter(f -> f.getName().contains("Pet.php")).findFirst().orElseThrow().toPath(); + TestUtils.assertFileContains(petModelFile, "namespace OpenAPIServer\\Model;"); + TestUtils.assertFileContains(petModelFile, "public int $id;"); + TestUtils.assertFileContains(petModelFile, "public ?string $name;"); + TestUtils.assertFileContains(petModelFile, "public ?\\DateTime $dateTimeAttribute;"); + TestUtils.assertFileContains(petModelFile, "@var Order[]|null"); + TestUtils.assertFileContains(petModelFile, "public ?array $objectList;"); + TestUtils.assertFileContains(petModelFile, "$data['photo_urls'] ?? null,"); + TestUtils.assertFileContains(petModelFile, "'photo_urls' => $this->photoUrls"); + + TestUtils.assertFileContains(petModelFile, "isset($data['category']) ? Category::fromArray($data['category']) : null,"); + TestUtils.assertFileContains(petModelFile, "isset($data['status']) ? PetStatus::tryFrom($data['status']) : null"); + TestUtils.assertFileContains(petModelFile, "isset($data['refEnum']) ? StandaloneEnum::tryFrom($data['refEnum']) : null"); + TestUtils.assertFileContains(petModelFile, "isset($data['dateTimeAttribute']) ? new \\DateTime($data['dateTimeAttribute']) : null"); + + java.nio.file.Path petApiFile = files.stream().filter(f -> f.getName().contains("AbstractPetApi.php")).findFirst().orElseThrow().toPath(); + TestUtils.assertFileContains(petApiFile, "namespace OpenAPIServer\\Api;"); + TestUtils.assertFileContains(petApiFile, "public function getPetById(int $petId)"); + TestUtils.assertFileContains(petApiFile, "public function updatePet(\\OpenAPIServer\\Model\\Pet $pet): \\OpenAPIServer\\Model\\Pet|null"); + + java.nio.file.Path registerRoutesFile = files.stream().filter(f -> f.getName().contains("RegisterRoutes.php")).findFirst().orElseThrow().toPath(); + TestUtils.assertFileContains(registerRoutesFile, "function registerRoutes(\\OpenAPIServer\\Api\\AbstractPetApi|\\OpenAPIServer\\Api\\AbstractUserApi $handler): void"); + TestUtils.assertFileContains(registerRoutesFile, + "Flight::route('POST /user/createWithArray/@pathParamInt/@pathParamString', function (string $pathParamInt, string $pathParamString) use ($handler) {"); + TestUtils.assertFileContains(registerRoutesFile, "parseParam($pathParamInt, 'int')"); + TestUtils.assertFileContains(registerRoutesFile, "parseParam($pathParamString, 'string')"); + TestUtils.assertFileContains(registerRoutesFile, "parseParam(json_decode($r->getBody(), true), '\\\\OpenAPIServer\\\\Model\\\\User[]')"); + TestUtils.assertFileContains(registerRoutesFile, "parseParam($r->getHeader('api_key'), '?string')"); + + Files.readAllLines(files.stream().filter(f -> f.getName().contains("RegisterRoutesTest.php")).findFirst().orElseThrow().toPath()).forEach(System.out::println); + java.nio.file.Path registerRoutesTestFile = files.stream().filter(f -> f.getName().contains("RegisterRoutesTest.php")).findFirst().orElseThrow().toPath(); + TestUtils.assertFileContains(registerRoutesTestFile, "namespace OpenAPIServer\\Test;"); + + output.deleteOnExit(); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java index 31a67ed61901..a8f559512820 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java @@ -6,8 +6,12 @@ import io.swagger.v3.oas.models.media.MapSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; +import org.openapitools.codegen.config.CodegenConfigurator; +import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.Generator; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen; @@ -17,6 +21,14 @@ import org.testng.Assert; import org.testng.annotations.Test; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static org.assertj.core.api.Assertions.assertThat; @Test(groups = {TypeScriptGroups.TYPESCRIPT, TypeScriptGroups.TYPESCRIPT_FETCH}) @@ -55,6 +67,32 @@ public void testOptionalResponseImports() { Assert.assertEquals(operation.isResponseOptional, true); } + @Test + public void testModelsWithoutPaths() throws IOException { + final String specPath = "src/test/resources/3_1/reusable-components-without-paths.yaml"; + + Map properties = new HashMap<>(); + properties.put("supportsES6", true); + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("typescript-fetch") + .setInputSpec(specPath) + .setAdditionalProperties(properties) + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + Generator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + TestUtils.assertFileExists(Paths.get(output + "/index.ts")); + TestUtils.assertFileExists(Paths.get(output + "/runtime.ts")); + TestUtils.assertFileExists(Paths.get(output + "/models/Pet.ts")); + TestUtils.assertFileExists(Paths.get(output + "/models/index.ts")); + } + @Test public void testWithoutSnapshotVersion() { OpenAPI api = TestUtils.createOpenAPI(); diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-php-flight.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-php-flight.yaml new file mode 100644 index 000000000000..ded453c4dd3f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-php-flight.yaml @@ -0,0 +1,411 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + This is a sample server Petstore server. For this sample, you can use the api key + `special-key` to test the authorization filters. + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '405': + description: Invalid input + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + externalDocs: + url: "http://petstore.swagger.io/v2/doc/updatePet" + description: "API documentation for the updatePet operation" + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + requestBody: + $ref: '#/components/requestBodies/Pet' + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + /user/createWithArray/{pathParamInt}/{pathParamString}: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + parameters: + - name: pathParamInt + in: path + required: true + schema: + type: integer + format: int64 + - name: pathParamString + in: path + required: true + schema: + type: string + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + Set-Cookie: + description: >- + Cookie authentication key for use with the `api_key` + apiKey authentication. + schema: + type: string + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + schemas: + StandaloneEnum: + type: string + enum: + - firstValue + - secondValue + Order: + title: Pet Order + description: An order for a pets from the pet store + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + title: Pet category + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + xml: + name: Category + User: + title: a User + description: A User who is purchasing from the pet store + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + title: Pet Tag + description: A tag for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - id + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photo_urls: + type: array + items: + type: string + tags: + type: array + items: + $ref: '#/components/schemas/Tag' + refEnum: + $ref: '#/components/schemas/StandaloneEnum' + status: + type: string + description: pet status in the store + deprecated: true + enum: + - available + - pending + - sold + dateTimeAttribute: + type: string + format: date-time + primitiveList: + type: array + items: + type: integer + objectList: + type: array + items: + $ref: '#/components/schemas/Order' + dateTimeList: + type: array + items: + type: string + format: date-time + inlineEnumList: + type: array + items: + type: string + enum: + - firstValue + - secondValue + refEnumList: + type: array + items: + $ref: '#/components/schemas/StandaloneEnum' + xml: + name: Pet + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_1/reusable-components-without-paths.yaml b/modules/openapi-generator/src/test/resources/3_1/reusable-components-without-paths.yaml new file mode 100644 index 000000000000..d7ab4d11e6e9 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/reusable-components-without-paths.yaml @@ -0,0 +1,19 @@ +openapi: 3.1.0 +info: + title: Reusable components without paths example + version: 1.0.0 +# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string diff --git a/modules/openapi-generator/src/test/resources/bugs/issue_18336.yaml b/modules/openapi-generator/src/test/resources/bugs/issue_18336.yaml new file mode 100644 index 000000000000..170e469d9573 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/bugs/issue_18336.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + title: "OpenAPI Definition" + version: "0.0.1" +paths: + /pets: + get: + responses: + 200: + description: "Return Pet with name" + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + readOnly: true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7452048bf0c9..49dc57d3bc9b 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ pom openapi-generator-project - 7.5.0-SNAPSHOT + 7.6.0-SNAPSHOT https://github.com/openapitools/openapi-generator diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION b/samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION +++ b/samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/csharp-restsharp/README.md b/samples/client/echo_api/csharp-restsharp/README.md index 3871b6487200..107ffdd4485e 100644 --- a/samples/client/echo_api/csharp-restsharp/README.md +++ b/samples/client/echo_api/csharp-restsharp/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap - API version: 0.1.0 - SDK version: 1.0.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.CSharpClientCodegen diff --git a/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION b/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION +++ b/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/go-external-refs/README.md b/samples/client/echo_api/go-external-refs/README.md index 667c2abf4146..fad1614415a6 100644 --- a/samples/client/echo_api/go-external-refs/README.md +++ b/samples/client/echo_api/go-external-refs/README.md @@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 0.1.0 - Package version: 1.0.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/echo_api/go/.openapi-generator/VERSION b/samples/client/echo_api/go/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/go/.openapi-generator/VERSION +++ b/samples/client/echo_api/go/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/go/README.md b/samples/client/echo_api/go/README.md index f43c18cad895..1cac0c683600 100644 --- a/samples/client/echo_api/go/README.md +++ b/samples/client/echo_api/go/README.md @@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 0.1.0 - Package version: 1.0.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/VERSION b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/VERSION +++ b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/java/apache-httpclient/README.md b/samples/client/echo_api/java/apache-httpclient/README.md index 14639af67d40..cf0aadd4452d 100644 --- a/samples/client/echo_api/java/apache-httpclient/README.md +++ b/samples/client/echo_api/java/apache-httpclient/README.md @@ -4,7 +4,7 @@ Echo Server API - API version: 0.1.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT Echo Server API diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java index 56c88531bf19..872244b89008 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java @@ -81,7 +81,7 @@ import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiClient extends JavaTimeFormatter { private Map defaultHeaderMap = new HashMap(); private Map defaultCookieMap = new HashMap(); diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiException.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiException.java index 1e070eabb767..8b665dec0b8f 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiException.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/BaseApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/BaseApi.java index 99058daec188..f343427ea702 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/BaseApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/BaseApi.java @@ -17,7 +17,7 @@ import java.util.Collections; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public abstract class BaseApi { protected ApiClient apiClient; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Configuration.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Configuration.java index 12bb7ef992ad..0c5a913e293f 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Configuration.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Configuration { public static final String VERSION = "0.1.0"; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/JavaTimeFormatter.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/JavaTimeFormatter.java index 6714734cbae9..ed434f21ffe9 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/JavaTimeFormatter.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/JavaTimeFormatter.java @@ -20,7 +20,7 @@ * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class JavaTimeFormatter { private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Pair.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Pair.java index 2aaa3c1c894c..1957e1fde3a8 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/RFC3339DateFormat.java index 4e4fa082be31..23e3f188302b 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -22,7 +22,7 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerConfiguration.java index 9f0d43d35b26..dd276623ffc4 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -5,7 +5,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerVariable.java index 45a1199f19d0..fdb468f79f9e 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ServerVariable.java @@ -5,7 +5,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/StringUtil.java index d180fb51a015..b82aa59e5bf8 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/AuthApi.java index ace5120cffce..dc726d96c9c0 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/AuthApi.java @@ -29,7 +29,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class AuthApi extends BaseApi { public AuthApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/BodyApi.java index 3a67792084c4..abbe6718da53 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/BodyApi.java @@ -33,7 +33,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class BodyApi extends BaseApi { public BodyApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java index 571e63678bb9..2dd4c8c6f530 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java @@ -30,7 +30,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class FormApi extends BaseApi { public FormApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/HeaderApi.java index f08d6707409f..fafbc2f5b212 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -30,7 +30,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class HeaderApi extends BaseApi { public HeaderApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/PathApi.java index 6fd8e449883f..dcb7146a9844 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/PathApi.java @@ -30,7 +30,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class PathApi extends BaseApi { public PathApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/QueryApi.java index ba1a6ea6809c..95577e2a31fc 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/QueryApi.java @@ -36,7 +36,7 @@ import java.util.Map; import java.util.StringJoiner; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class QueryApi extends BaseApi { public QueryApi() { diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 0b2f60be01f5..3c68e82e0136 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 8f3ab535bad8..fa801058c07f 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -21,7 +21,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 68bb5c319dce..8be79a006cc3 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Bird.java index e33947e522db..d78b79a021f4 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Bird.java @@ -33,7 +33,7 @@ Bird.JSON_PROPERTY_SIZE, Bird.JSON_PROPERTY_COLOR }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Bird { public static final String JSON_PROPERTY_SIZE = "size"; private String size; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Category.java index 7cbe7c3b19f7..028108c0b937 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Category.java @@ -33,7 +33,7 @@ Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Category { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DataQuery.java index 2f88f2f146f0..d0d21af1332d 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DataQuery.java @@ -39,7 +39,7 @@ DataQuery.JSON_PROPERTY_TEXT, DataQuery.JSON_PROPERTY_DATE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DataQuery extends Query { public static final String JSON_PROPERTY_SUFFIX = "suffix"; private String suffix; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java index dddd3d2ebd54..e625ae440941 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -47,7 +47,7 @@ DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE, DefaultValue.JSON_PROPERTY_STRING_NULLABLE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DefaultValue { public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; private List arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE)); diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 3b4c43c5d364..9dc37d02098b 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -35,7 +35,7 @@ NumberPropertiesOnly.JSON_PROPERTY_FLOAT, NumberPropertiesOnly.JSON_PROPERTY_DOUBLE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class NumberPropertiesOnly { public static final String JSON_PROPERTY_NUMBER = "number"; private BigDecimal number; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Pet.java index ecdf88998091..14765ca27978 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Pet.java @@ -42,7 +42,7 @@ Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_STATUS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Pet { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Query.java index bcd52beab406..8fc5a951c43d 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Query.java @@ -36,7 +36,7 @@ Query.JSON_PROPERTY_ID, Query.JSON_PROPERTY_OUTCOMES }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Query { public static final String JSON_PROPERTY_ID = "id"; protected Long id; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Tag.java index 545619fcec5e..41626ab09d36 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/Tag.java @@ -33,7 +33,7 @@ Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Tag { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index ed76a3ac7c79..b828f34c09d7 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -33,7 +33,7 @@ TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME }) @JsonTypeName("test_form_object_multipart_request_marker") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestFormObjectMultipartRequestMarker { public static final String JSON_PROPERTY_NAME = "name"; private String name; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index 8fbbc49b4372..1328ccb0fda2 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -36,7 +36,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_NAME }) @JsonTypeName("test_query_style_deepObject_explode_true_object_allOf_query_object_parameter") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { public static final String JSON_PROPERTY_SIZE = "size"; private String size; diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index be1941bef8f2..39c82cfdf6aa 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -36,7 +36,7 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.JSON_PROPERTY_VALUES }) @JsonTypeName("test_query_style_form_explode_true_array_string_query_object_parameter") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { public static final String JSON_PROPERTY_VALUES = "values"; private List values = new ArrayList<>(); diff --git a/samples/client/echo_api/java/feign-gson/.openapi-generator/VERSION b/samples/client/echo_api/java/feign-gson/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/java/feign-gson/.openapi-generator/VERSION +++ b/samples/client/echo_api/java/feign-gson/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ApiClient.java index 1c83285297ca..a142ce47529d 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -18,7 +18,7 @@ import org.openapitools.client.auth.ApiKeyAuth; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiClient { private static final Logger log = Logger.getLogger(ApiClient.class.getName()); diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerConfiguration.java index 9f0d43d35b26..dd276623ffc4 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -5,7 +5,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerVariable.java index 45a1199f19d0..fdb468f79f9e 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/ServerVariable.java @@ -5,7 +5,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/StringUtil.java index d180fb51a015..b82aa59e5bf8 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/AuthApi.java index 32c9664f47ad..902ef5d4c9a0 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/AuthApi.java @@ -11,7 +11,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface AuthApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/BodyApi.java index 946ad1bc732d..5c68b84106f6 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/BodyApi.java @@ -15,7 +15,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface BodyApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java index 45e0360081ba..5e8afc9888fd 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java @@ -12,7 +12,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface FormApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/HeaderApi.java index 6c017ef764bd..62f4627acc81 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -12,7 +12,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface HeaderApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/PathApi.java index b906938db376..c6064782633d 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/PathApi.java @@ -12,7 +12,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface PathApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/QueryApi.java index 2bbfdea03401..5bddf965d98c 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/QueryApi.java @@ -18,7 +18,7 @@ import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public interface QueryApi extends ApiClient.Api { diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Bird.java index c0e25df7d4ff..d24604a8f521 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Bird.java @@ -25,7 +25,7 @@ /** * Bird */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Bird { public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Category.java index 2d9cf6b89100..f07433944808 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Category.java @@ -25,7 +25,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DataQuery.java index 2a87f2d1b76c..86276858e8fa 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DataQuery.java @@ -30,7 +30,7 @@ /** * DataQuery */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DataQuery extends Query { public static final String SERIALIZED_NAME_SUFFIX = "suffix"; @SerializedName(SERIALIZED_NAME_SUFFIX) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DefaultValue.java index 26c76c80bad0..948d30e8a923 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -30,7 +30,7 @@ /** * to test the default value of properties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DefaultValue { public static final String SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; @SerializedName(SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 5a5f336264c8..2e5b58fc3c5e 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -26,7 +26,7 @@ /** * NumberPropertiesOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class NumberPropertiesOnly { public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Pet.java index 3d94f1a79294..eac78de2da9e 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -30,7 +30,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Query.java index 81cb55626285..92189a3ecf37 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Query.java @@ -28,7 +28,7 @@ /** * Query */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Query { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Tag.java index f9076e07e02d..9bda1df82a1c 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -25,7 +25,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index 96f0b78cfa85..7469349da222 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -25,7 +25,7 @@ /** * TestFormObjectMultipartRequestMarker */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestFormObjectMultipartRequestMarker { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index cc6dd54f7ef4..14ea7b9d0c12 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -25,7 +25,7 @@ /** * TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index 7e547a32a772..587e57e0d3b2 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -28,7 +28,7 @@ /** * TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { public static final String SERIALIZED_NAME_VALUES = "values"; @SerializedName(SERIALIZED_NAME_VALUES) diff --git a/samples/client/echo_api/java/native/.openapi-generator/VERSION b/samples/client/echo_api/java/native/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/client/echo_api/java/native/.openapi-generator/VERSION +++ b/samples/client/echo_api/java/native/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/java/native/README.md b/samples/client/echo_api/java/native/README.md index d14399b78a7d..630e96c83205 100644 --- a/samples/client/echo_api/java/native/README.md +++ b/samples/client/echo_api/java/native/README.md @@ -4,7 +4,7 @@ Echo Server API - API version: 0.1.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT Echo Server API diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiClient.java index 44d19e9319aa..63dcb956c2d0 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiClient.java @@ -51,7 +51,7 @@ *

The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiClient { private HttpClient.Builder builder; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiException.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiException.java index 89ed87ce3f85..052dac0d844e 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiResponse.java index cef1c3cea20b..bbd165c487f7 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Configuration.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Configuration.java index 12bb7ef992ad..0c5a913e293f 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Configuration.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Configuration { public static final String VERSION = "0.1.0"; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java index b21cbc41852c..420adcb4a675 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java @@ -13,7 +13,7 @@ import java.util.Map; import java.util.Set; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class JSON { private ObjectMapper mapper; @@ -69,7 +69,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Pair.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Pair.java index 2aaa3c1c894c..1957e1fde3a8 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java index 4e4fa082be31..23e3f188302b 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -22,7 +22,7 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java index 9f0d43d35b26..dd276623ffc4 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -5,7 +5,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerVariable.java index 45a1199f19d0..fdb468f79f9e 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ServerVariable.java @@ -5,7 +5,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index f409f546590c..e5d7e79b66b4 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -43,7 +43,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class AuthApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index 47ce48b0e463..1b7daef28694 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -53,7 +53,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class BodyApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index 6ccb4b0138b1..c78a8769e183 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -50,7 +50,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class FormApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index e0acce061a60..c98d122c6c28 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -50,7 +50,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class HeaderApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index 668040b87927..a13e17862130 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -50,7 +50,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class PathApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index 3bbd7dda89c7..f918ae92391f 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -56,7 +56,7 @@ import java.util.Set; import java.util.function.Consumer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class QueryApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index f346f9ea9d86..99787bcc6550 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Bird.java index 998c11042d31..a838d0310aea 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Bird.java @@ -35,7 +35,7 @@ Bird.JSON_PROPERTY_SIZE, Bird.JSON_PROPERTY_COLOR }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Bird { public static final String JSON_PROPERTY_SIZE = "size"; private String size; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Category.java index f635c7cb6bdb..660400c91560 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Category { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DataQuery.java index 4addb74338a4..14477c572f97 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DataQuery.java @@ -40,7 +40,7 @@ DataQuery.JSON_PROPERTY_TEXT, DataQuery.JSON_PROPERTY_DATE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DataQuery extends Query { public static final String JSON_PROPERTY_SUFFIX = "suffix"; private String suffix; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java index 20b4faa06e85..d104217a6ad5 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -48,7 +48,7 @@ DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE, DefaultValue.JSON_PROPERTY_STRING_NULLABLE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class DefaultValue { public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; private List arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE)); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 2bb722d2b676..542aada416ad 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -37,7 +37,7 @@ NumberPropertiesOnly.JSON_PROPERTY_FLOAT, NumberPropertiesOnly.JSON_PROPERTY_DOUBLE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class NumberPropertiesOnly { public static final String JSON_PROPERTY_NUMBER = "number"; private BigDecimal number; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Pet.java index 4d7f82de0cc8..24f4c9027387 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Pet.java @@ -43,7 +43,7 @@ Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_STATUS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Pet { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Query.java index f365d1d3982b..497584732b70 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Query.java @@ -37,7 +37,7 @@ Query.JSON_PROPERTY_ID, Query.JSON_PROPERTY_OUTCOMES }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Query { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Tag.java index 8d67cf692e2a..b477a902a7e0 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/Tag.java @@ -35,7 +35,7 @@ Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class Tag { public static final String JSON_PROPERTY_ID = "id"; private Long id; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index c84ea1893032..6ac586587ee3 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -34,7 +34,7 @@ @JsonPropertyOrder({ TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestFormObjectMultipartRequestMarker { public static final String JSON_PROPERTY_NAME = "name"; private String name; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index 812939f623ea..a979200a0603 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -37,7 +37,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_ID, TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_NAME }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { public static final String JSON_PROPERTY_SIZE = "size"; private String size; diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index f57663d4b330..35ae9f59e560 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -36,7 +36,7 @@ @JsonPropertyOrder({ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.JSON_PROPERTY_VALUES }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { public static final String JSON_PROPERTY_VALUES = "values"; private List values = new ArrayList<>(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.github/workflows/maven.yml b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.github/workflows/maven.yml new file mode 100644 index 000000000000..1dc4b505d7ed --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ '8' ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.gitignore b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator-ignore b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/FILES b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/FILES new file mode 100644 index 000000000000..0061d2762a1a --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/FILES @@ -0,0 +1,63 @@ +.github/workflows/maven.yml +.gitignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApiDocumentation.md +docs/StoreApiDocumentation.md +docs/Tag.md +docs/User.md +docs/UserApiDocumentation.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +info.md +modelCopy/Category.java +modelCopy/ModelApiResponse.java +modelCopy/Order.java +modelCopy/Pet.java +modelCopy/Tag.java +modelCopy/User.java +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/GzipRequestInterceptor.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/VERSION b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.travis.yml b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md new file mode 100644 index 000000000000..61555e362393 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md @@ -0,0 +1,184 @@ +# openapi-java-client + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.6.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central. + mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:openapi-java-client:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/openapi-java-client-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/api/openapi.yaml b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/api/openapi.yaml new file mode 100644 index 000000000000..cd0be0cc180b --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/api/openapi.yaml @@ -0,0 +1,870 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle new file mode 100644 index 000000000000..c200c7adc70d --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle @@ -0,0 +1,169 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + jakarta_annotation_version = "1.3.5" +} + +dependencies { + implementation 'io.swagger:swagger-annotations:1.6.8' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'javax.ws.rs:jsr311-api:1.1.1' + implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + + removeUnusedImports() + importOrder() + } +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt new file mode 100644 index 000000000000..3f438cc18060 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt @@ -0,0 +1,29 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "openapi-java-client", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.12.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "javax.ws.rs" % "jsr311-api" % "1.1.1", + "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.2", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" + ) + ) diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Category.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/ModelApiResponse.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Order.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Pet.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/PetApiDocumentation.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/PetApiDocumentation.md new file mode 100644 index 000000000000..f395ba3f6f16 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/PetApiDocumentation.md @@ -0,0 +1,570 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> Pet updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/StoreApiDocumentation.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/StoreApiDocumentation.md new file mode 100644 index 000000000000..af54298ffc2e --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/StoreApiDocumentation.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Tag.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/User.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/UserApiDocumentation.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/UserApiDocumentation.md new file mode 100644 index 000000000000..4c338a42137a --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/docs/UserApiDocumentation.md @@ -0,0 +1,553 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/git_push.sh b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle.properties b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..7454180f2ae8 Binary files /dev/null and b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.properties b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..ffed3a254e91 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew new file mode 100644 index 000000000000..005bcde04284 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew.bat b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew.bat new file mode 100644 index 000000000000..6a68175eb70f --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/info.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/info.md new file mode 100644 index 000000000000..5f1571afb2eb --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/info.md @@ -0,0 +1,1287 @@ +

OpenAPI Generator

+ + +
+ +[![Stable releases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) +[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) +[![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator) +[![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g) +[![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator) +[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/OpenAPITools/openapi-generator) +[![Conan Center](https://shields.io/conan/v/openapi-generator)](https://conan.io/center/recipes/openapi-generator) +[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.openapi-generator.tech/scans) +
+ +
+ +[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.6.0`): +[![Build Status](https://api.travis-ci.com/OpenAPITools/openapi-generator.svg?branch=master&status=passed)](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds) +[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) +[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator) +[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67) + +
+ +
+ +:star::star::star: If you would like to contribute, please refer to [guidelines](CONTRIBUTING.md) and a list of [open tasks](https://github.com/openapitools/openapi-generator/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). :star::star::star: + +:bangbang: To migrate from Swagger Codegen to OpenAPI Generator, please refer to the [migration guide](docs/migration-from-swagger-codegen.md) :bangbang: + +:notebook_with_decorative_cover: For more information, please refer to the [Wiki page](https://github.com/openapitools/openapi-generator/wiki) and [FAQ](https://github.com/openapitools/openapi-generator/wiki/FAQ) :notebook_with_decorative_cover: + +:notebook_with_decorative_cover: The eBook [A Beginner's Guide to Code Generation for REST APIs](https://gum.co/openapi_generator_ebook) is a good starting point for beginners :notebook_with_decorative_cover: + +:warning: If the OpenAPI spec, templates or any input (e.g. options, environment variables) is obtained from an untrusted source or environment, please make sure you've reviewed these inputs before using OpenAPI Generator to generate the API client, server stub or documentation to avoid potential security issues (e.g. [code injection](https://en.wikipedia.org/wiki/Code_injection)). For security vulnerabilities, please contact [team@openapitools.org](mailto:team@openapitools.org). :warning: + +:bangbang: Both "OpenAPI Tools" (https://OpenAPITools.org - the parent organization of OpenAPI Generator) and "OpenAPI Generator" are not affiliated with OpenAPI Initiative (OAI) :bangbang: + +
+ +## Sponsors + +If you find OpenAPI Generator useful for work, please consider asking your company to support this Open Source project by [becoming a sponsor](https://opencollective.com/openapi_generator). You can also individually sponsor the project by [becoming a backer](https://opencollective.com/openapi_generator). + +#### Thank you to our bronze sponsors! + +[![NamSor](https://openapi-generator.tech/img/companies/namsor.png)](https://www.namsor.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[![LightBow](https://openapi-generator.tech/img/companies/lightbow.png)](https://www.lightbow.net/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://docspring.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://datadoghq.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://cpl.thalesgroup.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.apideck.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.pexa.com.au/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.numary.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.onesignal.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.virtualansoftware.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.merge.dev/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.burkert.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.finbourne.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://bump.sh/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.bileto.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.bairesdev.com/sponsoring-open-source-projects/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.dmtech.de/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://adyen.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://fornex.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=1524_openapigenerator) +[](https://ssstwitter.com/?utm_source=github&utm_medium=referral&utm_campaign=sponsor) +[](https://www.svix.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship) +[](https://litslink.com/services/artificial-intelligence?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship) +[](https://designli.co?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship) + + +#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity + +[](https://www.godaddy.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[![Linode](https://www.linode.com/media/images/logos/standard/light/linode-logo_standard_light_small.png)](https://www.linode.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://checklyhq.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://gradle.org?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) + +## Overview + +OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification) (both 2.0 and 3.0 are supported). Currently, the following languages/frameworks are supported: + +| | Languages/Frameworks | +| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 17.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** | +| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) | +| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** | +| **Configuration files** | [**Apache2**](https://httpd.apache.org/) | +| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** | + +## Table of contents + + - [OpenAPI Generator](#openapi-generator) + - [Overview](#overview) + - [Table of Contents](#table-of-contents) + - [1 - Installation](#1---installation) + - [1.1 - Compatibility](#11---compatibility) + - [1.2 - Artifacts on Maven Central](#12---artifacts-on-maven-central) + - [1.3 - Download JAR](#13---download-jar) + - [1.4 - Build Projects](#14---build-projects) + - [1.5 - Homebrew](#15---homebrew) + - [1.6 - Docker](#16---docker) + - [1.7 - NPM](#17---npm) + - [2 - Getting Started](#2---getting-started) + - [3 - Usage](#3---usage) + - [3.1 - Customization](#31---customization) + - [3.2 - Workflow Integration](#32---workflow-integration-maven-gradle-github-cicd) + - [3.3 - Online Generators](#33---online-openapi-generator) + - [3.4 - License Information on Generated Code](#34---license-information-on-generated-code) + - [3.5 - IDE Integration](#35---ide-integration) + - [4 - Companies/Projects using OpenAPI Generator](#4---companiesprojects-using-openapi-generator) + - [5 - Presentations/Videos/Tutorials/Books](#5---presentationsvideostutorialsbooks) + - [6 - About Us](#6---about-us) + - [6.1 - OpenAPI Generator Core Team](#61---openapi-generator-core-team) + - [6.2 - OpenAPI Generator Technical Committee](#62---openapi-generator-technical-committee) + - [6.3 - History of OpenAPI Generator](#63---history-of-openapi-generator) + - [7 - License](#7---license) + +## [1 - Installation](#table-of-contents) + +### [1.1 - Compatibility](#table-of-contents) + +The OpenAPI Specification has undergone 3 revisions since initial creation in 2010. The openapi-generator project has the following compatibilities with the OpenAPI Specification: + +| OpenAPI Generator Version | Release Date | Notes | +| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- | +| 7.6.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.6.0-SNAPSHOT/) | 17.54.2024 | Minor release with breaking changes (with fallback) | +| [7.5.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.5.0) (latest stable release) | 17.04.2024 | Minor release with breaking changes (with fallback) | +| [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) | +| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) | +| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) | + +OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0, 3.1 (beta support) + +(We do not publish daily/nightly build. Please use SNAPSHOT instead) + +For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page. + +For decomissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page. + +## [1.2 - Artifacts on Maven Central](#table-of-contents) + +You can find our released artifacts on maven central: + +**Core:** +```xml + + org.openapitools + openapi-generator + ${openapi-generator-version} + +``` +See the different versions of the [openapi-generator](https://search.maven.org/artifact/org.openapitools/openapi-generator) artifact available on maven central. + +**Cli:** +```xml + + org.openapitools + openapi-generator-cli + ${openapi-generator-version} + +``` +See the different versions of the [openapi-generator-cli](https://search.maven.org/artifact/org.openapitools/openapi-generator-cli) artifact available on maven central. + +**Maven plugin:** +```xml + + org.openapitools + openapi-generator-maven-plugin + ${openapi-generator-version} + +``` +* See the different versions of the [openapi-generator-maven-plugin](https://search.maven.org/artifact/org.openapitools/openapi-generator-maven-plugin) artifact available on maven central. +* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.md) + +**Gradle plugin:** +```xml + + org.openapitools + openapi-generator-gradle-plugin + ${openapi-generator-version} + +``` +* See the different versions of the [openapi-generator-gradle-plugin](https://search.maven.org/artifact/org.openapitools/openapi-generator-gradle-plugin) artifact available on maven central. +* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc) + +### [1.3 - Download JAR](#table-of-contents) + +If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum): + +JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar` + +For **Mac/Linux** users: +```sh +wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar -O openapi-generator-cli.jar +``` + +For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. +``` +Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar +``` + +After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. + +For Mac users, please make sure Java 11 is installed (Tips: run `java -version` to check the version), and export `JAVA_HOME` in order to use the supported Java version: +```sh +export JAVA_HOME=`/usr/libexec/java_home -v 1.11` +export PATH=${JAVA_HOME}/bin:$PATH +``` + + +### Launcher Script + +One downside to manual jar downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at [bin/utils/openapi-generator.cli.sh](./bin/utils/openapi-generator-cli.sh) which resolves this issue. + +To install the launcher script, copy the contents of the script to a location on your path and make the script executable. + +An example of setting this up (NOTE: Always evaluate scripts curled from external systems before executing them). + +``` +mkdir -p ~/bin/openapitools +curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli +chmod u+x ~/bin/openapitools/openapi-generator-cli +export PATH=$PATH:~/bin/openapitools/ +``` + +Now, `openapi-generator-cli` is "installed". On invocation, it will query the GitHub repository for the most recently released version. If this matches the last downloaded jar, +it will execute as normal. If a newer version is found, the script will download the latest release and execute it. + +If you need to invoke an older version of the generator, you can define the variable `OPENAPI_GENERATOR_VERSION` either ad hoc or globally. You can export this variable if you'd like to persist a specific release version. + +Examples: + +``` +# Execute latest released openapi-generator-cli +openapi-generator-cli version + +# Execute version 4.1.0 for the current invocation, regardless of the latest released version +OPENAPI_GENERATOR_VERSION=4.1.0 openapi-generator-cli version + +# Execute version 4.1.0-SNAPSHOT for the current invocation +OPENAPI_GENERATOR_VERSION=4.1.0-SNAPSHOT openapi-generator-cli version + +# Execute version 4.0.2 for every invocation in the current shell session +export OPENAPI_GENERATOR_VERSION=4.0.2 +openapi-generator-cli version # is 4.0.2 +openapi-generator-cli version # is also 4.0.2 + +# To "install" a specific version, set the variable in .bashrc/.bash_profile +echo "export OPENAPI_GENERATOR_VERSION=4.0.2" >> ~/.bashrc +source ~/.bashrc +openapi-generator-cli version # is always 4.0.2, unless any of the above overrides are done ad hoc +``` + +### [1.4 - Build Projects](#table-of-contents) + +To build from source, you need the following installed and available in your `$PATH:` + +* [Java 11](https://adoptium.net/) + +* [Apache Maven 3.3.4 or greater](https://maven.apache.org/) (optional) + +After cloning the project, you can build it from source using [maven wrapper](https://maven.apache.org/wrapper/): + +- Linux: `./mvnw clean install` +- Windows: `mvnw.cmd clean install` + +#### Nix users + +If you're a nix user, you can enter OpenAPI Generator shell, by typing: +```sh +nix develop +``` +It will enter a shell with Java 11 installed. + +Direnv supports automatically loading of the nix developer shell, so if you're using direnv too, type: +```sh +direnv allow +``` +and have `java` and `mvn` set up with correct versions each time you enter project directory. + +The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the `static-analysis` profile: + +- Linux: `./mvnw -Pstatic-analysis clean install` +- Windows: `mvnw.cmd -Pstatic-analysis clean install` + +### [1.5 - Homebrew](#table-of-contents) + +To install, run `brew install openapi-generator` + +Here is an example usage to generate a Ruby client: +```sh +openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby -o /tmp/test/ +``` + +To reinstall with the latest master, run `brew uninstall openapi-generator && brew install --HEAD openapi-generator` + +To install OpenJDK (pre-requisites), please run +```sh +brew tap AdoptOpenJDK/openjdk +brew install --cask adoptopenjdk11 +export JAVA_HOME=`/usr/libexec/java_home -v 1.11` +``` + +or download installer via https://adoptium.net/ + +To install Maven (optional), please run +```sh +brew install maven +``` + +### [1.6 - Docker](#table-of-contents) + +#### Public Pre-built Docker images + + - [https://hub.docker.com/r/openapitools/openapi-generator-cli/](https://hub.docker.com/r/openapitools/openapi-generator-cli/) (official CLI) + - [https://hub.docker.com/r/openapitools/openapi-generator-online/](https://hub.docker.com/r/openapitools/openapi-generator-online/) (official web service) + + +#### OpenAPI Generator CLI Docker Image + +The OpenAPI Generator image acts as a standalone executable. It can be used as an alternative to installing via homebrew, or for developers who are unable to install Java or upgrade the installed version. + +To generate code with this image, you'll need to mount a local location as a volume. + +Example: + +```sh +docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ + -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ + -g go \ + -o /local/out/go +``` + +The generated code will be located under `./out/go` in the current directory. + +#### OpenAPI Generator Online Docker Image + +The openapi-generator-online image can act as a self-hosted web application and API for generating code. This container can be incorporated into a CI pipeline, and requires at least two HTTP requests and some docker orchestration to access generated code. + +Example usage: + +```sh +# Start container at port 8888 and save the container id +> CID=$(docker run -d -p 8888:8080 openapitools/openapi-generator-online) + +# allow for startup +> sleep 10 + +# Get the IP of the running container (optional) +GEN_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $CID) + +# Execute an HTTP request to generate a Ruby client +> curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' \ +-d '{"openAPIUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml"}' \ +'http://localhost:8888/api/gen/clients/ruby' + +{"code":"c2d483.3.4672-40e9-91df-b9ffd18d22b8","link":"http://localhost:8888/api/gen/download/c2d483.3.4672-40e9-91df-b9ffd18d22b8"} + +# Download the generated zip file +> wget http://localhost:8888/api/gen/download/c2d483.3.4672-40e9-91df-b9ffd18d22b8 + +# Unzip the file +> unzip c2d483.3.4672-40e9-91df-b9ffd18d22b8 + +# Shutdown the openapi generator image +> docker stop $CID && docker rm $CID +``` + +#### Development in docker + +You can use `run-in-docker.sh` to do all development. This script maps your local repository to `/gen` +in the docker container. It also maps `~/.m2/repository` to the appropriate container location. + +To execute `mvn package`: + +```sh +git clone https://github.com/openapitools/openapi-generator +cd openapi-generator +./run-in-docker.sh mvn package +``` + +Build artifacts are now accessible in your working directory. + +Once built, `run-in-docker.sh` will act as an executable for openapi-generator-cli. To generate code, you'll need to output to a directory under `/gen` (e.g. `/gen/out`). For example: + +```sh +./run-in-docker.sh help # Executes 'help' command for openapi-generator-cli +./run-in-docker.sh list # Executes 'list' command for openapi-generator-cli +./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ + -g go -o /gen/out/go-petstore -p packageName=petstore # generates go client, outputs locally to ./out/go-petstore +``` + +##### Troubleshooting + +If an error like this occurs, just execute the **./mvnw clean install -U** command: + +> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project openapi-generator: A type incompatibility occurred while executing org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test: java.lang.ExceptionInInitializerError cannot be cast to java.io.IOException + +```sh +./run-in-docker.sh ./mvnw clean install -U +``` + +> Failed to execute goal org.fortasoft:gradle-maven-plugin:1.0.8:invoke (default) on project openapi-generator-gradle-plugin-mvn-wrapper: org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.7-bin.zip' + +Right now: no solution for this one :| + +#### Run Docker in Vagrant +Prerequisite: install [Vagrant](https://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads). + ```sh +git clone https://github.com/openapitools/openapi-generator.git +cd openapi-generator +vagrant up +vagrant ssh +cd /vagrant +./run-in-docker.sh ./mvnw package +``` + +### [1.7 - NPM](#table-of-contents) + +There is also an [NPM package wrapper](https://www.npmjs.com/package/@openapitools/openapi-generator-cli) available for different platforms (e.g. Linux, Mac, Windows). (JVM is still required) +Please see the [project's README](https://github.com/openapitools/openapi-generator-cli) there for more information. + +Install it globally to get the CLI available on the command line: + +```sh +npm install @openapitools/openapi-generator-cli -g +openapi-generator-cli version +``` + + +To use a specific version of "openapi-generator-cli" + +```sh +openapi-generator-cli version-manager set 7.0.1 +``` + +Or install it as dev-dependency: + +```sh +npm install @openapitools/openapi-generator-cli -D +``` + +## [2 - Getting Started](#table-of-contents) + +To generate a PHP client for [petstore.yaml](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml), please run the following +```sh +git clone https://github.com/openapitools/openapi-generator +cd openapi-generator +./mvnw clean package +java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \ + -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ + -g php \ + -o /var/tmp/php_api_client +``` +(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`) + + +You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.1/openapi-generator-cli-7.0.1.jar) + + +To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate` + +To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar config-help -g php` + +## [3 - Usage](#table-of-contents) + +### To generate a sample client library +You can build a client against the [Petstore API](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml) as follows: + +```sh +./bin/generate-samples.sh ./bin/configs/java-okhttp-gson.yaml +``` + +(On Windows, please install [GIT Bash for Windows](https://gitforwindows.org/) to run the command above) + +This script uses the default library, which is `okhttp-gson`. It will run the generator with this command: + +```sh +java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \ + -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ + -g java \ + -t modules/openapi-generator/src/main/resources/Java \ + --additional-properties artifactId=petstore-okhttp-gson,hideGenerationTimestamp=true \ + -o samples/client/petstore/java/okhttp-gson +``` + +with a number of options. [The java options are documented here.](docs/generators/java.md) + +You can also get the options with the `help generate` command (below only shows partial results): + +``` +NAME + openapi-generator-cli generate - Generate code with the specified + generator. + +SYNOPSIS + openapi-generator-cli generate + [(-a | --auth )] + [--api-name-suffix ] [--api-package ] + [--artifact-id ] [--artifact-version ] + [(-c | --config )] [--dry-run] + [(-e | --engine )] + [--enable-post-process-file] + [(-g | --generator-name )] + [--generate-alias-as-model] [--git-host ] + [--git-repo-id ] [--git-user-id ] + [--global-property ...] [--group-id ] + [--http-user-agent ] + [(-i | --input-spec )] + [--ignore-file-override ] + [--import-mappings ...] + [--instantiation-types ...] + [--invoker-package ] + [--language-specific-primitives ...] + [--legacy-discriminator-behavior] [--library ] + [--log-to-stderr] [--minimal-update] + [--model-name-prefix ] + [--model-name-suffix ] + [--model-package ] + [(-o | --output )] [(-p | --additional-properties )...] + [--package-name ] [--release-note ] + [--remove-operation-id-prefix] + [--reserved-words-mappings ...] + [(-s | --skip-overwrite)] [--server-variables ...] + [--skip-validate-spec] [--strict-spec ] + [(-t