Compare commits

..

18 Commits

Author SHA1 Message Date
William Cheng
be28e0c829 sleep 2025-01-21 17:32:01 +08:00
William Cheng
286ea0c593 debug 2025-01-21 17:28:24 +08:00
William Cheng
a1d733694e host table 2025-01-21 17:23:40 +08:00
William Cheng
ce81a8dd3a update 2025-01-21 17:21:17 +08:00
William Cheng
3bdf3a5756 trigger workflow 2025-01-21 17:00:28 +08:00
William Cheng
531f39f2b5 add workflow to test ruby petstore clients 2025-01-21 16:58:36 +08:00
David Riddervold Marconis
c75fbb312e [csharp][java] Fix enum discriminator default value (#19614)
* Fix enum discriminator default value

* Remove system out call

* Add case when discriminator type is ref

* Use correct schema

* Handle different use cases of mappings

* Add missing enum type Lizzy

* Make it more robust

* Add missing test for Sedan

* Refactor some code to make it cleaner

* Initialize discriminator enum field

* Don't override existing default value

* Fix issue with finding discriminators

* Move setIsEnum back to its original location

* Be smarter about figuring out the model name

* Fix final warnings

* Add javadocs to introduced methods
2025-01-21 16:09:17 +08:00
William Cheng
1fa07bf46c Prepare 7.12.0 (#20512)
* Revert "v7.11.0 release (#20508)"

This reverts commit a7240eeefe.

* prepare 7.12.0 snapshot version

* update samples

* update readme
2025-01-21 00:10:09 +08:00
William Cheng
a7240eeefe v7.11.0 release (#20508) 2025-01-20 21:35:30 +08:00
Iurii Ignatko
fa3e38a4b7 [JAVA] Address [rawtypes] and [this-escape] warnings in generated API clients (#20466)
* Address [rawtypes] and [this-escape] warnings in generated API clients

* Commit updated sample files
2025-01-18 15:00:16 +08:00
William Cheng
98ccf95e43 [ASPNETCORE] Add support for central package version management (#20401)
* Added useCentralPackageVersionManagement option for aspnetcore

* Removed debug code from template

* Added option to opt out of centralized version management

* Added sample for centralized version management

* Removed changes for .net9

* Updated template file for model project

* Code formatting

* Corrected sample config for aspnetcore

* Regenerated Samples

* update samples, docs

* Fixed models project mustache file

* Regenerated samples and docs

* Regenerated smaples and doc

* Changed options to enum WIP

* fix option

* [ASPNETCORE] Add support for central package version management #20192 (#20403)

* Fixed default value for usePackageVersions

* Regenerated docs

* update workflow

* add props file

---------

Co-authored-by: Urganot <ballingsimon@googlemail.com>
2025-01-18 14:52:41 +08:00
William Cheng
9e66c4f516 Add more net9 samples (#20491)
* add restsharp net9 samples

* add httpclient net9 samples

* add unity net9 samples

* update workflow

* comment out unity test
2025-01-17 14:14:11 +08:00
William Cheng
ce56a83ae4 Update openapi spec 3.1 support message (#20492)
* update spec 3.1 support message

* update faq
2025-01-17 13:15:35 +08:00
William Cheng
4c73faf737 [go-server] Add tests for primitive types in request/response (#20474)
* add test for primitive request/response

* add new files
2025-01-15 16:56:16 +08:00
Dragos Vingarzan
dcf472a034 ISSUE: #17373 [BUG] [Go-server] invalid composite literal type string (#20467)
* modules/openapi-generator/src/main/resources/go-server: alternative initialization of variable, to avoid extra checks and custom code

* propagated changes to samples
2025-01-15 16:36:33 +08:00
William Cheng
5785743695 Update bug_report.md with up-to-date URL for online validator (#20470) 2025-01-15 01:31:03 +08:00
William Cheng
760d5e8168 [normalizer] Better handling of schema with just description (any type) (#20461)
* better handling of schema with just description

* update
2025-01-14 22:04:23 +08:00
Juuso Alasuutari
4259e92776 [C][Client] Make custom CMAKE_C_FLAGS work (#20432)
* [C][Client] Generate CMakeLists.txt for all C sample clients

The sample client defined in bin/configs/c.yaml has CMakeLists.txt in
its .openapi-generator-ignore. It's is the only C client that doesn't
(re-)generate CMakeLists.txt, the remaining two seem fine regardless.

* [C][Client] Allow user-defined CMAKE_C_FLAGS

* [C][Client] Remove useless message() calls from CMakeLists.txt

find_package() prints success/failure messages, no need to do it twice.
2025-01-14 15:01:36 +08:00
8203 changed files with 167963 additions and 7841 deletions

View File

@@ -10,7 +10,7 @@ assignees: ''
#### Bug Report Checklist
- [ ] Have you provided a full/minimal spec to reproduce the issue?
- [ ] Have you validated the input using an OpenAPI validator ([example](https://apidevtools.org/swagger-parser/online/))?
- [ ] Have you validated the input using an OpenAPI validator ([example](https://apitools.dev/swagger-parser/online/))?
- [ ] Have you [tested with the latest master](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) to confirm the issue still exists?
- [ ] Have you searched for related issues/PRs?
- [ ] What's the actual output vs expected output?

View File

@@ -23,6 +23,7 @@ jobs:
- samples/server/petstore/aspnetcore-8.0-pocoModels
- samples/server/petstore/aspnetcore-8.0-project4Models
- samples/server/petstore/aspnetcore-8.0-useSwashBuckle
- samples/server/petstore/aspnetcore-8.0-use-centralized-package-version-management
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.2.0

View File

@@ -35,6 +35,12 @@ jobs:
- samples/client/petstore/csharp/generichost/net9/Petstore
- samples/client/petstore/csharp/generichost/net9/SourceGeneration
- samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate
# restsharp
- samples/client/petstore/csharp/restsharp/net9/EnumMappings
# httpclient
- samples/client/petstore/csharp/httpclient/net9/Petstore
# unity
#- samples/client/petstore/csharp/unityWebRequest/net9/Petstore
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.2.0

View File

@@ -0,0 +1,54 @@
name: Samples Ruby Petstore
on:
push:
paths:
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
pull_request:
paths:
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
jobs:
build:
name: Build Ruby
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/ruby/
- samples/client/petstore/ruby-faraday/
- samples/client/petstore/ruby-httpx/
- samples/client/petstore/ruby-autoload/
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v4
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
cat /etc/hosts
sleep 30
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install
- name: Run rspec
working-directory: ${{ matrix.sample }}
run: rspec

View File

@@ -15,7 +15,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.11.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.12.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)
@@ -130,8 +130,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 7.11.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.11.0-SNAPSHOT/) | 20.12.2024 | Minor release with breaking changes (with fallback) |
| [7.10.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.10.0) (latest stable release) | 18.11.2024 | Minor release with breaking changes (with fallback) |
| 7.12.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.12.0-SNAPSHOT/) | 17.02.2024 | Minor release with breaking changes (with fallback) |
| [7.11.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.11.0) (latest stable release) | 20.01.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) |
@@ -194,16 +194,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o
<!-- RELEASE_VERSION -->
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.10.0/openapi-generator-cli-7.10.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.11.0/openapi-generator-cli-7.11.0.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.10.0/openapi-generator-cli-7.10.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.11.0/openapi-generator-cli-7.11.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.10.0/openapi-generator-cli-7.10.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.11.0/openapi-generator-cli-7.11.0.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -438,7 +438,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 7.10.0
openapi-generator-cli version-manager set 7.11.0
```
Or install it as dev-dependency:
@@ -462,7 +462,7 @@ pip install openapi-generator-cli
To install a specific version
```
pip install openapi-generator-cli==7.10.0
pip install openapi-generator-cli==7.11.0
```
You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required)
@@ -488,7 +488,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
<!-- RELEASE_VERSION -->
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.10.0/openapi-generator-cli-7.10.0.jar)
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.11.0/openapi-generator-cli-7.11.0.jar)
<!-- /RELEASE_VERSION -->
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`

View File

@@ -0,0 +1,9 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-use-centralized-package-version-management
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
centralizedPackageVersionManagement: "enable"

View File

@@ -0,0 +1,13 @@
# for .net standard httpclient
generatorName: csharp
outputDir: samples/client/petstore/csharp/httpclient/net9/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
library: httpclient
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: net9.0
equatable: true

View File

@@ -0,0 +1,14 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net9/EnumMappings
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: net9.0
equatable: true
enumNameMappings:
delivered: Shipped

View File

@@ -0,0 +1,9 @@
# for .net Unity
generatorName: csharp
outputDir: samples/client/petstore/csharp/unityWebRequest/net9/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
library: unityWebRequest
additionalProperties:
targetFramework: net9.0
equatable: true

View File

@@ -5,6 +5,8 @@ title: "FAQ: General"
## Do you have a chat room?
Yes, we use Slack.
[![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-2wmkn4s8g-n19PJ99Y6Vei74WMUIehQA)
## What is the governance structure of the OpenAPI Generator project?

View File

@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|aspnetCoreVersion|ASP.NET Core version: 6.0, 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd><dt>**6.0**</dt><dd>ASP.NET Core 6.0</dd><dt>**7.0**</dt><dd>ASP.NET Core 7.0</dd><dt>**8.0**</dt><dd>ASP.NET Core 8.0</dd></dl>|8.0|
|buildTarget|Target to build an application or library|<dl><dt>**program**</dt><dd>Generate code for a standalone server</dd><dt>**library**</dt><dd>Generate code for a server abstract class library</dd></dl>|program|
|centralizedPackageVersionManagement|Option to control the usage of centralized package version management. https://devblogs.microsoft.com/nuget/introducing-central-package-management/#disabling-central-package-management|<dl><dt>**optout**</dt><dd>Opt out of centralized package version management. Set this if you have a Directory.Packages.pros file but want this project to ignore it.</dd><dt>**default**</dt><dd>Property in project won't be used</dd><dt>**enable**</dt><dd>Centralized package version management will be used</dd></dl>|null|
|classModifier|Class Modifier for controller classes: Empty string or abstract.| ||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.11.0-SNAPSHOT
openApiGeneratorVersion=7.12.0-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.11.0-SNAPSHOT
openApiGeneratorVersion=7.12.0-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -409,9 +409,7 @@ public class CodegenConstants {
"If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.";
public static final String UNSUPPORTED_V310_SPEC_MSG =
"Generation using 3.1.0 specs is in development and is not officially supported yet. " +
"If you would like to expedite development, please consider working on the open issues in the 3.1.0 project: https://github.com/orgs/OpenAPITools/projects/4/views/1 " +
"and reach out to our team on Slack at https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g";
"OpenAPI 3.1 support is still in beta. To report an issue related to 3.1 spec, please kindly open an issue in the Github repo: https://github.com/openAPITools/openapi-generator.";
public static final String ENUM_UNKNOWN_DEFAULT_CASE = "enumUnknownDefaultCase";
public static final String ENUM_UNKNOWN_DEFAULT_CASE_DESC =

View File

@@ -3098,6 +3098,7 @@ public class DefaultCodegen implements CodegenConfig {
listOLists.add(m.requiredVars);
listOLists.add(m.vars);
listOLists.add(m.allVars);
listOLists.add(m.readWriteVars);
for (List<CodegenProperty> theseVars : listOLists) {
for (CodegenProperty requiredVar : theseVars) {
if (discPropName.equals(requiredVar.baseName)) {
@@ -3131,6 +3132,63 @@ public class DefaultCodegen implements CodegenConfig {
return m;
}
/**
* Sets the default value for an enum discriminator property in the provided {@link CodegenModel}.
* <p>
* If the model's discriminator is defined, this method identifies the discriminator properties among the model's
* variables and assigns the default value to reflect the corresponding enum value for the model type.
* </p>
* <p>
* Example: If the discriminator is for type `Animal`, and the model is `Cat`, the default value
* will be set to `Animal.Cat` for the properties that have the same name as the discriminator.
* </p>
*
* @param model the {@link CodegenModel} whose discriminator property default value is to be set
*/
protected static void setEnumDiscriminatorDefaultValue(CodegenModel model) {
if (model.discriminator == null) {
return;
}
String discPropName = model.discriminator.getPropertyBaseName();
Stream.of(model.requiredVars, model.vars, model.allVars, model.readWriteVars)
.flatMap(List::stream)
.filter(v -> discPropName.equals(v.baseName))
.forEach(v -> v.defaultValue = getEnumValueForProperty(model.schemaName, model.discriminator, v));
}
/**
* Retrieves the appropriate default value for an enum discriminator property based on the model name.
* <p>
* If the discriminator has a mapping defined, it attempts to find a mapping for the model name.
* Otherwise, it defaults to one of the allowable enum value associated with the property.
* If no suitable value is found, the original default value of the property is returned.
* </p>
*
* @param modelName the name of the model to determine the default value for
* @param discriminator the {@link CodegenDiscriminator} containing the mapping and enum details
* @param var the {@link CodegenProperty} representing the discriminator property
* @return the default value for the enum discriminator property, or its original default value if none is found
*/
protected static String getEnumValueForProperty(
String modelName, CodegenDiscriminator discriminator, CodegenProperty var) {
if (!discriminator.getIsEnum() && !var.isEnum) {
return var.defaultValue;
}
Map<String, String> mapping = Optional.ofNullable(discriminator.getMapping()).orElseGet(Collections::emptyMap);
for (Map.Entry<String, String> e : mapping.entrySet()) {
String schemaName = e.getValue().indexOf('/') < 0 ? e.getValue() : ModelUtils.getSimpleRef(e.getValue());
if (modelName.equals(schemaName)) {
return e.getKey();
}
}
Object values = var.allowableValues.get("values");
if (!(values instanceof List<?>)) {
return var.defaultValue;
}
List<?> valueList = (List<?>) values;
return valueList.stream().filter(o -> o.equals(modelName)).map(o -> (String) o).findAny().orElse(var.defaultValue);
}
protected void SortModelPropertiesByRequiredFlag(CodegenModel model) {
Comparator<CodegenProperty> comparator = new Comparator<CodegenProperty>() {
@Override
@@ -3201,15 +3259,19 @@ public class DefaultCodegen implements CodegenConfig {
* @param visitedSchemas A set of visited schema names
*/
private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, String discPropName, Set<String> visitedSchemas) {
if (visitedSchemas.contains(composedSchemaName)) { // recursive schema definition found
Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc);
String schemaName = Optional.ofNullable(composedSchemaName)
.or(() -> Optional.ofNullable(refSchema.getName()))
.or(() -> Optional.ofNullable(sc.get$ref()).map(ModelUtils::getSimpleRef))
.orElseGet(sc::toString);
if (visitedSchemas.contains(schemaName)) { // recursive schema definition found
return null;
} else {
visitedSchemas.add(composedSchemaName);
visitedSchemas.add(schemaName);
}
Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc);
if (refSchema.getProperties() != null && refSchema.getProperties().get(discPropName) != null) {
Schema discSchema = (Schema) refSchema.getProperties().get(discPropName);
Schema discSchema = ModelUtils.getReferencedSchema(openAPI, (Schema)refSchema.getProperties().get(discPropName));
CodegenProperty cp = new CodegenProperty();
if (ModelUtils.isStringSchema(discSchema)) {
cp.isString = true;
@@ -3218,6 +3280,7 @@ public class DefaultCodegen implements CodegenConfig {
if (refSchema.getRequired() != null && refSchema.getRequired().contains(discPropName)) {
cp.setRequired(true);
}
cp.setIsEnum(discSchema.getEnum() != null && !discSchema.getEnum().isEmpty());
return cp;
}
if (ModelUtils.isComposedSchema(refSchema)) {
@@ -3225,7 +3288,8 @@ public class DefaultCodegen implements CodegenConfig {
if (composedSchema.getAllOf() != null) {
// If our discriminator is in one of the allOf schemas break when we find it
for (Object allOf : composedSchema.getAllOf()) {
CodegenProperty cp = discriminatorFound(composedSchemaName, (Schema) allOf, discPropName, visitedSchemas);
Schema allOfSchema = (Schema) allOf;
CodegenProperty cp = discriminatorFound(allOfSchema.getName(), allOfSchema, discPropName, visitedSchemas);
if (cp != null) {
return cp;
}
@@ -3235,8 +3299,11 @@ public class DefaultCodegen implements CodegenConfig {
// All oneOf definitions must contain the discriminator
CodegenProperty cp = new CodegenProperty();
for (Object oneOf : composedSchema.getOneOf()) {
String modelName = ModelUtils.getSimpleRef(((Schema) oneOf).get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) oneOf, discPropName, visitedSchemas);
Schema oneOfSchema = (Schema) oneOf;
String modelName = ModelUtils.getSimpleRef((oneOfSchema).get$ref());
// Must use a copied set as the oneOf schemas can point to the same discriminator.
Set<String> visitedSchemasCopy = new TreeSet<>(visitedSchemas);
CodegenProperty thisCp = discriminatorFound(oneOfSchema.getName(), oneOfSchema, discPropName, visitedSchemasCopy);
if (thisCp == null) {
once(LOGGER).warn(
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
@@ -3258,8 +3325,11 @@ public class DefaultCodegen implements CodegenConfig {
// All anyOf definitions must contain the discriminator because a min of one must be selected
CodegenProperty cp = new CodegenProperty();
for (Object anyOf : composedSchema.getAnyOf()) {
String modelName = ModelUtils.getSimpleRef(((Schema) anyOf).get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) anyOf, discPropName, visitedSchemas);
Schema anyOfSchema = (Schema) anyOf;
String modelName = ModelUtils.getSimpleRef(anyOfSchema.get$ref());
// Must use a copied set as the anyOf schemas can point to the same discriminator.
Set<String> visitedSchemasCopy = new TreeSet<>(visitedSchemas);
CodegenProperty thisCp = discriminatorFound(anyOfSchema.getName(), anyOfSchema, discPropName, visitedSchemasCopy);
if (thisCp == null) {
once(LOGGER).warn(
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
@@ -3542,13 +3612,11 @@ public class DefaultCodegen implements CodegenConfig {
discriminator.setPropertyType(propertyType);
// check to see if the discriminator property is an enum string
if (schema.getProperties() != null &&
schema.getProperties().get(discriminatorPropertyName) instanceof StringSchema) {
StringSchema s = (StringSchema) schema.getProperties().get(discriminatorPropertyName);
if (s.getEnum() != null && !s.getEnum().isEmpty()) { // it's an enum string
discriminator.setIsEnum(true);
}
}
boolean isEnum = Optional
.ofNullable(discriminatorFound(schemaName, schema, discriminatorPropertyName, new TreeSet<>()))
.map(CodegenProperty::getIsEnum)
.orElse(false);
discriminator.setIsEnum(isEnum);
discriminator.setMapping(sourceDiscriminator.getMapping());
List<MappedModel> uniqueDescendants = new ArrayList<>();

View File

@@ -1713,6 +1713,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
// additional import for different cases
addAdditionalImports(codegenModel, codegenModel.getComposedSchemas());
setEnumDiscriminatorDefaultValue(codegenModel);
return codegenModel;
}

View File

@@ -21,6 +21,7 @@ import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import lombok.Getter;
import lombok.Setter;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
@@ -64,8 +65,14 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
public static final String USE_NEWTONSOFT = "useNewtonsoft";
public static final String USE_DEFAULT_ROUTING = "useDefaultRouting";
public static final String NEWTONSOFT_VERSION = "newtonsoftVersion";
public static final String CENTRALIZED_PACKAGE_VERSION_MANAGEMENT = "centralizedPackageVersionManagement";
public static final String USE_PACKAGE_VERSIONS = "usePackageVersions";
public static final String DEFAULT = "default";
public static final String ENABLE = "enable";
public static final String OPTOUT = "optout";
@Setter private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
@Setter
private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
private String userSecretsGuid = randomUUID().toString();
protected final Logger LOGGER = LoggerFactory.getLogger(AspNetServerCodegen.class);
@@ -91,6 +98,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
private boolean useNewtonsoft = true;
private boolean useDefaultRouting = true;
private String newtonsoftVersion = "3.0.0";
private CliOption centralizedPackageVersionManagement = new CliOption(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT, "Option to control the usage of centralized package version management. https://devblogs.microsoft.com/nuget/introducing-central-package-management/#disabling-central-package-management");
public AspNetServerCodegen() {
super();
@@ -249,6 +257,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
"Uses the Newtonsoft JSON library.",
useNewtonsoft);
addOption(NEWTONSOFT_VERSION,
"Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+",
newtonsoftVersion);
@@ -301,13 +310,24 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
modelClassModifier.setDefault("partial");
modelClassModifier.setOptValue(modelClassModifier.getDefault());
addOption(modelClassModifier.getOpt(), modelClassModifier.getDescription(), modelClassModifier.getOptValue());
addCentralizedPackageManagementOption();
}
private void addCentralizedPackageManagementOption(){
Map<String, String> centralizedPackageVersionManagementOptions = new HashMap<>();
centralizedPackageVersionManagementOptions.put(DEFAULT, "Property in project won't be used");
centralizedPackageVersionManagementOptions.put(ENABLE, "Centralized package version management will be used");
centralizedPackageVersionManagementOptions.put(OPTOUT, "Opt out of centralized package version management. Set this if you have a Directory.Packages.pros file but want this project to ignore it.");
centralizedPackageVersionManagement.setEnum(centralizedPackageVersionManagementOptions);
cliOptions.add(centralizedPackageVersionManagement);
}
@Deprecated
@Override
protected Set<String> getNullableTypes() {
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double",
"DateTime", "DateOnly", "DateTimeOffset", "Guid"));
"DateTime", "DateOnly", "DateTimeOffset", "Guid"));
}
@Override
@@ -463,6 +483,30 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("Formatters" + File.separator + "InputFormatterStream.mustache", packageFolder + File.separator + "Formatters", "InputFormatterStream.cs"));
this.setTypeMapping();
setCentralizedPackageManagementOption();
}
private void setCentralizedPackageManagementOption() {
additionalProperties.put(USE_PACKAGE_VERSIONS, true);
if (additionalProperties.containsKey(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT)) {
switch ((String) additionalProperties.get(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT)) {
case DEFAULT:
additionalProperties.remove(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT);
break;
case ENABLE:
additionalProperties.replace(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT, "true");
additionalProperties.put(USE_PACKAGE_VERSIONS, false);
break;
case OPTOUT:
additionalProperties.replace(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT, "false");
break;
default:
throw new RuntimeException("Invalid value `" + additionalProperties.get(CENTRALIZED_PACKAGE_VERSION_MANAGEMENT) + "` for the option `centralizedPackageVersionManagement`. Please refer to the documentation for more information.");
}
}
}
@Override
@@ -808,10 +852,10 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
}
private void setAdditionalPropertyForFramework() {
String targetFramework = ((String)additionalProperties.get(TARGET_FRAMEWORK));
String targetFramework = ((String) additionalProperties.get(TARGET_FRAMEWORK));
if (targetFramework.startsWith("net6.0") ||
targetFramework.startsWith("net7.0") ||
targetFramework.startsWith("net8.0")) {
targetFramework.startsWith("net7.0") ||
targetFramework.startsWith("net8.0")) {
additionalProperties.put(NET_60_OR_LATER, true);
}
}

View File

@@ -432,6 +432,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
public CodegenModel fromModel(String name, Schema model) {
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
CodegenModel codegenModel = super.fromModel(name, model);
setEnumDiscriminatorDefaultValue(codegenModel);
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null) {
final Schema<?> parentModel = allDefinitions.get(toModelName(codegenModel.parent));
if (parentModel != null) {

View File

@@ -430,14 +430,14 @@ public class ModelUtils {
* <p>
* For example, an OpenAPI schema is considered an ObjectSchema in the following scenarios:
* <p>
* <p>
* type: object
* additionalProperties: false
* properties:
* name:
* type: string
* address:
* type: string
*
* type: object
* additionalProperties: false
* properties:
* name:
* type: string
* address:
* type: string
*
* @param schema the OAS schema
* @return true if the specified schema is an Object schema.
@@ -527,28 +527,28 @@ public class ModelUtils {
* A MapSchema differs from an ObjectSchema in the following way:
* - An ObjectSchema is not extensible, i.e. it has a fixed number of properties.
* - A MapSchema is an object that can be extended with an arbitrary set of properties.
* The payload may include dynamic properties.
* The payload may include dynamic properties.
* <p>
* Note that isMapSchema returns true for a composed schema (allOf, anyOf, oneOf) that also defines
* additionalproperties.
* <p>
* For example, an OpenAPI schema is considered a MapSchema in the following scenarios:
* <p>
* <p>
* type: object
* additionalProperties: true
* <p>
* type: object
* additionalProperties:
*
* type: object
* additionalProperties: true
*
* type: object
* additionalProperties:
* type: object
* properties:
* code:
* type: integer
* <p>
* allOf:
* - $ref: '#/components/schemas/Class1'
* - $ref: '#/components/schemas/Class2'
* additionalProperties: true
*
* allOf:
* - $ref: '#/components/schemas/Class1'
* - $ref: '#/components/schemas/Class2'
* additionalProperties: true
*
* @param schema the OAS schema
* @return true if the specified schema is a Map schema.
@@ -857,7 +857,7 @@ public class ModelUtils {
* The value can be any type except the 'null' value.
*
* @param schema potentially containing a '$ref'
* @param openAPI document containing the Schema.
* @param openAPI document containing the Schema.
* @return true if it's a free-form object
*/
public static boolean isFreeFormObject(Schema schema, OpenAPI openAPI) {
@@ -999,8 +999,8 @@ public class ModelUtils {
/**
* Get the schema referenced by $ref to schema's properties, e.g. #/components/schemas/Pet/properties/category.
*
* @param openAPI specification being checked
* @param refString schema reference
* @param openAPI specification being checked
* @param refString schema reference
* @return schema
*/
public static Schema getSchemaFromRefToSchemaWithProperties(OpenAPI openAPI, String refString) {
@@ -1021,7 +1021,7 @@ public class ModelUtils {
/**
* Returns true if $ref to a reference to schema's properties, e.g. #/components/schemas/Pet/properties/category.
*
* @param refString schema reference
* @param refString schema reference
* @return true if $ref to a reference to schema's properties
*/
public static boolean isRefToSchemaWithProperties(String refString) {
@@ -1198,7 +1198,7 @@ public class ModelUtils {
/**
* Return the first defined Schema for a ApiResponse
*
* @param openAPI OpenAPI spec.
* @param openAPI OpenAPI spec.
* @param response API response of the operation
* @return firstSchema
*/
@@ -1218,13 +1218,13 @@ public class ModelUtils {
* for the 'application/json' content type because it is listed first in the OAS.
* <p>
* responses:
* '200':
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/XYZ'
* application/xml:
* ...
* '200':
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/XYZ'
* application/xml:
* ...
*
* @param content a 'content' section in the OAS specification.
* @return the Schema.
@@ -1427,7 +1427,7 @@ public class ModelUtils {
* any additional properties are allowed. This is equivalent to setting additionalProperties
* to the boolean value True or setting additionalProperties: {}
*
* @param schema the input schema that may or may not have the additionalProperties keyword.
* @param schema the input schema that may or may not have the additionalProperties keyword.
* @return the Schema of the additionalProperties. The null value is returned if no additional
* properties are allowed.
*/
@@ -1540,19 +1540,19 @@ public class ModelUtils {
* because 'Animal' specifies a discriminator.
* <p>
* animal:
* type: object
* discriminator:
* propertyName: type
* properties:
* type: string
* type: object
* discriminator:
* propertyName: type
* properties:
* type: string
*
* <p>
* dog:
* allOf:
* - $ref: '#/components/schemas/animal'
* - type: object
* properties:
* breed: string
* allOf:
* - $ref: '#/components/schemas/animal'
* - type: object
* properties:
* breed: string
*
* @param composedSchema schema (alias or direct reference)
* @param allSchemas all schemas
@@ -1611,6 +1611,12 @@ public class ModelUtils {
* @return the name of the parent model
*/
public static List<String> getAllParentsName(Schema composedSchema, Map<String, Schema> allSchemas, boolean includeAncestors) {
return getAllParentsName(composedSchema, allSchemas, includeAncestors, new HashSet<>());
}
// Use a set of seen names to avoid infinite recursion
private static List<String> getAllParentsName(
Schema composedSchema, Map<String, Schema> allSchemas, boolean includeAncestors, Set<String> seenNames) {
List<Schema> interfaces = getInterfaces(composedSchema);
List<String> names = new ArrayList<String>();
@@ -1619,6 +1625,10 @@ public class ModelUtils {
// get the actual schema
if (StringUtils.isNotEmpty(schema.get$ref())) {
String parentName = getSimpleRef(schema.get$ref());
if (seenNames.contains(parentName)) {
continue;
}
seenNames.add(parentName);
Schema s = allSchemas.get(parentName);
if (s == null) {
LOGGER.error("Failed to obtain schema from {}", parentName);
@@ -1627,7 +1637,7 @@ public class ModelUtils {
// discriminator.propertyName is used or x-parent is used
names.add(parentName);
if (includeAncestors && isComposedSchema(s)) {
names.addAll(getAllParentsName(s, allSchemas, true));
names.addAll(getAllParentsName(s, allSchemas, true, seenNames));
}
} else {
// not a parent since discriminator.propertyName is not set
@@ -1683,7 +1693,7 @@ public class ModelUtils {
* If it's string, return true if it's non-empty.
* If the return value is `true`, the schema is a parent.
*
* @param schema Schema
* @param schema Schema
* @return boolean
*/
public static boolean isExtensionParent(Schema schema) {
@@ -1750,9 +1760,9 @@ public class ModelUtils {
* type is one of the elements under 'oneOf'.
* <p>
* OptionalOrder:
* oneOf:
* - type: 'null'
* - $ref: '#/components/schemas/Order'
* oneOf:
* - type: 'null'
* - $ref: '#/components/schemas/Order'
*
* @param schema the OAS composed schema.
* @return true if the composed schema is nullable.
@@ -2214,8 +2224,9 @@ public class ModelUtils {
* <p>
* Return true if the schema's type is 'null' or not specified
*
* @param schema Schema
* @param schema Schema
* @param openAPI OpenAPI
*
* @return true if schema is null type
*/
public static boolean isNullTypeSchema(OpenAPI openAPI, Schema schema) {
@@ -2260,13 +2271,13 @@ public class ModelUtils {
// for `type: null`
if (schema.getTypes() == null && schema.get$ref() == null
&& schema.getDescription() == null) { // ensure it's not schema with just a description
&& schema.getDescription() == null) { // ensure it's not schema with just a description)
return true;
}
} else { // 3.0.x or 2.x spec
if ((schema.getType() == null || schema.getType().equals("null"))
&& schema.get$ref() == null
&& schema.getDescription() == null) { // ensure it's not schema with just a description
&& schema.getDescription() == null) { // ensure it's not schema with just a description)
return true;
}
}
@@ -2279,8 +2290,9 @@ public class ModelUtils {
* <p>
* Return true if the schema can be handled by OpenAPI Generator
*
* @param schema Schema
* @param schema Schema
* @param openAPI OpenAPIs
*
* @return true if schema is null type
*/
public static boolean isUnsupportedSchema(OpenAPI openAPI, Schema schema) {

View File

@@ -6,25 +6,21 @@ cmake_policy(SET CMP0063 NEW)
set(CMAKE_C_VISIBILITY_PRESET default)
set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations -Werror=int-conversion")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=missing-declarations")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion")
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
find_package(OpenSSL)
if (OPENSSL_FOUND)
message (STATUS "OPENSSL found")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL")
if(CMAKE_VERSION VERSION_LESS 3.4)
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${OPENSSL_INCLUDE_DIRS})
link_directories(${OPENSSL_LIBRARIES})
endif()
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
else()
message (STATUS "OpenSSL Not found.")
endif()
set(pkgName "{{projectName}}")
@@ -42,8 +38,6 @@ else()
if(CURL_FOUND)
include_directories(${CURL_INCLUDE_DIR})
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${CURL_LIBRARIES} )
else(CURL_FOUND)
message(FATAL_ERROR "Could not find the CURL library and development files.")
endif()
endif()

View File

@@ -622,7 +622,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param value The value of the parameter.
* @return A list of {@code Pair} objects.
*/
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
List<Pair> params = new ArrayList<Pair>();
// preconditions

View File

@@ -183,7 +183,7 @@ public class ApiClient {
asyncResponseInterceptor = null;
}
protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -199,11 +199,11 @@ public class ApiClient {
return mapper;
}
protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
return "{{{basePath}}}";
}
protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

View File

@@ -81,6 +81,11 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/parcelableModel}}
{{/parent}}
{{#discriminator}}
{{#discriminator.isEnum}}
{{#readWriteVars}}{{#isDiscriminator}}{{#defaultValue}}
this.{{name}} = {{defaultValue}};
{{/defaultValue}}{{/isDiscriminator}}{{/readWriteVars}}
{{/discriminator.isEnum}}
{{^discriminator.isEnum}}
this.{{{discriminatorName}}} = this.getClass().getSimpleName();
{{/discriminator.isEnum}}

View File

@@ -13,25 +13,32 @@
<OutputType>Library</OutputType>
<AssemblyName>{{modelPackage}}</AssemblyName>
<PackageId>{{modelPackage}}</PackageId>
{{#useCentralizedPackageVersionManagement}}
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
{{/useCentralizedPackageVersionManagement}}
{{#centralizedPackageVersionManagementOptOut}}
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
{{/centralizedPackageVersionManagementOptOut}}
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="{{aspnetCoreVersion}}.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" {{^useCentralizedPackageVersionManagement}}Version="{{aspnetCoreVersion}}.0" {{/useCentralizedPackageVersionManagement}}/>
{{#useSwashbuckle}}
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" {{^useCentralizedPackageVersionManagement}}Version="1.10.8" {{/useCentralizedPackageVersionManagement}}/>
{{#useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="{{swashbuckleVersion}}"/>
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" {{^useCentralizedPackageVersionManagement}}Version="{{swashbuckleVersion}}" {{/useCentralizedPackageVersionManagement}}/>
{{/useNewtonsoft}}
{{^useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore" Version="{{swashbuckleVersion}}"/>
<PackageReference Include="Swashbuckle.AspNetCore" {{^useCentralizedPackageVersionManagement}}Version="{{swashbuckleVersion}}" {{/useCentralizedPackageVersionManagement}}/>
{{/useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="{{swashbuckleVersion}}" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" {{^useCentralizedPackageVersionManagement}}Version="{{swashbuckleVersion}}" {{/useCentralizedPackageVersionManagement}}/>
{{/useSwashbuckle}}
{{^useSwashbuckle}}
{{#useNewtonsoft}}
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="{{newtonsoftVersion}}" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" {{^useCentralizedPackageVersionManagement}}Version="{{newtonsoftVersion}}" {{/useCentralizedPackageVersionManagement}}/>
{{/useNewtonsoft}}
{{/useSwashbuckle}}
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
<PackageReference Include="JsonSubTypes" {{^useCentralizedPackageVersionManagement}}Version="1.8.0" {{/useCentralizedPackageVersionManagement}}/>
</ItemGroup>
<ItemGroup>
</ItemGroup>

View File

@@ -1,58 +1,61 @@
<Project Sdk="{{projectSdk}}">
<PropertyGroup>
<Description>{{packageDescription}}{{^packageDescription}}{{packageName}}{{/packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
<Authors>{{packageAuthors}}</Authors>
<TargetFramework>{{targetFramework}}</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>
<Version>{{packageVersion}}</Version>
{{#nullableReferenceTypes}}
<Nullable>annotations</Nullable>
{{/nullableReferenceTypes}}
{{#isLibrary}}
<OutputType>Library</OutputType>
{{/isLibrary}}
<AssemblyName>{{packageName}}</AssemblyName>
<PackageId>{{packageName}}</PackageId>
<UserSecretsId>{{userSecretsGuid}}</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup>
{{#useSeparateModelProject}}
<ProjectReference Include="../{{modelPackage}}/{{modelPackage}}.csproj"/>
{{/useSeparateModelProject}}
{{#useFrameworkReference}}
{{#isLibrary}}
<FrameworkReference Include="Microsoft.AspNetCore.App" />
{{/isLibrary}}
{{/useFrameworkReference}}
{{^useFrameworkReference}}
<PackageReference Include="Microsoft.AspNetCore.App" />
{{/useFrameworkReference}}
{{^useSeparateModelProject}}
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="{{aspnetCoreVersion}}.0"/>
{{/useSeparateModelProject}}
{{#useSwashbuckle}}
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
{{#useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="{{swashbuckleVersion}}"/>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="{{swashbuckleVersion}}"/>
{{/useNewtonsoft}}
{{^useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore" Version="{{swashbuckleVersion}}"/>
{{/useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="{{swashbuckleVersion}}" />
{{/useSwashbuckle}}
{{^useSwashbuckle}}
{{#useNewtonsoft}}
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="{{newtonsoftVersion}}" />
{{/useNewtonsoft}}
{{/useSwashbuckle}}
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
<!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="{{aspnetCoreVersion}}.0" />-->
</ItemGroup>
<PropertyGroup>
<Description>{{packageDescription}}{{^packageDescription}}{{packageName}}{{/packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
<Authors>{{packageAuthors}}</Authors>
<TargetFramework>{{targetFramework}}</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>
<Version>{{packageVersion}}</Version>
{{#nullableReferenceTypes}}
<Nullable>annotations</Nullable>
{{/nullableReferenceTypes}}
{{#isLibrary}}
<OutputType>Library</OutputType>
{{/isLibrary}}
<AssemblyName>{{packageName}}</AssemblyName>
<PackageId>{{packageName}}</PackageId>
<UserSecretsId>{{userSecretsGuid}}</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
{{#centralizedPackageVersionManagement}}
<ManagePackageVersionsCentrally>{{.}}</ManagePackageVersionsCentrally>
{{/centralizedPackageVersionManagement}}
</PropertyGroup>
<ItemGroup>
{{#useSeparateModelProject}}
<ProjectReference Include="../{{modelPackage}}/{{modelPackage}}.csproj"/>
{{/useSeparateModelProject}}
{{#useFrameworkReference}}
{{#isLibrary}}
<FrameworkReference Include="Microsoft.AspNetCore.App" />
{{/isLibrary}}
{{/useFrameworkReference}}
{{^useFrameworkReference}}
<PackageReference Include="Microsoft.AspNetCore.App" />
{{/useFrameworkReference}}
{{^useSeparateModelProject}}
<PackageReference Include="Microsoft.Extensions.Configuration.Json" {{#usePackageVersions}}Version="{{aspnetCoreVersion}}.0" {{/usePackageVersions}}/>
{{/useSeparateModelProject}}
{{#useSwashbuckle}}
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" {{#usePackageVersions}}Version="1.10.8" {{/usePackageVersions}}/>
{{#useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" {{#usePackageVersions}}Version="{{swashbuckleVersion}}" {{/usePackageVersions}}/>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" {{#usePackageVersions}}Version="{{swashbuckleVersion}}" {{/usePackageVersions}}/>
{{/useNewtonsoft}}
{{^useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore" {{#usePackageVersions}}Version="{{swashbuckleVersion}}" {{/usePackageVersions}}/>
{{/useNewtonsoft}}
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" {{#usePackageVersions}}Version="{{swashbuckleVersion}}" {{/usePackageVersions}}/>
{{/useSwashbuckle}}
{{^useSwashbuckle}}
{{#useNewtonsoft}}
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" {{#usePackageVersions}}Version="{{newtonsoftVersion}}" {{/usePackageVersions}}/>
{{/useNewtonsoft}}
{{/useSwashbuckle}}
<PackageReference Include="JsonSubTypes" {{#usePackageVersions}}Version="1.8.0" {{/usePackageVersions}}/>
</ItemGroup>
<ItemGroup>
<!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="{{aspnetCoreVersion}}.0" />-->
</ItemGroup>
</Project>

View File

@@ -591,7 +591,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
{{paramName}}Param := r.Header.Get("{{baseName}}")
{{/isHeaderParam}}
{{#isBodyParam}}
{{paramName}}Param := {{dataType}}{}
var {{paramName}}Param {{dataType}}
d := json.NewDecoder(r.Body)
{{^isAdditionalPropertiesTrue}}
d.DisallowUnknownFields()

View File

@@ -140,4 +140,46 @@ public class CSharpClientCodegenTest {
assertFileContains(modelFile.toPath(),
" Dictionary<string, ResponseResultsValue> results = default(Dictionary<string, ResponseResultsValue>");
}
@Test
public void testEnumDiscriminatorDefaultValueIsNotString() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = TestUtils.parseFlattenSpec(
"src/test/resources/3_0/enum_discriminator_inheritance.yaml");
final DefaultGenerator defaultGenerator = new DefaultGenerator();
final ClientOptInput clientOptInput = new ClientOptInput();
clientOptInput.openAPI(openAPI);
CSharpClientCodegen cSharpClientCodegen = new CSharpClientCodegen();
cSharpClientCodegen.setOutputDir(output.getAbsolutePath());
cSharpClientCodegen.setAutosetConstants(true);
clientOptInput.config(cSharpClientCodegen);
defaultGenerator.opts(clientOptInput);
Map<String, File> files = defaultGenerator.generate().stream()
.collect(Collectors.toMap(File::getPath, Function.identity()));
Map<String, String> expectedContents = Map.of(
"Cat", "PetTypeEnum petType = PetTypeEnum.Catty",
"Dog", "PetTypeEnum petType = PetTypeEnum.Dog",
"Gecko", "PetTypeEnum petType = PetTypeEnum.Gecko",
"Chameleon", "PetTypeEnum petType = PetTypeEnum.Camo",
"MiniVan", "CarType carType = CarType.MiniVan",
"CargoVan", "CarType carType = CarType.CargoVan",
"SUV", "CarType carType = CarType.SUV",
"Truck", "CarType carType = CarType.Truck",
"Sedan", "CarType carType = CarType.Sedan"
);
for (Map.Entry<String, String> e : expectedContents.entrySet()) {
String modelName = e.getKey();
String expectedContent = e.getValue();
File file = files.get(Paths
.get(output.getAbsolutePath(), "src", "Org.OpenAPITools", "Model", modelName + ".cs")
.toString()
);
assertNotNull(file, "Could not find file for model: " + modelName);
assertFileContains(file.toPath(), expectedContent);
}
}
}

View File

@@ -2408,6 +2408,39 @@ public class JavaClientCodegenTest {
assertNull(files.get("pom.xml"));
}
@Test
public void testEnumDiscriminatorDefaultValueIsNotString() {
final Path output = newTempFolder();
final OpenAPI openAPI = TestUtils.parseFlattenSpec(
"src/test/resources/3_0/enum_discriminator_inheritance.yaml");
JavaClientCodegen codegen = new JavaClientCodegen();
codegen.setOutputDir(output.toString());
Map<String, File> files = new DefaultGenerator().opts(new ClientOptInput().openAPI(openAPI).config(codegen))
.generate().stream().collect(Collectors.toMap(File::getName, Function.identity()));
Map<String, String> expectedContents = Map.of(
"Cat", "this.petType = PetTypeEnum.CATTY",
"Dog", "this.petType = PetTypeEnum.DOG",
"Gecko", "this.petType = PetTypeEnum.GECKO",
"Chameleon", "this.petType = PetTypeEnum.CAMO",
"MiniVan", "this.carType = CarType.MINI_VAN",
"CargoVan", "this.carType = CarType.CARGO_VAN",
"SUV", "this.carType = CarType.SUV",
"Truck", "this.carType = CarType.TRUCK",
"Sedan", "this.carType = CarType.SEDAN"
);
for (Map.Entry<String, String> e : expectedContents.entrySet()) {
String modelName = e.getKey();
String expectedContent = e.getValue();
File entityFile = files.get(modelName + ".java");
assertNotNull(entityFile);
assertThat(entityFile).content().doesNotContain("Type = this.getClass().getSimpleName();");
assertThat(entityFile).content().contains(expectedContent);
}
}
@Test
public void testRestTemplateHandleURIEnum() {
String[] expectedInnerEnumLines = new String[]{

View File

@@ -0,0 +1,132 @@
openapi: 3.0.3
info:
title: Test schema with enum discriminator
version: v1
paths:
"/animal":
get:
operationId: animalGet
responses:
'200':
description: OK
content:
application/json:
schema:
"$ref": "#/components/schemas/Animal"
components:
schemas:
Animal:
type: object
properties:
# Inline enum type
petType:
type: string
enum:
- Dog
- Catty
- Gecko
- Camo
discriminator:
propertyName: petType
# Mapping with implicit (Dog, Gecko), explicit ref (Catty -> Cat), and explicit schema name (Camo -> Chameleon)
mapping:
Catty: '#/components/schemas/Cat'
Camo: 'Chameleon'
required:
- petType
Cat:
type: object
allOf:
- $ref: '#/components/schemas/Animal'
properties:
meow:
type: string
Dog:
type: object
allOf:
- $ref: '#/components/schemas/Animal'
properties:
bark:
type: string
Lizard:
oneOf:
- $ref: '#/components/schemas/Gecko'
- $ref: '#/components/schemas/Chameleon'
Gecko:
type: object
allOf:
- $ref: '#/components/schemas/Animal'
properties:
lovesRocks:
type: string
Chameleon:
type: object
allOf:
- $ref: '#/components/schemas/Animal'
properties:
currentColor:
type: string
# Car inheritance tree: Car -> Truck -> SUV
# Car -> Van -> MiniVan
# Car -> Van -> CargoVan
# Car -> Sedan
Car:
type: object
required:
- carType
# Discriminator carType not defined in Car properties, but in child properties
discriminator:
propertyName: carType
CarType:
type: string
enum:
- Truck
- SUV
- Sedan
- MiniVan
- CargoVan
Truck:
type: object
allOf:
- $ref: '#/components/schemas/Car'
properties:
carType:
$ref: '#/components/schemas/CarType'
required:
- carType
SUV:
type: object
# SUV gets its discriminator property from Truck
allOf:
- $ref: '#/components/schemas/Truck'
Sedan:
type: object
allOf:
- $ref: '#/components/schemas/Car'
required:
- carType
properties:
carType:
$ref: '#/components/schemas/CarType'
Van:
oneOf:
- $ref: '#/components/schemas/MiniVan'
- $ref: '#/components/schemas/CargoVan'
MiniVan:
type: object
allOf:
- $ref: '#/components/schemas/Car'
properties:
carType:
$ref: '#/components/schemas/CarType'
required:
- carType
CargoVan:
type: object
allOf:
- $ref: '#/components/schemas/Car'
properties:
carType:
$ref: '#/components/schemas/CarType'
required:
- carType

View File

@@ -849,11 +849,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/fake/collection/test:
post:
summary: POST a test batch
operationId: fakePostTest
tags:
- fake
requestBody:
$ref: '#/components/requestBodies/TestBody'
responses:
'200':
$ref: '#/components/responses/SuccessfulOp'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
responses:
SuccessfulOp:
description: Successful Operation
content:
application/json:
schema:
type: bool
requestBodies:
TestBody:
description: Test body
required: true
content:
text/plain:
schema:
type: string
format: byte
UserArray:
content:
application/json:

View File

@@ -56,7 +56,7 @@ components:
properties:
dummy:
$ref: '#/components/schemas/IntegerRef'
number:
string_ref:
anyOf:
- $ref: '#/components/schemas/StringRef'
AnyOfStringArrayOfString:
@@ -104,4 +104,4 @@ components:
- $ref: '#/components/schemas/IntegerRef'
- $ref: '#/components/schemas/StringRef'
JustDescription:
Description: A schema with just description
description: A schema with just description

View File

@@ -15,7 +15,7 @@
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<!-- RELEASE_VERSION -->
<version>7.11.0-SNAPSHOT</version>
<version>7.12.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<url>https://github.com/openapitools/openapi-generator</url>
<scm>

View File

@@ -1 +1 @@
7.11.0-SNAPSHOT
7.12.0-SNAPSHOT

View File

@@ -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.11.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
<a id="frameworks-supported"></a>

View File

@@ -1 +1 @@
7.11.0-SNAPSHOT
7.12.0-SNAPSHOT

View File

@@ -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.11.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation

View File

@@ -1 +1 @@
7.11.0-SNAPSHOT
7.12.0-SNAPSHOT

View File

@@ -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.11.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation

View File

@@ -1 +1 @@
7.11.0-SNAPSHOT
7.12.0-SNAPSHOT

View File

@@ -4,7 +4,7 @@ Echo Server API
- API version: 0.1.0
- Generator version: 7.11.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT
Echo Server API

View File

@@ -81,7 +81,7 @@ import org.openapitools.client.auth.Authentication;
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.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ApiClient extends JavaTimeFormatter {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
@@ -540,7 +540,7 @@ public class ApiClient extends JavaTimeFormatter {
* @param value The value of the parameter.
* @return A list of {@code Pair} objects.
*/
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
List<Pair> params = new ArrayList<Pair>();
// preconditions

View File

@@ -16,7 +16,7 @@ package org.openapitools.client;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;

View File

@@ -17,7 +17,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import java.util.Collections;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public abstract class BaseApi {
protected ApiClient apiClient;

View File

@@ -13,7 +13,7 @@
package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Configuration {
public static final String VERSION = "0.1.0";

View File

@@ -20,7 +20,7 @@ import java.time.format.DateTimeParseException;
* 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.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class JavaTimeFormatter {
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

View File

@@ -13,7 +13,7 @@
package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Pair {
private String name = "";
private String value = "";

View File

@@ -22,7 +22,7 @@ import java.text.DecimalFormat;
import java.util.GregorianCalendar;
import java.util.TimeZone;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");

View File

@@ -18,7 +18,7 @@ import java.util.Map;
/**
* Representing a Server configuration.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ServerConfiguration {
public String URL;
public String description;

View File

@@ -18,7 +18,7 @@ import java.util.HashSet;
/**
* Representing a Server Variable for server URL template substitution.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ServerVariable {
public String description;
public String defaultValue;

View File

@@ -16,7 +16,7 @@ package org.openapitools.client;
import java.util.Collection;
import java.util.Iterator;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@@ -29,7 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class AuthApi extends BaseApi {
public AuthApi() {

View File

@@ -33,7 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class BodyApi extends BaseApi {
public BodyApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class FormApi extends BaseApi {
public FormApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class HeaderApi extends BaseApi {
public HeaderApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class PathApi extends BaseApi {
public PathApi() {

View File

@@ -36,7 +36,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class QueryApi extends BaseApi {
public QueryApi() {

View File

@@ -18,7 +18,7 @@ import org.openapitools.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;

View File

@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class HttpBasicAuth implements Authentication {
private String username;
private String password;

View File

@@ -20,7 +20,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class HttpBearerAuth implements Authentication {
private final String scheme;
private Supplier<String> tokenSupplier;

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
Bird.JSON_PROPERTY_SIZE,
Bird.JSON_PROPERTY_COLOR
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Bird {
public static final String JSON_PROPERTY_SIZE = "size";
@javax.annotation.Nullable

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
Category.JSON_PROPERTY_ID,
Category.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Category {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable

View File

@@ -39,7 +39,7 @@ import java.util.StringJoiner;
DataQuery.JSON_PROPERTY_TEXT,
DataQuery.JSON_PROPERTY_DATE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class DataQuery extends Query {
public static final String JSON_PROPERTY_SUFFIX = "suffix";
@javax.annotation.Nullable

View File

@@ -47,7 +47,7 @@ import java.util.StringJoiner;
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.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class DefaultValue {
public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default";
@javax.annotation.Nullable

View File

@@ -35,7 +35,7 @@ import java.util.StringJoiner;
NumberPropertiesOnly.JSON_PROPERTY_FLOAT,
NumberPropertiesOnly.JSON_PROPERTY_DOUBLE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class NumberPropertiesOnly {
public static final String JSON_PROPERTY_NUMBER = "number";
@javax.annotation.Nullable

View File

@@ -42,7 +42,7 @@ import java.util.StringJoiner;
Pet.JSON_PROPERTY_TAGS,
Pet.JSON_PROPERTY_STATUS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Pet {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable

View File

@@ -36,7 +36,7 @@ import java.util.StringJoiner;
Query.JSON_PROPERTY_ID,
Query.JSON_PROPERTY_OUTCOMES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Query {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
Tag.JSON_PROPERTY_ID,
Tag.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Tag {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME
})
@JsonTypeName("test_form_object_multipart_request_marker")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class TestFormObjectMultipartRequestMarker {
public static final String JSON_PROPERTY_NAME = "name";
@javax.annotation.Nullable

View File

@@ -36,7 +36,7 @@ import java.util.StringJoiner;
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.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter {
public static final String JSON_PROPERTY_SIZE = "size";
@javax.annotation.Nullable

View File

@@ -36,7 +36,7 @@ import java.util.StringJoiner;
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.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
public static final String JSON_PROPERTY_VALUES = "values";
@javax.annotation.Nullable

View File

@@ -1 +1 @@
7.11.0-SNAPSHOT
7.12.0-SNAPSHOT

View File

@@ -31,7 +31,7 @@ import org.openapitools.client.auth.HttpBearerAuth;
import org.openapitools.client.auth.ApiKeyAuth;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ApiClient {
private static final Logger log = Logger.getLogger(ApiClient.class.getName());

View File

@@ -18,7 +18,7 @@ import java.util.Map;
/**
* Representing a Server configuration.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ServerConfiguration {
public String URL;
public String description;

View File

@@ -18,7 +18,7 @@ import java.util.HashSet;
/**
* Representing a Server Variable for server URL template substitution.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class ServerVariable {
public String description;
public String defaultValue;

View File

@@ -16,7 +16,7 @@ package org.openapitools.client;
import java.util.Collection;
import java.util.Iterator;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@@ -11,7 +11,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface AuthApi extends ApiClient.Api {

View File

@@ -15,7 +15,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface BodyApi extends ApiClient.Api {

View File

@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface FormApi extends ApiClient.Api {

View File

@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface HeaderApi extends ApiClient.Api {

View File

@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface PathApi extends ApiClient.Api {

View File

@@ -18,7 +18,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public interface QueryApi extends ApiClient.Api {

View File

@@ -25,7 +25,7 @@ import java.io.IOException;
/**
* Bird
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Bird {
public static final String SERIALIZED_NAME_SIZE = "size";
@SerializedName(SERIALIZED_NAME_SIZE)

View File

@@ -25,7 +25,7 @@ import java.io.IOException;
/**
* Category
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Category {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -30,7 +30,7 @@ import org.openapitools.client.model.Query;
/**
* DataQuery
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class DataQuery extends Query {
public static final String SERIALIZED_NAME_SUFFIX = "suffix";
@SerializedName(SERIALIZED_NAME_SUFFIX)

View File

@@ -30,7 +30,7 @@ import org.openapitools.jackson.nullable.JsonNullable;
/**
* to test the default value of properties
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.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)

View File

@@ -26,7 +26,7 @@ import java.math.BigDecimal;
/**
* NumberPropertiesOnly
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class NumberPropertiesOnly {
public static final String SERIALIZED_NAME_NUMBER = "number";
@SerializedName(SERIALIZED_NAME_NUMBER)

View File

@@ -30,7 +30,7 @@ import org.openapitools.client.model.Tag;
/**
* Pet
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Pet {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -28,7 +28,7 @@ import java.util.List;
/**
* Query
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0-SNAPSHOT")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class Query {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

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