Compare commits

..

20 Commits

Author SHA1 Message Date
William Cheng
34bc4c02e1 update tests 2025-10-31 14:49:16 +08:00
William Cheng
ba2d025100 Merge remote-tracking branch 'origin/master' into follow-21994 2025-10-31 14:15:52 +08:00
William Cheng
9b8ab659ac update undertow to newer version (#22259) 2025-10-31 13:27:43 +08:00
William Cheng
f9d2b8b579 Prepare v7.18.0 release (#22250)
* Revert "v7.17.0 release (#22248)"

This reverts commit 0120486e62.

* prepare v7.18.0 release

* update samples

* update doc
2025-10-30 01:25:35 +08:00
William Cheng
0120486e62 v7.17.0 release (#22248) 2025-10-30 00:18:40 +08:00
Ivan ROGER
44075c9edf Fix explode query params for typescript-fetch (#22246)
Fixes: #10438
2025-10-29 16:28:00 +01:00
William Cheng
3d4f29eac7 [PYTHON-FASTAPI] update starlette to newer version 0.49.1 (#22243)
* update starlette to newer version 0.49.1

* update fastapi to newer version
2025-10-29 15:18:27 +08:00
William Cheng
351b601368 openapi-normalizer: Add REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT normalize option (#22236)
* fix bug 21680: Introduce REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT normalize option

* Advise to use REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT

* update doc

---------

Co-authored-by: Guillaume ALAMOME <guillaume.alamome@gmail.com>
2025-10-28 13:54:49 +08:00
Jason Frey
2c248e6c93 [ruby] Introduce ApiModelBase (#22052)
The Ruby code that is generated copies numerous methods into every
model. This creates bloat both in file size and run-time memory usage.
This commit introduces a base class for all models to store common
methods. This commit's focus is only on static methods that do not
change between models.
2025-10-28 12:42:51 +08:00
Eddie Sholl
68b0dfe6d1 Expose mtls certificate config params in python and php configuration templates (#22229)
* Expose mtls config params in python template

* Expose certFile and keyFile configuration items to support mtls in php generated client

* Regenerate of examples
2025-10-28 12:33:05 +08:00
Leon Linhart
31e462dc3e Make Gradle properties non-nullable (#22050)
They were never really intended to support null values, so this is kind of a bug. However, this is technically also breaking for users that set these properties to `null` explicitly (instead of leaving them unset).
2025-10-27 15:18:08 +08:00
Elliott Kember
74488fa3c3 Update modelOneOf.mustache (#22220)
Adds booleans to modelOneOf
2025-10-27 15:15:57 +08:00
William Cheng
8c54f18f7c remove BACKTICK_PLAN.md 2025-10-27 14:56:13 +08:00
Anshul Singhvi
57d12811ef [Julia] Fix docstring parameter formatting with backticks (#22190)
* [Julia] Fix docstring parameter formatting with backticks

Wrap parameter names in backticks in generated Julia client docstrings
to prevent markdown from misinterpreting underscores as italic formatting.

This fixes an issue where parameter names like `pet_id`, `api_key`, and
`additional_metadata` would render incorrectly in documentation, with
underscores being treated as markdown italic markers instead of literal
characters.

Related issue: JuliaComputing/OpenAPI.jl#72

* Also wrap data types and return types in backticks

* Regenerate Julia client samples with backticked docstrings

* [Julia] Add backticks to all markdown documentation templates

Extend backtick formatting to markdown documentation templates for
both Julia client and server generators. This ensures consistent
markdown rendering of identifiers with underscores.

Changes:
- julia-client/api_doc.mustache: Add backticks to function signatures,
  parameter names, types, and return types in markdown API docs
- julia-server/api_doc.mustache: Same changes for server API docs
- julia-client/model_doc.mustache: Add backticks to property names and
  types in markdown model documentation
- julia-server/model_doc.mustache: Same changes for server model docs

All generated markdown files now properly display identifiers like
`pet_id`, `Custom_Type`, `update_pet_with_form` with literal
underscores instead of broken italic formatting.

Related to JuliaComputing/OpenAPI.jl#72
2025-10-27 14:55:35 +08:00
lbilger
676efae183 [Java] Add import for java.util.Arrays if there is a set property in a model. Arrays.asList is used when initializing the property if it has a default value. (#22207) 2025-10-27 14:55:10 +08:00
Rens Groothuijsen
a4d05b38f5 [go] Correctly set default array value on query parameters (#22060) 2025-10-27 10:30:08 +08:00
Mattias Sehlstedt
75ae04ecfd Fix so that the x-field-extra-annotation properly split any array items (#22226)
* Fix so that the x-field-extra-annotation properly split any array items

* Add a unit test to show that the annotations are generated as expected
2025-10-27 09:56:38 +08:00
rignicat
808d106e0c [jaxrs] Support jackson option (true by default) (#22169)
* allow configuring jackson, remove jackson import if disabled

* do not generate root resource or application file if generating interface

* change template files to remove jackson if disabled

* updated samples and docs as required by PR checklist
2025-10-27 09:56:07 +08:00
William Cheng
9d810e0fbb update jackson databind nullable to v0.2.8 (#22230) 2025-10-27 00:35:51 +08:00
William Cheng
e8b699120f handle option parameter with ? in kotlin-spring 2025-10-18 17:01:29 +08:00
7981 changed files with 10308 additions and 26767 deletions

View File

@@ -15,7 +15,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.17.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.18.0`):
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
@@ -148,8 +148,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 7.17.0 (upcoming minor release) [SNAPSHOT](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) | 24.10.2025 | Minor release with breaking changes (with fallback) |
| [7.16.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.16.0) (latest stable release) | 28.09.2025 | Minor release with breaking changes (with fallback) |
| 7.18.0 (upcoming minor release) [SNAPSHOT](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) | 10.12.2025 | Minor release with breaking changes (with fallback) |
| [7.17.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.17.0) (latest stable release) | 29.10.2025 | 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) |
@@ -212,16 +212,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.16.0/openapi-generator-cli-7.16.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.0.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.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.16.0/openapi-generator-cli-7.16.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.0.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -456,7 +456,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 7.16.0
openapi-generator-cli version-manager set 7.17.0
```
Or install it as dev-dependency:
@@ -480,7 +480,7 @@ pip install openapi-generator-cli
To install a specific version
```
pip install openapi-generator-cli==7.16.0
pip install openapi-generator-cli==7.17.0
```
You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required)
@@ -506,7 +506,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.16.0/openapi-generator-cli-7.16.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.17.0/openapi-generator-cli-7.17.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

@@ -644,6 +644,13 @@ Example:
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/required-properties.yaml -o /tmp/java-okhttp/ --openapi-normalizer NORMALIZER_CLASS=org.openapitools.codegen.OpenAPINormalizerTest$RemoveRequiredNormalizer
```
- `REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT`: When set to true, remove the "properties" of a schema with type other than "object".
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/required-properties.yaml -o /tmp/java-okhttp/ --openapi-normalizer REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT=true
```
- `FILTER`
The `FILTER` parameter allows selective inclusion of API operations based on specific criteria. It applies the `x-internal: true` property to operations that do **not** match the specified values, preventing them from being generated. Multiple filters can be separated by a semicolon.

View File

@@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
To install a specific version of the tool, pass the version during installation:
<!-- RELEASE_VERSION -->
```bash
openapi-generator-cli version-manager set 7.16.0
openapi-generator-cli version-manager set 7.17.0
```
<!-- /RELEASE_VERSION -->
To install the tool as a dev dependency in your current project:
@@ -119,18 +119,18 @@ docker run --rm \
<!-- 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.16.0/openapi-generator-cli-7.16.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.0.jar`
For **Mac/Linux** users:
```bash
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.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.
```powershell
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.17.0/openapi-generator-cli-7.17.0.jar
```
<!-- /RELEASE_VERSION -->

View File

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

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
[source,group]
----
plugins {
id "org.openapi.generator" version "7.16.0"
id "org.openapi.generator" version "7.17.0"
}
----
@@ -113,7 +113,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:7.16.0"
classpath "org.openapitools:openapi-generator-gradle-plugin:7.17.0"
}
}
@@ -759,7 +759,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath('org.openapitools:openapi-generator-gradle-plugin:7.16.0') {
classpath('org.openapitools:openapi-generator-gradle-plugin:7.17.0') {
exclude group: 'com.google.guava'
}
}

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.17.0-SNAPSHOT
openApiGeneratorVersion=7.18.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.17.0-SNAPSHOT</version>
<version>7.18.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -19,5 +19,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=7.16.0 openApiValidate
gradle -PopenApiGeneratorVersion=7.17.0 openApiValidate
```

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.17.0-SNAPSHOT
openApiGeneratorVersion=7.18.0-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -81,12 +81,12 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
/**
* The template directory holding a custom template.
*/
val templateDir = project.objects.property<String?>()
val templateDir = project.objects.property<String>()
/**
* The template location (which may be a directory or a classpath location) holding custom templates.
*/
val templateResourcePath = project.objects.property<String?>()
val templateResourcePath = project.objects.property<String>()
/**
* Adds authorization headers when fetching the OpenAPI definitions remotely.
@@ -109,7 +109,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
/**
* Specifies if the existing files should be overwritten during the generation.
*/
val skipOverwrite = project.objects.property<Boolean?>()
val skipOverwrite = project.objects.property<Boolean>()
/**
* Package for generated classes (where supported)
@@ -244,32 +244,32 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
/**
* Reference the library template (sub-template) of a generator.
*/
val library = project.objects.property<String?>()
val library = project.objects.property<String>()
/**
* Git host, e.g. gitlab.com.
*/
val gitHost = project.objects.property<String?>()
val gitHost = project.objects.property<String>()
/**
* Git user ID, e.g. openapitools.
*/
val gitUserId = project.objects.property<String?>()
val gitUserId = project.objects.property<String>()
/**
* Git repo ID, e.g. openapi-generator.
*/
val gitRepoId = project.objects.property<String?>()
val gitRepoId = project.objects.property<String>()
/**
* Release note, default to 'Minor update'.
*/
val releaseNote = project.objects.property<String?>()
val releaseNote = project.objects.property<String>()
/**
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
*/
val httpUserAgent = project.objects.property<String?>()
val httpUserAgent = project.objects.property<String>()
/**
* Specifies how a reserved name should be escaped to. Otherwise, the default _<name> is used.
@@ -279,17 +279,17 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
/**
* Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
*/
val ignoreFileOverride = project.objects.property<String?>()
val ignoreFileOverride = project.objects.property<String>()
/**
* Remove prefix of operationId, e.g. config_getId => getId
*/
val removeOperationIdPrefix = project.objects.property<Boolean?>()
val removeOperationIdPrefix = project.objects.property<Boolean>()
/**
* Skip examples defined in the operation
*/
val skipOperationExample = project.objects.property<Boolean?>()
val skipOperationExample = project.objects.property<Boolean>()
/**
* Defines which API-related files should be generated. This allows you to create a subset of generated files (or none at all).
@@ -394,7 +394,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
/**
* Templating engine: "mustache" (default) or "handlebars" (beta)
*/
val engine = project.objects.property<String?>()
val engine = project.objects.property<String>()
/**
* Defines whether the output dir should be cleaned up before generating the output.

View File

@@ -55,7 +55,6 @@ import org.openapitools.codegen.config.MergedSpecBuilder
*
* @author Jim Schubert
*/
@Suppress("UnstableApiUsage")
@CacheableTask
open class GenerateTask @Inject constructor(private val objectFactory: ObjectFactory) : DefaultTask() {
@@ -154,14 +153,14 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
@get:Optional
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
val templateDir = project.objects.property<String?>()
val templateDir = project.objects.property<String>()
/**
* Resource path containing template files.
*/
@get:Optional
@get:Input
val templateResourcePath = project.objects.property<String?>()
val templateResourcePath = project.objects.property<String>()
/**
* Adds authorization headers when fetching the OpenAPI definitions remotely.
@@ -193,7 +192,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
*/
@get:Optional
@get:Input
val skipOverwrite = project.objects.property<Boolean?>()
val skipOverwrite = project.objects.property<Boolean>()
/**
* Package for generated classes (where supported)
@@ -384,42 +383,42 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
*/
@get:Optional
@get:Input
val library = project.objects.property<String?>()
val library = project.objects.property<String>()
/**
* Git host, e.g. gitlab.com.
*/
@get:Optional
@get:Input
val gitHost = project.objects.property<String?>()
val gitHost = project.objects.property<String>()
/**
* Git user ID, e.g. openapitools.
*/
@get:Optional
@get:Input
val gitUserId = project.objects.property<String?>()
val gitUserId = project.objects.property<String>()
/**
* Git repo ID, e.g. openapi-generator.
*/
@get:Optional
@get:Input
val gitRepoId = project.objects.property<String?>()
val gitRepoId = project.objects.property<String>()
/**
* Release note, default to 'Minor update'.
*/
@get:Optional
@get:Input
val releaseNote = project.objects.property<String?>()
val releaseNote = project.objects.property<String>()
/**
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
*/
@get:Optional
@get:Input
val httpUserAgent = project.objects.property<String?>()
val httpUserAgent = project.objects.property<String>()
/**
* Specifies how a reserved name should be escaped to.
@@ -434,21 +433,21 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
@get:Optional
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val ignoreFileOverride = project.objects.property<String?>()
val ignoreFileOverride = project.objects.property<String>()
/**
* Remove prefix of operationId, e.g. config_getId => getId
*/
@get:Optional
@get:Input
val removeOperationIdPrefix = project.objects.property<Boolean?>()
val removeOperationIdPrefix = project.objects.property<Boolean>()
/**
* Remove examples defined in the operation
*/
@get:Optional
@get:Input
val skipOperationExample = project.objects.property<Boolean?>()
val skipOperationExample = project.objects.property<Boolean>()
/**
* Defines which API-related files should be generated. This allows you to create a subset of generated files (or none at all).
@@ -581,7 +580,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
*/
@get:Optional
@get:Input
val engine = project.objects.property<String?>()
val engine = project.objects.property<String>()
/**
* Defines whether the output dir should be cleaned up before generating the output.
@@ -598,19 +597,11 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
@get:Input
val dryRun = project.objects.property<Boolean>()
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {
private fun <T> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {
if (isPresent) {
val item: T? = get()
if (item != null) {
when (get()) {
is String -> if ((get() as String).isNotEmpty()) {
block(get())
}
is String? -> if (true == (get() as String?)?.isNotEmpty()) {
block(get())
}
else -> block(get())
}
when (val value = get()) {
is String -> if (value.isNotEmpty()) block(value)
else -> block(value)
}
}
}
@@ -725,7 +716,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
}
skipOverwrite.ifNotEmpty { value ->
configurator.setSkipOverwrite(value ?: false)
configurator.setSkipOverwrite(value)
}
generatorName.ifNotEmpty { value ->
@@ -820,11 +811,11 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
}
removeOperationIdPrefix.ifNotEmpty { value ->
configurator.setRemoveOperationIdPrefix(value!!)
configurator.setRemoveOperationIdPrefix(value)
}
skipOperationExample.ifNotEmpty { value ->
configurator.setSkipOperationExample(value!!)
configurator.setSkipOperationExample(value)
}
logToStderr.ifNotEmpty { value ->

View File

@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.16.0</version>
<version>7.17.0</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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.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.17.0-SNAPSHOT</version>
<version>7.18.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -356,7 +356,9 @@ public class InlineModelResolver {
} else if (schema.getProperties() != null) {
// If non-object type is specified but also properties
LOGGER.error("Illegal schema found with non-object type combined with properties," +
" no properties should be defined:\n " + schema.toString());
" no properties should be defined:" +
" consider using --openapi-normalizer REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT=true\n " +
schema.toString());
return;
} else if (schema.getAdditionalProperties() != null) {
// If non-object type is specified but also additionalProperties

View File

@@ -124,6 +124,9 @@ public class OpenAPINormalizer {
// the allOf contains a new schema containing the properties in the top level
final String REFACTOR_ALLOF_WITH_PROPERTIES_ONLY = "REFACTOR_ALLOF_WITH_PROPERTIES_ONLY";
// when set to true, remove the "properties" of a schema with type other than "object"
final String REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT = "REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT";
// when set to true, normalize OpenAPI 3.1 spec to make it work with the generator
final String NORMALIZE_31SPEC = "NORMALIZE_31SPEC";
@@ -206,6 +209,7 @@ public class OpenAPINormalizer {
ruleNames.add(SET_CONTAINER_TO_NULLABLE);
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
ruleNames.add(SIMPLIFY_ONEOF_ANYOF_ENUM);
ruleNames.add(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT);
// rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
@@ -702,6 +706,8 @@ public class OpenAPINormalizer {
markSchemaAsVisited(schema, visitedSchemas);
processNormalizeOtherThanObjectWithProperties(schema);
if (ModelUtils.isArraySchema(schema)) { // array
Schema result = normalizeArraySchema(schema);
normalizeSchema(result.getItems(), visitedSchemas);
@@ -1961,6 +1967,23 @@ public class OpenAPINormalizer {
private boolean hasMethod(String method) {
return methodFilters.contains(method);
}
}
/**
* When set to true, remove "properties" attribute on schema other than "object"
* since it should be ignored and may result in odd generated code
*
* @param schema Schema
* @return Schema
*/
protected void processNormalizeOtherThanObjectWithProperties(Schema schema) {
if (getRule(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT)) {
// Check object models / any type models / composed models for properties,
// if the schema has a type defined that is not "object" it should not define
// any properties
if (schema.getType() != null && !"object".equals(schema.getType())) {
schema.setProperties(null);
}
}
}
}

View File

@@ -1891,6 +1891,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
model.imports.add("Arrays");
} else if ("set".equals(property.containerType)) {
model.imports.add("LinkedHashSet");
model.imports.add("Arrays");
if ((!openApiNullable || !property.isNullable) && jackson) { // cannot be wrapped to nullable
model.imports.add("JsonDeserialize");
property.vendorExtensions.put("x-setter-extra-annotation", "@JsonDeserialize(as = LinkedHashSet.class)");

View File

@@ -119,6 +119,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
convertPropertyToStringAndWriteBack(CodegenConstants.IMPL_FOLDER, this::setImplFolder);
convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION, this::setUseBeanValidation);
convertPropertyToBooleanAndWriteBack(USE_TAGS, this::setUseTags);
convertPropertyToBooleanAndWriteBack(JACKSON, this::setJackson);
}
@Override

View File

@@ -17,6 +17,7 @@
package org.openapitools.codegen.languages;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.Iterables;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.media.Schema;
@@ -440,6 +441,17 @@ public class GoClientCodegen extends AbstractGoCodegen {
return null;
}
if (ModelUtils.isArraySchema(p)) {
StringJoiner joinedDefaultValues = new StringJoiner(", ");
Object defaultValues = p.getDefault();
if (defaultValues instanceof ArrayNode) {
for (var value : (ArrayNode) defaultValues) {
joinedDefaultValues.add(value.toString());
}
return "{" + joinedDefaultValues + "}";
}
}
return super.toDefaultValue(p);
}

View File

@@ -187,19 +187,22 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")
.doNotOverwrite());
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
.doNotOverwrite());
if (!interfaceOnly) {
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
.doNotOverwrite());
supportingFiles.add(new SupportingFile("RestApplication.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
.doNotOverwrite());
}
if (generatePom) {
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")
.doNotOverwrite());
}
supportingFiles.add(new SupportingFile("RestApplication.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
.doNotOverwrite());
if (StringUtils.isNotEmpty(openApiSpecFileLocation)) {
int index = openApiSpecFileLocation.lastIndexOf('/');
String fileFolder;
@@ -276,6 +279,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
if (!jackson) {
codegenModel.imports.remove("JsonValue");
codegenModel.imports.remove("JsonProperty");
codegenModel.imports.remove("JsonTypeName");
}
return codegenModel;
}

View File

@@ -271,6 +271,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
supportingFiles.add(new SupportingFile("gem.mustache", libFolder, gemName + ".rb"));
String gemFolder = libFolder + File.separator + gemName;
supportingFiles.add(new SupportingFile("api_error.mustache", gemFolder, "api_error.rb"));
supportingFiles.add(new SupportingFile("api_model_base.mustache", gemFolder, "api_model_base.rb"));
supportingFiles.add(new SupportingFile("version.mustache", gemFolder, "version.rb"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));

View File

@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -49,7 +49,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
{{#jsonb}}{{^isDiscriminator}}@JsonbProperty("{{baseName}}"){{/isDiscriminator}}{{#isDiscriminator}}{{#jsonbPolymorphism}}@JsonbTransient{{/jsonbPolymorphism}}{{^jsonbPolymorphism}}@JsonbProperty("{{baseName}}"){{/jsonbPolymorphism}}{{/isDiscriminator}}{{/jsonb}}
{{/withXml}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};

View File

@@ -66,7 +66,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -71,7 +71,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/deprecated}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{>nullable_var_annotations}}{{! prevent indent}}
{{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};

View File

@@ -74,7 +74,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -74,7 +74,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -74,7 +74,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -74,7 +74,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -16,7 +16,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/vars}}

View File

@@ -49,7 +49,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss.SSSX")
{{/isDateTime}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/vars}}

View File

@@ -56,7 +56,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
@Valid
{{/useBeanValidation}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -36,7 +36,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};

View File

@@ -36,7 +36,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};

View File

@@ -14,7 +14,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}

View File

@@ -14,7 +14,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}

View File

@@ -23,7 +23,10 @@ import {{javaxPackage}}.validation.Valid;{{/useBeanValidation}}
/**
* Represents a collection of functions to interact with the API endpoints.
*/
@Path("{{commonPath}}"){{#useSwaggerAnnotations}}
{{^interfaceOnly}}
@Path("{{commonPath}}")
{{/interfaceOnly}}
{{#useSwaggerAnnotations}}
@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}

View File

@@ -8,8 +8,8 @@
* @return {{{message}}}
{{/responses}}
*/
@{{httpMethod}}{{#subresourceOperation}}
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
@{{httpMethod}}
@Path("{{commonPath}}{{{path}}}"){{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {

View File

@@ -20,7 +20,9 @@
}
@Override
{{#jackson}}
@JsonValue
{{/jackson}}
public String toString() {
return String.valueOf(value);
}
@@ -40,6 +42,7 @@
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected string value '" + s + "'");{{/isNullable}}
}
{{#jackson}}
@JsonCreator
public static {{datatypeWithEnum}} fromValue({{dataType}} value) {
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
@@ -49,4 +52,5 @@
}
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}}
}
{{/jackson}}
}

View File

@@ -41,11 +41,14 @@ import com.fasterxml.jackson.annotation.JsonValue;
}
@Override
{{#jackson}}
@JsonValue
{{/jackson}}
public String toString() {
return String.valueOf(value);
}
{{#jackson}}
@JsonCreator
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
@@ -55,4 +58,5 @@ import com.fasterxml.jackson.annotation.JsonValue;
}
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}}
}
{{/jackson}}
}

View File

@@ -2,11 +2,12 @@
import io.swagger.annotations.*;
{{/useSwaggerAnnotations}}
import java.util.Objects;
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonTypeName;
{{/jackson}}
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.XmlElement;
import {{javaxPackage}}.xml.bind.annotation.XmlRootElement;
@@ -22,7 +23,7 @@ import {{javaxPackage}}.xml.bind.annotation.XmlEnumValue;
**/{{/description}}
{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#title}}title="{{{.}}}", {{/title}}{{#description}}description="{{{.}}}"{{/description}}{{^description}}description=""{{/description}}){{/useMicroProfileOpenAPIAnnotations}}
@JsonTypeName("{{name}}")
{{#jackson}}@JsonTypeName("{{name}}"){{/jackson}}
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
@@ -40,7 +41,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{/isContainer}}
{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{#isContainer}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{/isContainer}}{{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/vars}}
@@ -61,6 +62,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
public {{classname}}() {
}
{{#jackson}}
{{#generateJsonCreator}}
{{#hasRequired}}
@JsonCreator
@@ -85,6 +87,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{/hasRequired}}
{{/generateJsonCreator}}
{{/jackson}}
{{#vars}}
/**
{{#description}}
@@ -108,12 +111,14 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}}{{#useSwaggerAnnotations}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}"){{/useMicroProfileOpenAPIAnnotations}}
@JsonProperty({{#required}}required = {{required}}, value = {{/required}}"{{baseName}}")
{{#jackson}}@JsonProperty({{#required}}required = {{required}}, value = {{/required}}"{{baseName}}"){{/jackson}}
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}public {{>beanValidatedType}} {{getter}}() {
return {{name}};
}
{{#jackson}}
@JsonProperty({{#required}}required = {{required}}, value = {{/required}}"{{baseName}}")
{{/jackson}}
{{#vendorExtensions.x-setter-extra-annotation}}{{{vendorExtensions.x-setter-extra-annotation}}}
{{/vendorExtensions.x-setter-extra-annotation}}public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}};

View File

@@ -32,7 +32,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
@SerializedName("{{baseName}}")
{{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}}
{{#useBeanValidation}}

View File

@@ -1 +1 @@
{{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isHeaderParam}}

View File

@@ -1 +1 @@
{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}

View File

@@ -70,7 +70,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}
{{/isPassword}}
{{/lombok.ToString}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#lombok.Builder}}
{{#defaultValue}}

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isQueryParam}}

View File

@@ -217,8 +217,16 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
parameterAddToHeaderOrQuery(localVarQueryParams, "{{{baseName}}}", r.{{paramName}}, "{{style}}", "{{collectionFormat}}")
{{/isCollectionFormatMulti}}
{{#defaultValue}}} else {
var defaultValue {{{dataType}}} = {{{.}}}
r.{{paramName}} = &defaultValue
{{#isArray}}
var defaultValue {{{dataType}}} = {{{dataType}}}{{{.}}}
parameterAddToHeaderOrQuery(localVarQueryParams, "{{{baseName}}}", defaultValue, "{{style}}", "{{collectionFormat}}")
r.{{paramName}} = &defaultValue
{{/isArray}}
{{^isArray}}
var defaultValue {{{dataType}}} = {{{.}}}
parameterAddToHeaderOrQuery(localVarQueryParams, "{{{baseName}}}", defaultValue, "{{style}}", "{{collectionFormat}}")
r.{{paramName}} = &defaultValue
{{/isArray}}
{{/defaultValue}}}
{{/required}}
{{/queryParams}}

View File

@@ -70,7 +70,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/isPassword}}
{{/lombok.ToString}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#deprecated}}
@Deprecated

View File

@@ -35,7 +35,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
**/
{{/description}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};

View File

@@ -35,7 +35,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
**/
{{/description}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};

View File

@@ -40,7 +40,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
**/
{{/description}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};

View File

@@ -56,7 +56,7 @@ Declare the class with extends and implements
{{/isXmlWrapped}}
{{/withXml}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}

View File

@@ -29,7 +29,7 @@
<version.logback>1.5.19</version.logback>
<version.junit>4.13.2</version.junit>
<version.mockito>2.1.0-beta.124</version.mockito>
<version.undertow>2.3.17.Final</version.undertow>
<version.undertow>2.3.20.Final</version.undertow>
<version.jsonpath>2.2.0</version.jsonpath>
<version.httpclient>4.5.13</version.httpclient>
<version.httpasyncclient>4.1.2</version.httpasyncclient>

View File

@@ -89,10 +89,10 @@ end
{{/summary.length}}{{#notes.length}}{{{notes}}}
{{/notes.length}}Params:
{{#allParams}}- {{paramName}}::{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{#required}} (required){{/required}}
{{#allParams}}- `{{paramName}}`::{{#isBinary}}{{#isFile}}`{{dataType}}`{{/isFile}}{{^isFile}}`Vector{UInt8}`{{/isFile}}{{/isBinary}}{{^isBinary}}`{{dataType}}`{{/isBinary}}{{#required}} (required){{/required}}
{{/allParams}}
Return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}, OpenAPI.Clients.ApiResponse
Return: {{#returnType}}`{{returnType}}`{{/returnType}}{{^returnType}}`Nothing`{{/returnType}}, `OpenAPI.Clients.ApiResponse`
"""
function {{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing)
_ctx = _oacinternal_{{operationId}}(_api{{#allParams}}{{#required}}, {{paramName}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}={{paramName}},{{/required}}{{/allParams}} _mediaType=_mediaType)

View File

@@ -11,8 +11,8 @@ Method | HTTP request | Description
{{#operations}}
{{#operation}}
# **{{{operationId}}}**
> {{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing) -> {{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}, OpenAPI.Clients.ApiResponse <br/>
> {{operationId}}(_api::{{classname}}, response_stream::Channel{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing) -> Channel{ {{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Nothing{{/returnType}} }, OpenAPI.Clients.ApiResponse
> `{{operationId}}`(_api::`{{classname}}`{{#allParams}}{{#required}}, `{{paramName}}`::`{{dataType}}`{{/required}}{{/allParams}};{{#allParams}}{{^required}} `{{paramName}}`=nothing,{{/required}}{{/allParams}} _mediaType=nothing) -> {{#returnType}}`{{{.}}}`{{/returnType}}{{^returnType}}`Nothing`{{/returnType}}, `OpenAPI.Clients.ApiResponse` <br/>
> `{{operationId}}`(_api::`{{classname}}`, response_stream::`Channel`{{#allParams}}{{#required}}, `{{paramName}}`::`{{dataType}}`{{/required}}{{/allParams}};{{#allParams}}{{^required}} `{{paramName}}`=nothing,{{/required}}{{/allParams}} _mediaType=nothing) -> `Channel`{ {{#returnType}}`{{{.}}}`{{/returnType}}{{^returnType}}`Nothing`{{/returnType}} }, `OpenAPI.Clients.ApiResponse`
{{{summary}}}{{#notes}}
@@ -22,18 +22,18 @@ Method | HTTP request | Description
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**_api** | **{{classname}}** | API context | {{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**{{paramName}}** | {{#isPrimitiveType}}**{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{#isFile}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isFile}}{{/isPrimitiveType}} | {{description}} |{{/required}}{{/allParams}}{{#hasOptionalParams}}
**_api** | **`{{classname}}`** | API context | {{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**`{{paramName}}`** | {{#isPrimitiveType}}**`{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**`{{dataType}}`**]({{baseType}}.md){{/isFile}}{{#isFile}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isFile}}{{/isPrimitiveType}} | {{description}} |{{/required}}{{/allParams}}{{#hasOptionalParams}}
### Optional Parameters
{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}{{^required}}
**{{paramName}}** | {{#isPrimitiveType}}**{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{#isFile}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^isBinary}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/isBinary}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
**`{{paramName}}`** | {{#isPrimitiveType}}**`{{#isBinary}}{{#isFile}}{{dataType}}{{/isFile}}{{^isFile}}Vector{UInt8}{{/isFile}}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**`{{dataType}}`**]({{baseType}}.md){{/isFile}}{{#isFile}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^isBinary}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/isBinary}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}
{{#returnType}}{{#returnTypeIsPrimitive}}**`{{{returnType}}}`**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**`{{{returnType}}}`**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}`Nothing`{{/returnType}}
### Authorization

View File

@@ -10,7 +10,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isDateTime}}**{{{dataType}}}**{{/isDateTime}}{{^isDateTime}}[**{{^isContainer}}*{{/isContainer}}{{{dataType}}}**]({{complexType}}.md){{/isDateTime}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{#vars}}**`{{name}}`** | {{#isPrimitiveType}}**`{{{dataType}}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isDateTime}}**`{{{dataType}}}`**{{/isDateTime}}{{^isDateTime}}[**`{{^isContainer}}*{{/isContainer}}{{{dataType}}}`**]({{complexType}}.md){{/isDateTime}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}
{{/anyOf}}{{/oneOf}}

View File

@@ -11,7 +11,7 @@ Method | HTTP request | Description
{{#operations}}
{{#operation}}
# **{{{operationId}}}**
> {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}
> `{{operationId}}`(req::`HTTP.Request`{{#allParams}}{{#required}}, `{{paramName}}`::`{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}`{{/required}}{{/allParams}};{{#allParams}}{{^required}} `{{paramName}}`=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}`{{returnType}}`{{/returnType}}{{^returnType}}`Nothing`{{/returnType}}
{{{summary}}}{{#notes}}
@@ -21,18 +21,18 @@ Method | HTTP request | Description
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**req** | **HTTP.Request** | The HTTP Request object | {{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**{{paramName}}** | {{#isPrimitiveType}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{#isFile}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{/required}}{{/allParams}}{{#hasOptionalParams}}
**req** | **`HTTP.Request`** | The HTTP Request object | {{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**`{{paramName}}`** | {{#isPrimitiveType}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**`{{dataType}}`**]({{baseType}}.md){{/isFile}}{{#isFile}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{/required}}{{/allParams}}{{#hasOptionalParams}}
### Optional Parameters
{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}{{^required}}
**{{paramName}}** | {{#isPrimitiveType}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{#isFile}}**{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}**{{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^isBinary}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/isBinary}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
**`{{paramName}}`** | {{#isPrimitiveType}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**`{{dataType}}`**]({{baseType}}.md){{/isFile}}{{#isFile}}**`{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}`**{{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^isBinary}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/isBinary}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}
{{#returnType}}{{#returnTypeIsPrimitive}}**`{{{returnType}}}`**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**`{{{returnType}}}`**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}`Nothing`{{/returnType}}
### Authorization

View File

@@ -10,7 +10,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isDateTime}}**{{{dataType}}}**{{/isDateTime}}{{^isDateTime}}[**{{^isContainer}}*{{/isContainer}}{{{dataType}}}**]({{complexType}}.md){{/isDateTime}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{#vars}}**`{{name}}`** | {{#isPrimitiveType}}**`{{{dataType}}}`**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isDateTime}}**`{{{dataType}}}`**{{/isDateTime}}{{^isDateTime}}[**`{{^isContainer}}*{{/isContainer}}{{{dataType}}}`**]({{complexType}}.md){{/isDateTime}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}
{{/anyOf}}{{/oneOf}}

View File

@@ -16,7 +16,7 @@
{{/kotlinx_serialization}}
{{/multiplatform}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#deprecated}}
@Deprecated(message = "This property is deprecated.")

View File

@@ -16,7 +16,7 @@
{{/kotlinx_serialization}}
{{/multiplatform}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{{.}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#deprecated}}
@Deprecated(message = "This property is deprecated.")

View File

@@ -1 +1 @@
{{^isFile}}{{{dataType}}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isArray}}Array<{{/isArray}}org.springframework.web.multipart.MultipartFile{{#isArray}}>{{/isArray}}{{#isNullable}}?{{/isNullable}}{{/isFile}}
{{^isFile}}{{{dataType}}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isArray}}Array<{{/isArray}}org.springframework.web.multipart.MultipartFile{{#isArray}}>{{/isArray}}{{^required}}?{{/required}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{/isFile}}

View File

@@ -115,6 +115,20 @@ class Configuration
*/
protected $tempFolderPath;
/**
* Path to a certificate file, for mTLS
*
* @var string
*/
protected $certFile;
/**
* Path to a key file, for mTLS
*
* @var string
*/
protected $keyFile;
/**
* Constructor
*/
@@ -388,6 +402,49 @@ class Configuration
return $this->tempFolderPath;
}
/**
* Sets the certificate file path, for mTLS
*
* @return $this
*/
public function setCertFile($certFile)
{
$this->certFile = $certFile;
return $this;
}
/**
* Gets the certificate file path, for mTLS
*
* @return string Certificate file path
*/
public function getCertFile()
{
return $this->certFile;
}
/**
* Sets the certificate key path, for mTLS
*
* @return $this
*/
public function setKeyFile($keyFile)
{
$this->keyFile = $keyFile;
return $this;
}
/**
* Gets the certificate key path, for mTLS
*
* @return string Certificate key path
*/
public function getKeyFile()
{
return $this->keyFile;
}
/**
* Gets the default configuration instance
*

View File

@@ -832,6 +832,14 @@ use {{invokerPackage}}\ObjectSerializer;
}
}
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options;
}

View File

@@ -7,7 +7,7 @@ chardet==4.0.0
click==7.1.2
dnspython==2.6.1
email-validator==2.0.0
fastapi==0.115.2
fastapi==0.120.1
graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
@@ -26,7 +26,7 @@ python-multipart==0.0.18
PyYAML>=5.4.1,<6.1.0
requests==2.32.4
Rx==1.6.1
starlette==0.40.0
starlette==0.49.1
typing-extensions==4.13.2
ujson==4.0.2
urllib3==2.5.0

View File

@@ -186,6 +186,8 @@ class Configuration:
:param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
{{#hasAuthMethods}}
:Example:
@@ -293,6 +295,8 @@ conf = {{{packageName}}}.Configuration(
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*,
debug: Optional[bool] = None,
) -> None:
@@ -381,10 +385,10 @@ conf = {{{packageName}}}.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes)
certificate data.
"""
self.cert_file = None
self.cert_file = cert_file
"""client certificate file
"""
self.key_file = None
self.key_file = key_file
"""client key file
"""
self.assert_hostname = None

View File

@@ -0,0 +1,81 @@
=begin
{{> api_info}}
=end
module {{moduleName}}
class ApiModelBase
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def self._deserialize(type, value)
case type.to_sym
when :Time
Time.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
# models (e.g. Pet) or oneOf
klass = {{moduleName}}.const_get(type)
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end

View File

@@ -24,61 +24,6 @@
new(transformed_hash)
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def self._deserialize(type, value)
case type.to_sym
when :Time
Time.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
# models (e.g. Pet) or oneOf
klass = {{moduleName}}.const_get(type)
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
@@ -94,21 +39,3 @@
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end

View File

@@ -6,6 +6,7 @@
# Common files
require '{{gemName}}/api_client'
require '{{gemName}}/api_error'
require '{{gemName}}/api_model_base'
require '{{gemName}}/version'
require '{{gemName}}/configuration'

View File

@@ -1,7 +1,7 @@
{{#description}}
# {{{.}}}
{{/description}}
class {{classname}}{{#parent}} < {{{.}}}{{/parent}}
class {{classname}}{{#parent}} < {{{.}}}{{/parent}}{{^parent}} < ApiModelBase{{/parent}}
{{#vars}}
{{#description}}
# {{{.}}}

View File

@@ -133,6 +133,17 @@ export class {{classname}} extends runtime.BaseAPI {
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isExplode}}
{{#isContainer}}
for (let key of Object.keys(requestParameters['{{paramName}}'])) {
queryParameters[key] = requestParameters['{{paramName}}'][key];
}
{{/isContainer}}
{{^isContainer}}
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isContainer}}
{{/isExplode}}
{{^isExplode}}
{{#isDateTimeType}}
queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString();
{{/isDateTimeType}}
@@ -144,6 +155,7 @@ export class {{classname}} extends runtime.BaseAPI {
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isDateType}}
{{/isDateTimeType}}
{{/isExplode}}
}
{{/isArray}}

View File

@@ -89,6 +89,13 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
}
}
{{/isNumeric}}
{{#isBoolean}}
if (Array.isArray(json)) {
if (json.every(item => typeof item === 'boolean'{{#isEnum}} && ({{#allowableValues}}{{#values}}item === {{.}}{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}})) {
return json;
}
}
{{/isBoolean}}
{{#isString}}
if (Array.isArray(json)) {
if (json.every(item => typeof item === 'string'{{#isEnum}} && ({{#allowableValues}}{{#values}}item === '{{.}}'{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}})) {
@@ -116,6 +123,11 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
return json;
}
{{/isNumeric}}
{{#isBoolean}}
if (typeof json === 'boolean'{{#isEnum}} && ({{#allowableValues}}{{#values}}json === {{.}}{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}}) {
return json;
}
{{/isBoolean}}
{{#isString}}
if (typeof json === 'string'{{#isEnum}} && ({{#allowableValues}}{{#values}}json === '{{.}}'{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}}) {
return json;
@@ -194,6 +206,13 @@ export function {{classname}}ToJSONTyped(value?: {{classname}} | null, ignoreDis
}
}
{{/isNumeric}}
{{#isBoolean}}
if (Array.isArray(value)) {
if (value.every(item => typeof item === 'boolean'{{#isEnum}} && ({{#allowableValues}}{{#values}}item === {{.}}{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}})) {
return value;
}
}
{{/isBoolean}}
{{#isString}}
if (Array.isArray(value)) {
if (value.every(item => typeof item === 'string'{{#isEnum}} && ({{#allowableValues}}{{#values}}item === '{{.}}'{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}})) {
@@ -219,6 +238,11 @@ export function {{classname}}ToJSONTyped(value?: {{classname}} | null, ignoreDis
return value;
}
{{/isNumeric}}
{{#isBoolean}}
if (typeof value === 'boolean'{{#isEnum}} && ({{#allowableValues}}{{#values}}value === {{.}}{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}}) {
return value;
}
{{/isBoolean}}
{{#isString}}
if (typeof value === 'string'{{#isEnum}} && ({{#allowableValues}}{{#values}}value === '{{.}}'{{^-last}} || {{/-last}}{{/values}}{{/allowableValues}}){{/isEnum}}) {
return value;

View File

@@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.security.SecurityScheme;
import org.openapitools.codegen.utils.ModelUtils;
import org.testng.annotations.Test;
import java.lang.reflect.Array;
import java.util.*;
import static org.testng.Assert.*;
@@ -36,6 +37,26 @@ public class OpenAPINormalizerTest {
private static final String X_PARENT = "x-parent";
private static final String X_INTERNAL = "x-internal";
@Test
public void testOpenAPINormalizerOtherThanObjectWithProperties()
{
// to test the rule REF_AS_PARENT_IN_ALLOF
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/issue_21680_array_with_properties.yaml");
Schema schema = openAPI.getComponents().getSchemas().get("errors");
assertNotNull(schema);
assertNotNull(schema.getProperties());
Map<String, String> options = new HashMap<>();
options.put("REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT", "true");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
Schema schema2 = openAPI.getComponents().getSchemas().get("errors");
assertNotNull(schema2);
assertNull(schema2.getProperties());
}
@Test
public void testOpenAPINormalizerRefAsParentInAllOf() {
// to test the rule REF_AS_PARENT_IN_ALLOF

View File

@@ -418,4 +418,24 @@ public class GoClientCodegenTest {
TestUtils.assertFileContains(Paths.get(output + "/model_pet.go"), "tags>tag");
}
@Test
public void testArrayDefaultValue() throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("go")
.setInputSpec("src/test/resources/3_1/issue_21077.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
files.forEach(File::deleteOnExit);
Path apiPath = Paths.get(output + "/api_default.go");
String defaultArrayString = "var defaultValue []interface{} = []interface{}{\"test1\", \"test2\", 1}";
String defaultValueString = "var defaultValue string = \"test3\"";
TestUtils.assertFileContains(apiPath, defaultArrayString);
TestUtils.assertFileContains(apiPath, defaultValueString);
}
}

View File

@@ -3490,6 +3490,40 @@ public class SpringCodegenTest {
.containsWithName("com.test.MyAnnotationInHeader");
}
@Test
public void testModelHasParameterExtraAnnotations_issue19953() {
Path output = TestUtils.newTempFolder();
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_18224.yaml");
final SpringCodegen codegen = new SpringCodegen();
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.toString());
codegen.additionalProperties().put(SpringCodegen.DATE_LIBRARY, "java8-localdatetime");
codegen.additionalProperties().put(INTERFACE_ONLY, "true");
codegen.additionalProperties().put(USE_RESPONSE_ENTITY, "false");
codegen.additionalProperties().put(DELEGATE_PATTERN, "true");
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "api_interface");
codegen.additionalProperties().put(SPRING_CONTROLLER, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGenerateMetadata(false); // skip metadata generation
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert javaFileAssert = JavaFileAssert.assertThat(files.get("ObjTest.java"));
javaFileAssert.assertProperty("field3")
.assertPropertyAnnotations()
.containsWithName("com.test.MyAnnotation")
.containsWithName("com.test.MyAnnotation2");
}
@Test
public void testHasOperationExtraAnnotation_issue15822() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();

View File

@@ -405,9 +405,9 @@ public class KotlinSpringServerCodegenTest {
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NullableMultipartfileArrayApiController.kt"),
"files: Array<org.springframework.web.multipart.MultipartFile>?)");
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NonNullableMultipartfileApiController.kt"),
"file: org.springframework.web.multipart.MultipartFile)");
"file: org.springframework.web.multipart.MultipartFile?)");
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NonNullableMultipartfileArrayApiController.kt"),
"files: Array<org.springframework.web.multipart.MultipartFile>)");
"files: Array<org.springframework.web.multipart.MultipartFile>?)");
}
@Test

View File

@@ -64,3 +64,6 @@ components:
field3:
type: string
pattern: "\\w"
x-field-extra-annotation:
- '@com.test.MyAnnotation'
- '@com.test.MyAnnotation2'

View File

@@ -0,0 +1,48 @@
---
# Corresponds to bug report 21680: https://github.com/openapitools/openapi-generator/issues/21680
openapi: 3.0.1
info:
title: API that has problem with OpenAPI Generator
version: 1.0.0
paths:
"/forbiddenaccesscsrf":
get:
summary: Forbidden access CSRF
operationId: forbiddenAccessCsrfGet
responses:
'403':
description: Expected response
content:
application/json:
schema:
"$ref": "#/components/schemas/errors"
components:
schemas:
error:
required:
- code
- horodatage
- message
type: object
properties:
code:
type: string
description: Short error description
message:
type: string
description: Complete human readable description
error_uri:
type: string
description: Detailed error description URI
format: uri
horodatage:
type: string
description: Date time of occurence
format: date-time
errors:
type: array
properties:
empty:
type: boolean
items:
"$ref": "#/components/schemas/error"

View File

@@ -0,0 +1,29 @@
openapi: 3.1.0
info:
title: Test
version: "1.0"
paths:
/a:
post:
summary: Test
requestBody:
content:
application/json:
schema:
type: string
parameters:
- name: "arrayparam"
in: query
schema:
type: array
default: ["test1", "test2", 1]
- name: "stringparam"
in: query
schema:
type: string
default: "test3"
responses:
200:
description: Ok

View File

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

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.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.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
<a id="frameworks-supported"></a>

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.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.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation

View File

@@ -4,10 +4,10 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to ["success","failure"]]
**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to ["failure","skipped"]]
**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to [1,3]]
**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to {"success", "failure"}]
**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to {"success", "failure"}]
**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to {"failure", "skipped"}]
**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to {1, 3}]
**ArrayString** | Pointer to **[]string** | | [optional]
**ArrayStringNullable** | Pointer to **[]string** | | [optional]
**ArrayStringExtensionNullable** | Pointer to **[]string** | | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | Pointer to **int64** | Query | [optional]
**Outcomes** | Pointer to **[]string** | | [optional] [default to ["SUCCESS","FAILURE"]]
**Outcomes** | Pointer to **[]string** | | [optional] [default to {"SUCCESS", "FAILURE"}]
## Methods

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.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.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation

View File

@@ -4,10 +4,10 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to ["success","failure"]]
**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to ["failure","skipped"]]
**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to [1,3]]
**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to {"success", "failure"}]
**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to {"success", "failure"}]
**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to {"failure", "skipped"}]
**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to {1, 3}]
**ArrayString** | Pointer to **[]string** | | [optional]
**ArrayStringNullable** | Pointer to **[]string** | | [optional]
**ArrayStringExtensionNullable** | Pointer to **[]string** | | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | Pointer to **int64** | Query | [optional]
**Outcomes** | Pointer to **[]string** | | [optional] [default to ["SUCCESS","FAILURE"]]
**Outcomes** | Pointer to **[]string** | | [optional] [default to {"SUCCESS", "FAILURE"}]
## Methods

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