Compare commits

...

14 Commits

Author SHA1 Message Date
William Cheng
5b720ded0c trigger build 2023-09-18 16:51:54 +08:00
William Cheng
875c3ecd3c 7.0.1 release (#16607)
* v7.0.1 release

* update readme

* update template

* update readme
2023-09-18 14:57:09 +08:00
Alex Kucksdorf
352182a7b9 fix(go-server): Allow optional request bodies (#16579)
* fix(go-server): Allow optional request bodies

Closes #16578

* chore: Run scripts

* chore: Remove unnecessary whitespace change

* fix: Use correct error
2023-09-18 13:59:28 +08:00
William Cheng
8c8be7482b Update java undertow to newer version (#16606)
* update java undertow to newer version

* update compiler plugin to newer version

* test undertow in circleci

* use 3.0 spec
2023-09-18 11:26:33 +08:00
Beppe Catanese
7d86adccc4 Add postman-collection generator to list (others) (#16599) 2023-09-18 10:38:22 +08:00
William Cheng
5f0d7053e4 Update go gin to newer version (#16593)
* update go gin to newer version

* update test
2023-09-15 15:50:25 +08:00
William Cheng
70bffffc5a remove option, update doc (#16592) 2023-09-15 15:01:21 +08:00
prashant-pant
4b87606665 Autoset constants (Required fields having single valid enum value) Java (OkHttp) Implementation of #16547 (#16550)
* Autosets the parameters with the only value specified as enum if the parameter is also marked as required

* Autosets the parameters with the only value specified as enum if the parameter is also marked as required

* Autosets the parameters with the only value specified as enum if the parameter is also marked as required for Java default client.

* Autosets the parameters with the only value specified as enum if the parameter is also marked as required for Java default client.

* Autosets the parameters with the only value specified as enum if the parameter is also marked as required for Java default client.

* Autosets the parameters with the only value specified as enum if the parameter is also marked as required for Java default client.
2023-09-15 14:41:17 +08:00
William Cheng
d671fe24ee better null check to avoid NPE (#16588) 2023-09-15 13:42:11 +08:00
Barczi
e75e5a2c57 [swift] remove unavailable property to fix Xcode 15 compiler error (#16504) 2023-09-14 11:36:01 +01:00
Kado Yasuyuki
ec59334904 Fix ValidateTask failure if recommend is not assigned (#16580)
* spec for recommend test

* add ValidateTask test for custom defined tasks

* add ValidateTask test for recommend option

* ValidateTask recommend default value is true
2023-09-14 13:33:06 +08:00
mol-pensiondk
82e3590eed Update AbstractCSharpCodegen.java (#16577)
Fixed a bug in postProcessAllModels, changing an anyOf to a oneOf.
2023-09-14 12:03:26 +08:00
Kado Yasuyuki
353507ef23 Java 11 (#16581) 2023-09-14 10:29:08 +08:00
William Cheng
9170e1030f fix enum in python flask (#16576) 2023-09-13 15:49:38 +08:00
70 changed files with 2184 additions and 773 deletions

View File

@@ -8,7 +8,7 @@
- [ ] Run the following to [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) and update samples:
```
./mvnw clean package
./bin/generate-samples.sh
./bin/generate-samples.sh ./bin/configs/*.yaml
./bin/utils/export_docs_generators.sh
```
Commit all changed files.
@@ -16,10 +16,5 @@
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`.
For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] In case you are adding a new generator, run the following additional script :
```
./bin/utils/ensure-up-to-date
```
Commit all changed files.
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (7.0.1 - patch release), `7.1.x` (minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (upcoming 7.1.0 minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.

View File

@@ -8,6 +8,7 @@ on:
- 'samples/server/petstore/java-vertx-web/**'
- 'samples/server/petstore/java-inflector/**'
- 'samples/server/petstore/java-pkmst/**'
# test in circleci instead
- 'samples/server/petstore/java-undertow/**'
pull_request:
paths:
@@ -15,7 +16,7 @@ on:
- 'samples/server/petstore/java-vertx-web/**'
- 'samples/server/petstore/java-inflector/**'
- 'samples/server/petstore/java-pkmst/**'
- 'samples/server/petstore/java-undertow/**'
#- 'samples/server/petstore/java-undertow/**'
jobs:
build:
name: Build Java Server
@@ -29,7 +30,7 @@ jobs:
- samples/server/petstore/java-vertx-web/
- samples/server/petstore/java-inflector/
- samples/server/petstore/java-pkmst/
- samples/server/petstore/java-undertow/
#- samples/server/petstore/java-undertow/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3

View File

@@ -1 +1 @@
1.8
11

View File

@@ -15,7 +15,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.0.1`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.1.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)
@@ -77,7 +77,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
## Table of contents
@@ -115,13 +115,13 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 7.0.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.0.1-SNAPSHOT/) | 08.09.2023 | Patch release (enhancements, bug fixes, etc) |
| [7.0.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.0.0) (latest stable release) | 25.08.2023 | Major release with breaking changes (no fallback) |
| 7.1.0 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.1.0-SNAPSHOT/) | 18.10.2023 | Minor release with breaking changes (with fallback) |
| [7.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.0.1) (latest stable release) | 18.09.2023 | Patch release (enhancements, bug fixes, etc) |
| [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) |
| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) |
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0, 3.1 (beta support)
(We do not publish daily/nightly build. Please use SNAPSHOT instead)
@@ -179,16 +179,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.0.0/openapi-generator-cli-7.0.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.1/openapi-generator-cli-7.0.1.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.0/openapi-generator-cli-7.0.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.1/openapi-generator-cli-7.0.1.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.0/openapi-generator-cli-7.0.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.0.1/openapi-generator-cli-7.0.1.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -423,7 +423,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 7.0.0
openapi-generator-cli version-manager set 7.0.1
```
Or install it as dev-dependency:
@@ -447,7 +447,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.0.0/openapi-generator-cli-7.0.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.0.1/openapi-generator-cli-7.0.1.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`
@@ -928,12 +928,9 @@ OpenAPI Generator core team members are contributors who have been making signif
* [@cbornet](https://github.com/cbornet) (2016/05)
* [@jmini](https://github.com/jmini) (2018/04) [:heart:](https://www.patreon.com/jmini)
* [@etherealjoy](https://github.com/etherealjoy) (2019/06)
* [@spacether](https://github.com/spacether) (2020/05) [:heart:][spacether sponsorship]
:heart: = Link to support the contributor directly
[spacether sponsorship]: https://github.com/sponsors/spacether/
#### Template Creator
**NOTE**: Embedded templates are only supported in _Mustache_ format. Support for all other formats is experimental and subject to change at any time.
@@ -1004,6 +1001,7 @@ Here is a list of template creators:
* PowerShell (refactored in 5.0.0): @wing328
* Python: @spacether [:heart:][spacether sponsorship]
* Python-Experimental: @spacether [:heart:][spacether sponsorship]
* Python (refactored in 7.0.0): @wing328
* R: @ramnov
* Ruby (Faraday): @meganemura @dkliban
* Rust: @farcaller
@@ -1262,3 +1260,4 @@ limitations under the License.
---

View File

@@ -1,6 +1,6 @@
generatorName: java-undertow-server
outputDir: samples/server/petstore/java-undertow
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/java-undertow-server
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,4 +1,4 @@
generatorName: python-flask
outputDir: samples/server/petstore/python-flask
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-flask/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/python-flask

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -33,12 +33,5 @@ open class OpenApiGeneratorValidateExtension(project: Project) {
/**
* Whether to offer recommendations related to the validated specification document.
*/
val recommend = project.objects.property<Boolean?>()
init {
applyDefaults()
}
@Suppress("MemberVisibilityCanBePrivate")
fun applyDefaults() = recommend.set(true)
val recommend = project.objects.property<Boolean>().convention(true)
}

View File

@@ -58,7 +58,7 @@ open class ValidateTask : DefaultTask() {
@Optional
@Input
val recommend = project.objects.property<Boolean?>()
val recommend = project.objects.property<Boolean>().convention(true)
@get:Internal
@set:Option(option = "input", description = "The input specification.")

View File

@@ -144,4 +144,161 @@ class ValidateTaskDslTest : TestBase() {
"Expected a failed run, but found ${result.task(":openApiValidate")?.outcome}"
)
}
@Test(dataProvider = "gradle_version_provider")
fun `validateGoodSpec as defined task should succeed on valid spec`(gradleVersion: String?) {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(
"""
| plugins {
| id 'org.openapi.generator'
| }
|
| task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask) {
| inputSpec.set(file("spec.yaml").absolutePath)
| }
""".trimMargin(), projectFiles
)
// Act
val result = getGradleRunner(gradleVersion)
.withProjectDir(temp)
.withArguments("validateGoodSpec")
.withPluginClasspath()
.build()
// Assert
assertTrue(
result.output.contains("Spec is valid."),
"Unexpected/no message presented to the user for a valid spec."
)
assertEquals(
SUCCESS, result.task(":validateGoodSpec")?.outcome,
"Expected a successful run, but found ${result.task(":validateGoodSpec")?.outcome}"
)
}
@Test(dataProvider = "gradle_version_provider")
fun `validateBadSpec as defined task should fail on invalid spec`(gradleVersion: String?) {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-invalid.yaml")
)
withProject(
"""
| plugins {
| id 'org.openapi.generator'
| }
|
| task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask) {
| inputSpec.set(file("spec.yaml").absolutePath)
| }
""".trimMargin(), projectFiles
)
// Act
val result = getGradleRunner(gradleVersion)
.withProjectDir(temp)
.withArguments("validateBadSpec")
.withPluginClasspath()
.buildAndFail()
// Assert
assertTrue(
result.output.contains("Spec is invalid."),
"Unexpected/no message presented to the user for an invalid spec."
)
assertEquals(
FAILED, result.task(":validateBadSpec")?.outcome,
"Expected a failed run, but found ${result.task(":validateBadSpec")?.outcome}"
)
}
@Test(dataProvider = "gradle_version_provider")
fun `openApiValidate should succeed with recommendations on valid spec`(gradleVersion: String?) {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-recommend.yaml")
)
// recommend = true is the default
withProject(
"""
| plugins {
| id 'org.openapi.generator'
| }
|
| openApiValidate {
| inputSpec = file("spec.yaml").absolutePath
| }
""".trimMargin(), projectFiles
)
// Act
val result = getGradleRunner(gradleVersion)
.withProjectDir(temp)
.withArguments("openApiValidate")
.withPluginClasspath()
.build()
// Assert
assertTrue(
result.output.contains("Spec is valid."),
"Unexpected/no message presented to the user for a valid spec."
)
assertTrue(
result.output.contains("Spec has issues or recommendations."),
"Unexpected/no recommendations message presented to the user for a valid spec."
)
assertEquals(
SUCCESS, result.task(":openApiValidate")?.outcome,
"Expected a successful run, but found ${result.task(":openApiValidate")?.outcome}"
)
}
@Test(dataProvider = "gradle_version_provider")
fun `openApiValidate should succeed without recommendations on valid spec`(gradleVersion: String?) {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-recommend.yaml")
)
withProject(
"""
| plugins {
| id 'org.openapi.generator'
| }
|
| openApiValidate {
| inputSpec = file("spec.yaml").absolutePath
| recommend = false
| }
""".trimMargin(), projectFiles
)
// Act
val result = getGradleRunner(gradleVersion)
.withProjectDir(temp)
.withArguments("openApiValidate")
.withPluginClasspath()
.build()
// Assert
assertTrue(
result.output.contains("Spec is valid."),
"Unexpected/no message presented to the user for a valid spec."
)
assertTrue(
result.output.contains("Spec has issues or recommendations.").not(),
"Unexpected/recommendations message presented to the user for a valid spec"
)
assertEquals(
SUCCESS, result.task(":openApiValidate")?.outcome,
"Expected a successful run, but found ${result.task(":openApiValidate")?.outcome}"
)
}
}

View File

@@ -0,0 +1,114 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
requestBody: # warning `API GET/HEAD defined with request body`
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
responses:
'200':
description: A paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create a pet
operationId: createPets
tags:
- pets
responses:
'201':
description: Null response
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/pets/{petId}:
get:
summary: Info for a specific pet
operationId: showPetById
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.1-SNAPSHOT</version>
<version>7.0.1</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.0.1-SNAPSHOT</version>
<version>7.0.1</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.0.1-SNAPSHOT</version>
<version>7.0.1</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.0.1-SNAPSHOT</version>
<version>7.0.1</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.0.1-SNAPSHOT</version>
<version>7.0.1</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.0.1-SNAPSHOT</version>
<version>7.0.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@ public class CodegenOperation {
hasVersionHeaders = false, hasVersionQueryParams = false,
isResponseBinary = false, isResponseFile = false, isResponseOptional = false, hasReference = false, defaultReturnType = false,
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false, hasConstantParams = false,
hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined
public CodegenProperty returnProperty;
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
@@ -45,6 +45,7 @@ public class CodegenOperation {
public List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> implicitHeadersParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> constantParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
@@ -392,6 +393,7 @@ public class CodegenOperation {
sb.append(", operationIdLowerCase='").append(operationIdLowerCase).append('\'');
sb.append(", operationIdCamelCase='").append(operationIdCamelCase).append('\'');
sb.append(", operationIdSnakeCase='").append(operationIdSnakeCase).append('\'');
sb.append(", constantParams='").append(constantParams).append('\'');
sb.append('}');
return sb.toString();
}
@@ -472,7 +474,8 @@ public class CodegenOperation {
Objects.equals(operationIdOriginal, that.operationIdOriginal) &&
Objects.equals(operationIdLowerCase, that.operationIdLowerCase) &&
Objects.equals(operationIdCamelCase, that.operationIdCamelCase) &&
Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase);
Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase) &&
Objects.equals(constantParams, that.constantParams);
}
@Override
@@ -488,6 +491,6 @@ public class CodegenOperation {
pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams,
authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs,
vendorExtensions, nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase,
operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams);
operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams, constantParams);
}
}

View File

@@ -478,6 +478,11 @@ public class DefaultCodegen implements CodegenConfig {
for (Map.Entry<String, ModelsMap> entry : objs.entrySet()) {
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), objs);
if (model == null) {
LOGGER.warn("Null model found in postProcessAllModels: {}", entry.getKey());
continue;
}
// add the model to the discriminator's mapping so templates have access to more than just the string to string mapping
if (model.discriminator != null && model.discriminator.getMappedModels() != null) {
for (CodegenDiscriminator.MappedModel mappedModel : model.discriminator.getMappedModels()) {
@@ -5977,6 +5982,10 @@ public class DefaultCodegen implements CodegenConfig {
}
private static Boolean isAliasOfSimpleTypes(Schema schema) {
if (schema == null) {
return false;
}
return (!ModelUtils.isObjectSchema(schema)
&& !ModelUtils.isArraySchema(schema)
&& !ModelUtils.isMapSchema(schema)

View File

@@ -1334,8 +1334,10 @@ public class DefaultGenerator implements Generator {
for (Map.Entry<String, Schema> definitionsEntry : definitions.entrySet()) {
String key = definitionsEntry.getKey();
Schema schema = definitionsEntry.getValue();
if (schema == null)
throw new RuntimeException("schema cannot be null in processModels");
if (schema == null) {
LOGGER.warn("Schema {} cannot be null in processModels", key);
continue;
}
CodegenModel cm = config.fromModel(key, schema);
ModelMap mo = new ModelMap();
mo.setModel(cm);

View File

@@ -286,6 +286,11 @@ public class InlineModelResolver {
if (props != null) {
for (String propName : props.keySet()) {
Schema prop = props.get(propName);
if (prop == null) {
continue;
}
String schemaName = resolveModelName(prop.getTitle(), modelPrefix + "_" + propName);
// Recurse to create $refs for inner models
gatherInlineModels(prop, schemaName);
@@ -308,13 +313,15 @@ public class InlineModelResolver {
if (schema.getAdditionalProperties() != null) {
if (schema.getAdditionalProperties() instanceof Schema) {
Schema inner = (Schema) schema.getAdditionalProperties();
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
// Recurse to create $refs for inner models
gatherInlineModels(inner, schemaName);
if (isModelNeeded(inner)) {
// If this schema should be split into its own model, do so
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
schema.setAdditionalProperties(refSchema);
if (inner != null) {
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
// Recurse to create $refs for inner models
gatherInlineModels(inner, schemaName);
if (isModelNeeded(inner)) {
// If this schema should be split into its own model, do so
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
schema.setAdditionalProperties(refSchema);
}
}
}
}
@@ -334,10 +341,6 @@ public class InlineModelResolver {
if (schema instanceof ArraySchema) {
ArraySchema array = (ArraySchema) schema;
Schema items = array.getItems();
/*if (items.getTitle() != null) {
LOGGER.info("schema title {}", items);
throw new RuntimeException("getTitle for array item is not null");
}*/
if (items == null) {
LOGGER.error("Illegal schema found with array type but no items," +
" items must be defined for array schemas:\n " + schema.toString());
@@ -360,6 +363,9 @@ public class InlineModelResolver {
List<Schema> newAllOf = new ArrayList<Schema>();
boolean atLeastOneModel = false;
for (Object inner : schema.getAllOf()) {
if (inner == null) {
continue;
}
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_allOf");
// Recurse to create $refs for inner models
gatherInlineModels((Schema) inner, schemaName);
@@ -392,6 +398,9 @@ public class InlineModelResolver {
if (schema.getAnyOf() != null) {
List<Schema> newAnyOf = new ArrayList<Schema>();
for (Object inner : schema.getAnyOf()) {
if (inner == null) {
continue;
}
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_anyOf");
// Recurse to create $refs for inner models
gatherInlineModels((Schema) inner, schemaName);
@@ -407,6 +416,9 @@ public class InlineModelResolver {
if (schema.getOneOf() != null) {
List<Schema> newOneOf = new ArrayList<Schema>();
for (Object inner : schema.getOneOf()) {
if (inner == null) {
continue;
}
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_oneOf");
// Recurse to create $refs for inner models
gatherInlineModels((Schema) inner, schemaName);
@@ -423,12 +435,14 @@ public class InlineModelResolver {
// Check not schema
if (schema.getNot() != null) {
Schema not = schema.getNot();
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_not");
// Recurse to create $refs for inner models
gatherInlineModels(not, schemaName);
if (isModelNeeded(not)) {
Schema refSchema = this.makeSchemaInComponents(schemaName, not);
schema.setNot(refSchema);
if (not != null) {
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_not");
// Recurse to create $refs for inner models
gatherInlineModels(not, schemaName);
if (isModelNeeded(not)) {
Schema refSchema = this.makeSchemaInComponents(schemaName, not);
schema.setNot(refSchema);
}
}
}
}
@@ -629,6 +643,9 @@ public class InlineModelResolver {
List<String> modelNames = new ArrayList<String>(models.keySet());
for (String modelName : modelNames) {
Schema model = models.get(modelName);
if (model == null) {
continue;
}
if (ModelUtils.isAnyOf(model)) { // contains anyOf only
gatherInlineModels(model, modelName);
} else if (ModelUtils.isOneOf(model)) { // contains oneOf only

View File

@@ -527,7 +527,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// GrandparentAnimal has a discriminator, but no oneOf nor anyOf
// modules\openapi-generator\src\test\resources\3_0\csharp\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
model.setHasDiscriminatorWithNonEmptyMapping(
((model.anyOf != null && model.anyOf.size() > 0) || (model.anyOf != null && model.oneOf.size() > 0)) &&
((model.anyOf != null && model.anyOf.size() > 0) || (model.oneOf != null && model.oneOf.size() > 0)) &&
model.discriminator != null &&
model.discriminator.getMappedModels() != null &&
model.discriminator.getMappedModels().size() > 0);

View File

@@ -83,6 +83,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String TEST_OUTPUT = "testOutput";
public static final String IMPLICIT_HEADERS = "implicitHeaders";
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
public static final String AUTOSET_CONSTANTS = "autosetConstants";
public static final String JAVAX_PACKAGE = "javaxPackage";
public static final String USE_JAKARTA_EE = "useJakartaEe";
public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull";
@@ -137,6 +138,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected AnnotationLibrary annotationLibrary;
protected boolean implicitHeaders = false;
protected String implicitHeadersRegex = null;
protected boolean autosetConstants = false;
protected boolean camelCaseDollarSign = false;
protected boolean useJakartaEe = false;
protected boolean containerDefaultToNull = false;
@@ -563,6 +565,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.setImplicitHeadersRegex(additionalProperties.get(IMPLICIT_HEADERS_REGEX).toString());
}
if (additionalProperties.containsKey(AUTOSET_CONSTANTS)) {
this.setAutosetConstants(Boolean.parseBoolean(additionalProperties.get(AUTOSET_CONSTANTS).toString()));
}
if (additionalProperties.containsKey(CAMEL_CASE_DOLLAR_SIGN)) {
this.setCamelCaseDollarSign(Boolean.parseBoolean(additionalProperties.get(CAMEL_CASE_DOLLAR_SIGN).toString()));
}
@@ -1578,6 +1584,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
op.vendorExtensions.put("x-java-import", operationImports);
handleImplicitHeaders(op);
handleConstantParams(op);
}
return objs;
@@ -2052,6 +2059,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.implicitHeadersRegex = implicitHeadersRegex;
}
public void setAutosetConstants(boolean autosetConstants) {
this.autosetConstants = autosetConstants;
}
public void setCamelCaseDollarSign(boolean camelCaseDollarSign) {
this.camelCaseDollarSign = camelCaseDollarSign;
}
@@ -2294,6 +2305,45 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
operation.hasParams = !operation.allParams.isEmpty();
}
/**
* This method removes all constant Query, Header and Cookie Params from allParams and sets them as constantParams in the CodegenOperation.
* The definition of constant is single valued required enum params.
* The constantParams in the the generated code should be hardcoded to the constantValue if autosetConstants feature is enabled.
*
* @param operation - operation to be processed
*/
protected void handleConstantParams(CodegenOperation operation) {
if (!autosetConstants || operation.allParams.isEmpty()) {
return;
}
final ArrayList<CodegenParameter> copy = new ArrayList<>(operation.allParams);
// Remove all params from Params, Non constant params will be added back later.
operation.allParams.clear();
// Finds all constant params, removes them from allParams and adds them to constant params.
// Also, adds back non constant params to allParams.
for (CodegenParameter p : copy) {
if (p.isEnum && p.required && p._enum != null && p._enum.size() == 1) {
// Add to constantParams for use in the code generation templates.
operation.constantParams.add(p);
if(p.isQueryParam) {
operation.queryParams.removeIf(param -> param.baseName.equals(p.baseName));
}
if(p.isHeaderParam) {
operation.headerParams.removeIf(param -> param.baseName.equals(p.baseName));
}
if(p.isCookieParam) {
operation.cookieParams.removeIf(param -> param.baseName.equals(p.baseName));
}
LOGGER.info("Update operation [{}]. Remove parameter [{}] because it can only have a fixed value of [{}]", operation.operationId, p.baseName, p._enum.get(0));
} else {
// Add back to allParams as the param is not a constant.
operation.allParams.add(p);
}
}
operation.hasParams = !operation.allParams.isEmpty();
}
private boolean shouldBeImplicitHeader(CodegenParameter parameter) {
return StringUtils.isNotBlank(implicitHeadersRegex) && parameter.baseName.matches(implicitHeadersRegex);
}

View File

@@ -1981,4 +1981,17 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
public String toEnumDefaultValue(String value, String datatype) {
return value;
}
/**
* checks if the data should be classified as "string" in enum
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
* In the future, we may rename this function to "isEnumString"
*
* @param dataType data type
* @return true if it's a enum string
*/
@Override
public boolean isDataTypeString(String dataType) {
return "str".equals(dataType);
}
}

View File

@@ -16,17 +16,9 @@
package org.openapitools.codegen.languages;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
@@ -69,6 +61,8 @@ import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.security.SecurityScheme;
import static org.openapitools.codegen.utils.StringUtils.*;
public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig {
private static class PythonBooleanSerializer extends JsonSerializer<Boolean> {
@Override
@@ -178,7 +172,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
cliOptions.add(new CliOption(USE_PYTHON_SRC_ROOT_IN_IMPORTS, "include pythonSrcRoot in import namespaces.").
defaultValue("false"));
cliOptions.add(new CliOption(MOVE_TESTS_UNDER_PYTHON_SRC_ROOT, "generates test under the pythonSrcRoot folder.")
.defaultValue("false"));
.defaultValue("false"));
}
protected void addSupportingFiles() {
@@ -333,7 +327,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
}
@Override
public String toApiTestFilename(String name) {
return "test_" + toApiFilename(name);
@@ -636,12 +629,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
postProcessPattern(property.pattern, property.vendorExtensions);
}
@Override
public ModelsMap postProcessModels(ModelsMap objs) {
// process enum in models
return postProcessModelsEnum(objs);
}
@Override
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
Map<String, ModelsMap> result = super.postProcessAllModels(objs);

View File

@@ -464,20 +464,6 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
}
}
/**
* checks if the data should be classified as "string" in enum
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
* In the future, we may rename this function to "isEnumString"
*
* @param dataType data type
* @return true if it's a enum string
*/
@Override
public boolean isDataTypeString(String dataType) {
return "str".equals(dataType);
}
@Override
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {

View File

@@ -438,6 +438,10 @@ public class ModelUtils {
* @return true if the specified schema is an Object schema.
*/
public static boolean isObjectSchema(Schema schema) {
if (schema == null) {
return false;
}
return (schema instanceof ObjectSchema) ||
// must not be a map
(SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType()) && !(schema instanceof MapSchema)) ||
@@ -549,6 +553,10 @@ public class ModelUtils {
* @return true if the specified schema is a Map schema.
*/
public static boolean isMapSchema(Schema schema) {
if (schema == null) {
return false;
}
// additionalProperties explicitly set to false
if (schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) {
return false;
@@ -1858,6 +1866,10 @@ public class ModelUtils {
* @return true if the schema contains oneOf but no properties/allOf/anyOf defined.
*/
public static boolean isOneOf(Schema schema) {
if (schema == null) {
return false;
}
if (hasOneOf(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty()) &&
(schema.getAllOf() == null || schema.getAllOf().isEmpty()) &&
(schema.getAnyOf() == null || schema.getAnyOf().isEmpty())) {
@@ -1875,7 +1887,7 @@ public class ModelUtils {
* @return true if allOf is not empty
*/
public static boolean hasOneOf(Schema schema) {
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
if (schema != null && schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
return true;
}
@@ -1890,6 +1902,10 @@ public class ModelUtils {
* @return true if the schema contains oneOf but no properties/allOf/anyOf defined.
*/
public static boolean isAnyOf(Schema schema) {
if (schema == null) {
return false;
}
if (hasAnyOf(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty()) &&
(schema.getAllOf() == null || schema.getAllOf().isEmpty()) &&
(schema.getOneOf() == null || schema.getOneOf().isEmpty())) {
@@ -1907,7 +1923,7 @@ public class ModelUtils {
* @return true if anyOf is not empty
*/
public static boolean hasAnyOf(Schema schema) {
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
if (schema != null && schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
return true;
}

View File

@@ -172,18 +172,39 @@ public class {{classname}} {
}
{{/queryParams}}
{{#constantParams}}
{{#isQueryParam}}
// Set client side default value of Query Param "{{baseName}}".
localVarCollectionQueryParams.add(new Pair("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}));
{{/isQueryParam}}
{{/constantParams}}
{{#headerParams}}
if ({{paramName}} != null) {
localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
}
{{/headerParams}}
{{#constantParams}}
{{#isHeaderParam}}
// Set client side default value of Header Param "{{baseName}}".
localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}});
{{/isHeaderParam}}
{{/constantParams}}
{{#cookieParams}}
if ({{paramName}} != null) {
localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
}
{{/cookieParams}}
{{#constantParams}}
{{#isCookieParam}}
// Set client side default value of Cookie Param "{{baseName}}".
localVarCookieParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}});
{{/isCookieParam}}
{{/constantParams}}
{{/dynamicOperations}}
{{#dynamicOperations}}
localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams);

View File

@@ -2,30 +2,31 @@ module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}
go 1.19
require github.com/gin-gonic/gin v1.9.0
require github.com/gin-gonic/gin v1.9.1
require (
github.com/bytedance/sonic v1.8.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@@ -3,6 +3,12 @@ package {{packageName}}
import (
"encoding/json"
{{#isBodyParam}}
{{^required}}
"errors"
"io"
{{/required}}
{{/isBodyParam}}
"net/http"
"strings"
@@ -403,7 +409,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
{{^isAdditionalPropertiesTrue}}
d.DisallowUnknownFields()
{{/isAdditionalPropertiesTrue}}
if err := d.Decode(&{{paramName}}Param); err != nil {
if err := d.Decode(&{{paramName}}Param); err != nil {{^required}}&& !errors.Is(err, io.EOF) {{/required}}{
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
return
}

View File

@@ -29,7 +29,7 @@
<version.logback>1.2.0</version.logback>
<version.junit>4.13.2</version.junit>
<version.mockito>2.1.0-beta.124</version.mockito>
<version.undertow>2.2.24.Final</version.undertow>
<version.undertow>2.3.5.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

@@ -29,7 +29,7 @@ class {{classname}}(Model):
allowed enum values
"""
{{#enumVars}}
{{name}} = {{{value}}}{{^-last}}
{{{name}}} = {{{value}}}{{^-last}}
{{/-last}}
{{/enumVars}}
{{/allowableValues}}

View File

@@ -46,15 +46,6 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
*/
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var taskDidReceiveChallenge: {{projectName}}APIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -56,7 +56,7 @@ public class GoGinServerCodegenTest {
TestUtils.assertFileContains(Paths.get(output + "/go.mod"),
"module github.com/my-user/my-repo");
TestUtils.assertFileContains(Paths.get(output + "/go.mod"),
"require github.com/gin-gonic/gin v1.9.0");
"require github.com/gin-gonic/gin v1.9.1");
}
}

View File

@@ -0,0 +1,703 @@
swagger: '2.0'
info:
description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.'
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
host: petstore.swagger.io
basePath: /v2
tags:
- name: pet
description: Everything about your Pets
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
schemes:
- http
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
consumes:
- application/json
- application/xml
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
consumes:
- application/json
- application/xml
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
produces:
- application/xml
- application/json
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
collectionFormat: csv
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Pet'
'400':
description: Invalid status value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/pet/findByTags:
get:
tags:
- pet
summary: Finds Pets by tags
description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.'
operationId: findPetsByTags
produces:
- application/xml
- application/json
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
type: array
items:
type: string
collectionFormat: csv
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Pet'
'400':
description: Invalid tag value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
deprecated: true
'/pet/{petId}':
get:
tags:
- pet
summary: Find pet by ID
description: Returns a single pet
operationId: getPetById
produces:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
security:
- api_key: []
post:
tags:
- pet
summary: Updates a pet in the store with form data
description: ''
operationId: updatePetWithForm
consumes:
- application/x-www-form-urlencoded
produces:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
type: integer
format: int64
- name: name
in: formData
description: Updated name of the pet
required: false
type: string
- name: status
in: formData
description: Updated status of the pet
required: false
type: string
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
delete:
tags:
- pet
summary: Deletes a pet
description: ''
operationId: deletePet
produces:
- application/xml
- application/json
parameters:
- name: api_key
in: header
required: false
type: string
- name: petId
in: path
description: Pet id to delete
required: true
type: integer
format: int64
responses:
'400':
description: Invalid pet value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
'/pet/{petId}/uploadImage':
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: additionalMetadata
in: formData
description: Additional data to pass to server
required: false
type: string
- name: file
in: formData
description: file to upload
required: false
type: file
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/store/inventory:
get:
tags:
- store
summary: Returns pet inventories by status
description: Returns a map of status codes to quantities
operationId: getInventory
produces:
- application/json
parameters: []
responses:
'200':
description: successful operation
schema:
type: object
additionalProperties:
type: integer
format: int32
security:
- api_key: []
/store/order:
post:
tags:
- store
summary: Place an order for a pet
description: ''
operationId: placeOrder
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: order placed for purchasing the pet
required: true
schema:
$ref: '#/definitions/Order'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Order'
'400':
description: Invalid Order
'/store/order/{orderId}':
get:
tags:
- store
summary: Find purchase order by ID
description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions'
operationId: getOrderById
produces:
- application/xml
- application/json
parameters:
- name: orderId
in: path
description: ID of pet that needs to be fetched
required: true
type: integer
maximum: 5
minimum: 1
format: int64
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
delete:
tags:
- store
summary: Delete purchase order by ID
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
operationId: deleteOrder
produces:
- application/xml
- application/json
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
type: string
responses:
'400':
description: Invalid ID supplied
'404':
description: Order not found
/user:
post:
tags:
- user
summary: Create user
description: This can only be done by the logged in user.
operationId: createUser
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Created user object
required: true
schema:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
/user/createWithArray:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithArrayInput
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: List of user object
required: true
schema:
type: array
items:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
/user/createWithList:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithListInput
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: List of user object
required: true
schema:
type: array
items:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
/user/login:
get:
tags:
- user
summary: Logs user into the system
description: ''
operationId: loginUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: query
description: The user name for login
required: true
type: string
- name: password
in: query
description: The password for login in clear text
required: true
type: string
responses:
'200':
description: successful operation
schema:
type: string
headers:
X-Rate-Limit:
type: integer
format: int32
description: calls per hour allowed by the user
X-Expires-After:
type: string
format: date-time
description: date in UTC when token expires
'400':
description: Invalid username/password supplied
/user/logout:
get:
tags:
- user
summary: Logs out current logged in user session
description: ''
operationId: logoutUser
produces:
- application/xml
- application/json
parameters: []
responses:
default:
description: successful operation
'/user/{username}':
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: getUserByName
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing.'
required: true
type: string
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/User'
'400':
description: Invalid username supplied
'404':
description: User not found
put:
tags:
- user
summary: Updated user
description: This can only be done by the logged in user.
operationId: updateUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: name that need to be deleted
required: true
type: string
- in: body
name: body
description: Updated user object
required: true
schema:
$ref: '#/definitions/User'
responses:
'400':
description: Invalid user supplied
'404':
description: User not found
delete:
tags:
- user
summary: Delete user
description: This can only be done by the logged in user.
operationId: deleteUser
produces:
- application/xml
- application/json
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
type: string
responses:
'400':
description: Invalid username supplied
'404':
description: User not found
securityDefinitions:
petstore_auth:
type: oauth2
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
flow: implicit
scopes:
'write:pets': modify pets in your account
'read:pets': read your pets
api_key:
type: apiKey
name: api_key
in: header
definitions:
Order:
title: Pet Order
description: An order for a pets from the pet store
type: object
properties:
id:
type: integer
format: int64
petId:
type: integer
format: int64
quantity:
type: integer
format: int32
shipDate:
type: string
format: date-time
status:
type: string
description: Order Status
enum:
- placed
- approved
- delivered
complete:
type: boolean
default: false
xml:
name: Order
Category:
title: Pet category
description: A category for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Category
User:
title: a User
description: A User who is purchasing from the pet store
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
format: int32
description: User Status
xml:
name: User
Tag:
title: Pet Tag
description: A tag for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
Pet:
title: a Pet
description: A pet for sale in the pet store
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
category:
$ref: '#/definitions/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
tags:
type: array
xml:
name: tag
wrapped: true
items:
$ref: '#/definitions/Tag'
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: Pet
ApiResponse:
title: An uploaded response
description: Describes the result of uploading an image resource
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
EnumModel:
enum:
- available>
- pending<
- sold
- 1
- 2
type: string

View File

@@ -0,0 +1,42 @@
openapi: 3.0.3
info:
title: Example Hello API
description: ''
version: v1
servers:
- url: http://localhost
description: Global Endpoint
paths:
/v1/hello/{name}:
get:
tags:
- hello_example
operationId: Hello
description: Say Hello
parameters:
- name: X-CUSTOM_CONSTANT_HEADER
in: header
required: true
schema:
type: string
enum:
- CONSTANT_VALUE
- name: name
in: path
required: true
schema:
type: string
responses:
default:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/HelloResponse'
components:
schemas:
HelloResponse:
type: object
properties:
message:
type: string

View File

@@ -13,7 +13,7 @@
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<!-- RELEASE_VERSION -->
<version>7.0.1-SNAPSHOT</version>
<version>7.0.1</version>
<!-- /RELEASE_VERSION -->
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
@@ -1290,6 +1290,8 @@
<module>samples/client/petstore/java/resteasy</module>
<module>samples/client/petstore/java-micronaut-client</module>
<module>samples/client/petstore/java/apache-httpclient</module>
<!-- server -->
<module>samples/server/petstore/java-undertow</module>
</modules>
</profile>
<!-- test with Haskell -->

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
internal var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
internal var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required internal init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -46,15 +46,6 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
*/
public var taskDidReceiveChallenge: PetstoreClientAPIChallengeHandler?
/**
May be assigned if you want to do any of those things:
- control the task completion
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
}

View File

@@ -2,30 +2,31 @@ module github.com/GIT_USER_ID/GIT_REPO_ID
go 1.19
require github.com/gin-gonic/gin v1.9.0
require github.com/gin-gonic/gin v1.9.1
require (
github.com/bytedance/sonic v1.8.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@@ -135,7 +135,7 @@
<version.framework>0.1.1</version.framework>
<version.jackson>2.14.1</version.jackson>
<version.httpasyncclient>4.1.2</version.httpasyncclient>
<version.undertow>2.2.24.Final</version.undertow>
<version.undertow>2.3.5.Final</version.undertow>
<version.slf4j>1.7.21</version.slf4j>
<version.jackson.databind>2.14.1</version.jackson.databind>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@@ -29,7 +29,7 @@
<version.logback>1.2.0</version.logback>
<version.junit>4.13.2</version.junit>
<version.mockito>2.1.0-beta.124</version.mockito>
<version.undertow>2.2.24.Final</version.undertow>
<version.undertow>2.3.5.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

@@ -21,6 +21,8 @@ public interface PathHandlerInterface {
/**
* <p>Add a new pet to the store</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -30,9 +32,12 @@ public interface PathHandlerInterface {
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}, {isXml=true, mediaType=application/xml}]</p>
* <p><b>Payload</b>: {@link Pet} (<i>required: true</i>)</p>
*
* <p><b>Produces</b>: [{isXml=true, mediaType=application/xml}, {isJson=true, mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Pet}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>405 (client error)</b>: Invalid input</li>
* </ul>
*/
@@ -42,6 +47,8 @@ public interface PathHandlerInterface {
/**
* <p>Deletes a pet</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/pet/{petId}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -175,6 +182,8 @@ public interface PathHandlerInterface {
/**
* <p>Update an existing pet</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#PUT PUT} "/v2/pet" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -184,9 +193,12 @@ public interface PathHandlerInterface {
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}, {isXml=true, mediaType=application/xml}]</p>
* <p><b>Payload</b>: {@link Pet} (<i>required: true</i>)</p>
*
* <p><b>Produces</b>: [{isXml=true, mediaType=application/xml}, {isJson=true, mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Pet}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid ID supplied</li>
* <li><b>404 (client error)</b>: Pet not found</li>
* <li><b>405 (client error)</b>: Validation exception</li>
@@ -198,6 +210,8 @@ public interface PathHandlerInterface {
/**
* <p>Updates a pet in the store with form data</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet/{petId}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -245,6 +259,8 @@ public interface PathHandlerInterface {
/**
* <p>uploads an image</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet/{petId}/uploadImage" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -375,12 +391,17 @@ public interface PathHandlerInterface {
/**
* <p>Place an order for a pet</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/store/order" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}]</p>
* <p><b>Payload</b>: {@link Order} (<i>required: true</i>)</p>
*
* <p><b>Produces</b>: [{isXml=true, mediaType=application/xml}, {isJson=true, mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Order}</p>
*
@@ -398,12 +419,15 @@ public interface PathHandlerInterface {
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user" (<i>privileged: false</i>)</p>
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}]</p>
* <p><b>Payload</b>: {@link User} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
@@ -416,12 +440,17 @@ public interface PathHandlerInterface {
/**
* <p>Creates list of users with given input array</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithArray" (<i>privileged: false</i>)</p>
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithArray" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}]</p>
* <p><b>Payload</b>: {@link java.util.List List} of {@link User} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
@@ -434,12 +463,17 @@ public interface PathHandlerInterface {
/**
* <p>Creates list of users with given input array</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithList" (<i>privileged: false</i>)</p>
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithList" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}]</p>
* <p><b>Payload</b>: {@link java.util.List List} of {@link User} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
@@ -454,7 +488,7 @@ public interface PathHandlerInterface {
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/user/{username}" (<i>privileged: false</i>)</p>
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/user/{username}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
@@ -482,6 +516,8 @@ public interface PathHandlerInterface {
/**
* <p>Get user by user name</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/{username}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -513,6 +549,8 @@ public interface PathHandlerInterface {
/**
* <p>Logs user into the system</p>
*
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/login" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
@@ -536,7 +574,10 @@ public interface PathHandlerInterface {
* </p>
* </li>
* </ul>
* <p><b>Response headers</b>: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', containerTypeMapped='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
* <p><b>Response headers</b>: [CodegenProperty{openApiType='string', baseName='Set-Cookie', complexType='null', getter='getSetCookie', setter='setSetCookie', description='Cookie authentication key for use with the `api_key` apiKey authentication.', dataType='String', datatypeWithEnum='String', dataFormat='null', name='setCookie', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.Set-Cookie;', baseType='String', containerType='null', containerTypeMapped='null', title='null', unescapedDescription='Cookie authentication key for use with the `api_key` apiKey authentication.', maxLength=null, minLength=null, pattern='null', example='AUTH_KEY=abcde12345; Path=/; HttpOnly', jsonSchema='{
"type" : "string",
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=true, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isPassword=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isInnerEnum=false, isEnumRef=false, isAnyType=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, isNew=false, isOverridden=null, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='SetCookie', nameInSnakeCase='SET_COOKIE', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, uniqueItemsBoolean=null, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, isVoid=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false, requiredVarsMap=null, ref=null, schemaIsFromAdditionalProperties=false, isBooleanSchemaTrue=false, isBooleanSchemaFalse=false, format=null, dependentRequired=null, contains=null}, CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', containerTypeMapped='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "integer",
"format" : "int32"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isPassword=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isInnerEnum=false, isEnumRef=false, isAnyType=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, isNew=false, isOverridden=null, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, uniqueItemsBoolean=null, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, isVoid=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false, requiredVarsMap=null, ref=null, schemaIsFromAdditionalProperties=false, isBooleanSchemaTrue=false, isBooleanSchemaFalse=false, format=int32, dependentRequired=null, contains=null}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', containerTypeMapped='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
@@ -559,7 +600,9 @@ public interface PathHandlerInterface {
/**
* <p>Logs out current logged in user session</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/logout" (<i>privileged: false</i>)</p>
* <p></p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/logout" (<i>privileged: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
@@ -575,7 +618,7 @@ public interface PathHandlerInterface {
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#PUT PUT} "/v2/user/{username}" (<i>privileged: false</i>)</p>
* <p><b>Endpoint</b>: {@link Methods#PUT PUT} "/v2/user/{username}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
@@ -590,6 +633,9 @@ public interface PathHandlerInterface {
* </li>
* </ul>
*
* <p><b>Consumes</b>: [{isJson=true, mediaType=application/json}]</p>
* <p><b>Payload</b>: {@link User} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>

View File

@@ -1,5 +1,5 @@
{
"openapi" : "3.0.1",
"openapi" : "3.0.0",
"info" : {
"description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
"license" : {
@@ -9,6 +9,10 @@
"title" : "OpenAPI Petstore",
"version" : "1.0.0"
},
"externalDocs" : {
"description" : "Find out more about Swagger",
"url" : "http://swagger.io"
},
"servers" : [ {
"url" : "http://petstore.swagger.io/v2"
} ],
@@ -25,26 +29,28 @@
"paths" : {
"/pet" : {
"post" : {
"description" : "",
"operationId" : "addPet",
"requestBody" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
},
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
}
},
"description" : "Pet object that needs to be added to the store",
"required" : true
"$ref" : "#/components/requestBodies/Pet"
},
"responses" : {
"200" : {
"content" : {
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
},
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
}
},
"description" : "successful operation"
},
"405" : {
"content" : { },
"description" : "Invalid input"
}
},
@@ -53,39 +59,42 @@
} ],
"summary" : "Add a new pet to the store",
"tags" : [ "pet" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
},
"put" : {
"description" : "",
"externalDocs" : {
"description" : "API documentation for the updatePet operation",
"url" : "http://petstore.swagger.io/v2/doc/updatePet"
},
"operationId" : "updatePet",
"requestBody" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
},
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
}
},
"description" : "Pet object that needs to be added to the store",
"required" : true
"$ref" : "#/components/requestBodies/Pet"
},
"responses" : {
"200" : {
"content" : {
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
},
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
}
},
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid ID supplied"
},
"404" : {
"content" : { },
"description" : "Pet not found"
},
"405" : {
"content" : { },
"description" : "Validation exception"
}
},
@@ -94,7 +103,6 @@
} ],
"summary" : "Update an existing pet",
"tags" : [ "pet" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
@@ -104,6 +112,7 @@
"description" : "Multiple status values can be provided with comma separated strings",
"operationId" : "findPetsByStatus",
"parameters" : [ {
"deprecated" : true,
"description" : "Status values that need to be considered for filter",
"explode" : false,
"in" : "query",
@@ -142,12 +151,11 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid status value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
"petstore_auth" : [ "read:pets" ]
} ],
"summary" : "Finds Pets by status",
"tags" : [ "pet" ],
@@ -196,12 +204,11 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid tag value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
"petstore_auth" : [ "read:pets" ]
} ],
"summary" : "Finds Pets by tags",
"tags" : [ "pet" ],
@@ -210,26 +217,31 @@
},
"/pet/{petId}" : {
"delete" : {
"description" : "",
"operationId" : "deletePet",
"parameters" : [ {
"explode" : false,
"in" : "header",
"name" : "api_key",
"required" : false,
"schema" : {
"type" : "string"
}
},
"style" : "simple"
}, {
"description" : "Pet id to delete",
"explode" : false,
"in" : "path",
"name" : "petId",
"required" : true,
"schema" : {
"format" : "int64",
"type" : "integer"
}
},
"style" : "simple"
} ],
"responses" : {
"400" : {
"content" : { },
"description" : "Invalid pet value"
}
},
@@ -245,13 +257,15 @@
"operationId" : "getPetById",
"parameters" : [ {
"description" : "ID of pet to return",
"explode" : false,
"in" : "path",
"name" : "petId",
"required" : true,
"schema" : {
"format" : "int64",
"type" : "integer"
}
},
"style" : "simple"
} ],
"responses" : {
"200" : {
@@ -270,11 +284,9 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid ID supplied"
},
"404" : {
"content" : { },
"description" : "Pet not found"
}
},
@@ -286,16 +298,19 @@
"x-accepts" : "application/json"
},
"post" : {
"description" : "",
"operationId" : "updatePetWithForm",
"parameters" : [ {
"description" : "ID of pet that needs to be updated",
"explode" : false,
"in" : "path",
"name" : "petId",
"required" : true,
"schema" : {
"format" : "int64",
"type" : "integer"
}
},
"style" : "simple"
} ],
"requestBody" : {
"content" : {
@@ -308,7 +323,6 @@
},
"responses" : {
"405" : {
"content" : { },
"description" : "Invalid input"
}
},
@@ -323,16 +337,19 @@
},
"/pet/{petId}/uploadImage" : {
"post" : {
"description" : "",
"operationId" : "uploadFile",
"parameters" : [ {
"description" : "ID of pet to update",
"explode" : false,
"in" : "path",
"name" : "petId",
"required" : true,
"schema" : {
"format" : "int64",
"type" : "integer"
}
},
"style" : "simple"
} ],
"requestBody" : {
"content" : {
@@ -394,10 +411,11 @@
},
"/store/order" : {
"post" : {
"description" : "",
"operationId" : "placeOrder",
"requestBody" : {
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Order"
}
@@ -423,14 +441,12 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid Order"
}
},
"summary" : "Place an order for a pet",
"tags" : [ "store" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "*/*",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
},
@@ -440,20 +456,20 @@
"operationId" : "deleteOrder",
"parameters" : [ {
"description" : "ID of the order that needs to be deleted",
"explode" : false,
"in" : "path",
"name" : "orderId",
"required" : true,
"schema" : {
"type" : "string"
}
},
"style" : "simple"
} ],
"responses" : {
"400" : {
"content" : { },
"description" : "Invalid ID supplied"
},
"404" : {
"content" : { },
"description" : "Order not found"
}
},
@@ -466,6 +482,7 @@
"operationId" : "getOrderById",
"parameters" : [ {
"description" : "ID of pet that needs to be fetched",
"explode" : false,
"in" : "path",
"name" : "orderId",
"required" : true,
@@ -474,7 +491,8 @@
"maximum" : 5,
"minimum" : 1,
"type" : "integer"
}
},
"style" : "simple"
} ],
"responses" : {
"200" : {
@@ -493,11 +511,9 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid ID supplied"
},
"404" : {
"content" : { },
"description" : "Order not found"
}
},
@@ -512,7 +528,7 @@
"operationId" : "createUser",
"requestBody" : {
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/User"
}
@@ -523,96 +539,85 @@
},
"responses" : {
"default" : {
"content" : { },
"description" : "successful operation"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Create user",
"tags" : [ "user" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "*/*",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithArray" : {
"post" : {
"description" : "",
"operationId" : "createUsersWithArrayInput",
"requestBody" : {
"content" : {
"*/*" : {
"schema" : {
"items" : {
"$ref" : "#/components/schemas/User"
},
"type" : "array"
}
}
},
"description" : "List of user object",
"required" : true
"$ref" : "#/components/requestBodies/UserArray"
},
"responses" : {
"default" : {
"content" : { },
"description" : "successful operation"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Creates list of users with given input array",
"tags" : [ "user" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "*/*",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithList" : {
"post" : {
"description" : "",
"operationId" : "createUsersWithListInput",
"requestBody" : {
"content" : {
"*/*" : {
"schema" : {
"items" : {
"$ref" : "#/components/schemas/User"
},
"type" : "array"
}
}
},
"description" : "List of user object",
"required" : true
"$ref" : "#/components/requestBodies/UserArray"
},
"responses" : {
"default" : {
"content" : { },
"description" : "successful operation"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Creates list of users with given input array",
"tags" : [ "user" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "*/*",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/login" : {
"get" : {
"description" : "",
"operationId" : "loginUser",
"parameters" : [ {
"description" : "The user name for login",
"explode" : true,
"in" : "query",
"name" : "username",
"required" : true,
"schema" : {
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
"type" : "string"
}
},
"style" : "form"
}, {
"description" : "The password for login in clear text",
"explode" : true,
"in" : "query",
"name" : "password",
"required" : true,
"schema" : {
"type" : "string"
}
},
"style" : "form"
} ],
"responses" : {
"200" : {
@@ -630,24 +635,36 @@
},
"description" : "successful operation",
"headers" : {
"Set-Cookie" : {
"description" : "Cookie authentication key for use with the `api_key` apiKey authentication.",
"explode" : false,
"schema" : {
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly",
"type" : "string"
},
"style" : "simple"
},
"X-Rate-Limit" : {
"description" : "calls per hour allowed by the user",
"explode" : false,
"schema" : {
"format" : "int32",
"type" : "integer"
}
},
"style" : "simple"
},
"X-Expires-After" : {
"description" : "date in UTC when token expires",
"explode" : false,
"schema" : {
"format" : "date-time",
"type" : "string"
}
},
"style" : "simple"
}
}
},
"400" : {
"content" : { },
"description" : "Invalid username/password supplied"
}
},
@@ -658,13 +675,16 @@
},
"/user/logout" : {
"get" : {
"description" : "",
"operationId" : "logoutUser",
"responses" : {
"default" : {
"content" : { },
"description" : "successful operation"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Logs out current logged in user session",
"tags" : [ "user" ],
"x-accepts" : "application/json"
@@ -676,37 +696,43 @@
"operationId" : "deleteUser",
"parameters" : [ {
"description" : "The name that needs to be deleted",
"explode" : false,
"in" : "path",
"name" : "username",
"required" : true,
"schema" : {
"type" : "string"
}
},
"style" : "simple"
} ],
"responses" : {
"400" : {
"content" : { },
"description" : "Invalid username supplied"
},
"404" : {
"content" : { },
"description" : "User not found"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Delete user",
"tags" : [ "user" ],
"x-accepts" : "application/json"
},
"get" : {
"description" : "",
"operationId" : "getUserByName",
"parameters" : [ {
"description" : "The name that needs to be fetched. Use user1 for testing.",
"explode" : false,
"in" : "path",
"name" : "username",
"required" : true,
"schema" : {
"type" : "string"
}
},
"style" : "simple"
} ],
"responses" : {
"200" : {
@@ -725,11 +751,9 @@
"description" : "successful operation"
},
"400" : {
"content" : { },
"description" : "Invalid username supplied"
},
"404" : {
"content" : { },
"description" : "User not found"
}
},
@@ -742,16 +766,18 @@
"operationId" : "updateUser",
"parameters" : [ {
"description" : "name that need to be deleted",
"explode" : false,
"in" : "path",
"name" : "username",
"required" : true,
"schema" : {
"type" : "string"
}
},
"style" : "simple"
} ],
"requestBody" : {
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/User"
}
@@ -762,23 +788,55 @@
},
"responses" : {
"400" : {
"content" : { },
"description" : "Invalid user supplied"
},
"404" : {
"content" : { },
"description" : "User not found"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"summary" : "Updated user",
"tags" : [ "user" ],
"x-codegen-request-body-name" : "body",
"x-content-type" : "*/*",
"x-content-type" : "application/json",
"x-accepts" : "application/json"
}
}
},
"components" : {
"requestBodies" : {
"UserArray" : {
"content" : {
"application/json" : {
"schema" : {
"items" : {
"$ref" : "#/components/schemas/User"
},
"type" : "array"
}
}
},
"description" : "List of user object",
"required" : true
},
"Pet" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
},
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet"
}
}
},
"description" : "Pet object that needs to be added to the store",
"required" : true
}
},
"schemas" : {
"Order" : {
"description" : "An order for a pets from the pet store",
@@ -835,6 +893,7 @@
"type" : "integer"
},
"name" : {
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
"type" : "string"
}
},
@@ -964,6 +1023,7 @@
}
},
"status" : {
"deprecated" : true,
"description" : "pet status in the store",
"enum" : [ "available", "pending", "sold" ],
"type" : "string"
@@ -1045,6 +1105,5 @@
"type" : "apiKey"
}
}
},
"x-original-swagger-version" : "2.0"
}
}

View File

@@ -16,6 +16,7 @@ openapi_server/models/__init__.py
openapi_server/models/api_response.py
openapi_server/models/base_model.py
openapi_server/models/category.py
openapi_server/models/enum_model.py
openapi_server/models/order.py
openapi_server/models/pet.py
openapi_server/models/tag.py

View File

@@ -2,6 +2,7 @@
# import models into model package
from openapi_server.models.api_response import ApiResponse
from openapi_server.models.category import Category
from openapi_server.models.enum_model import EnumModel
from openapi_server.models.order import Order
from openapi_server.models.pet import Pet
from openapi_server.models.tag import Tag

View File

@@ -0,0 +1,42 @@
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model import Model
from openapi_server import util
class EnumModel(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
"""
"""
allowed enum values
"""
AVAILABLE_GREATER_THAN = 'available>'
PENDING_LESS_THAN = 'pending<'
SOLD = 'sold'
ENUM_1 = '1'
ENUM_2 = '2'
def __init__(self): # noqa: E501
"""EnumModel - a model defined in OpenAPI
"""
self.openapi_types = {
}
self.attribute_map = {
}
@classmethod
def from_dict(cls, dikt) -> 'EnumModel':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The EnumModel of this EnumModel. # noqa: E501
:rtype: EnumModel
"""
return util.deserialize_model(dikt, cls)

View File

@@ -780,6 +780,14 @@ components:
type: string
title: An uploaded response
type: object
EnumModel:
enum:
- available>
- pending<
- sold
- "1"
- "2"
type: string
updatePetWithForm_request:
properties:
name: