Compare commits

..

1 Commits

Author SHA1 Message Date
William Cheng
587d4b0679 set disallowAdditionalPropertiesIfNotPresent to false as default 2023-09-13 11:24:31 +08:00
73 changed files with 603 additions and 1983 deletions

View File

@@ -1 +1 @@
11
1.8

View File

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

View File

@@ -25,7 +25,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-groovy|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -30,7 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|async|use async Callable controllers| |false|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-inflector-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -30,7 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|authorizationFilterPattern|Configure the authorization filter pattern for the client. Generally defined when generating clients from multiple specification files| |null|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|basePathSeparator|Configure the separator to use between the application name and base path when referencing the property| |-|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |pkmst-microservice|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|basePackage|base package for java source code| |null|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-playframework|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|basePackage|base package for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-undertow-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-vertx-web-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-vertx-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -29,7 +29,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-cxf-cdi-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-client|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-resteasy-eap-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-resteasy-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|

View File

@@ -30,7 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|async|use async Callable controllers| |false|
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|

View File

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

View File

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

View File

@@ -144,161 +144,4 @@ 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

@@ -1,114 +0,0 @@
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

@@ -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, hasConstantParams = false,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = 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,7 +45,6 @@ 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>();
@@ -393,7 +392,6 @@ 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();
}
@@ -474,8 +472,7 @@ 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(constantParams, that.constantParams);
Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase);
}
@Override
@@ -491,6 +488,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, constantParams);
operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams);
}
}

View File

@@ -112,9 +112,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
*/
public Number multipleOf;
public String constant; // for const or enum with a single item
private Integer maxProperties;
private Integer minProperties;
public boolean isNull;
@@ -167,7 +164,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.uniqueItems = this.uniqueItems;
output.setUniqueItemsBoolean(this.uniqueItemsBoolean);
output.multipleOf = this.multipleOf;
output.constant = this.constant;
output.jsonSchema = this.jsonSchema;
output.defaultValue = this.defaultValue;
output.enumDefaultValue = this.enumDefaultValue;
@@ -264,20 +260,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam,
isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName,
dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType,
containerType, containerTypeMapped, defaultValue, enumDefaultValue, enumName, style, isDeepObject,
isMatrix, isAllowEmptyValue, example, examples, jsonSchema, isString, isNumeric, isInteger, isLong,
isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid,
isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, isEnumRef,
_enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars,
vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated,
required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(),
getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf,
isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content,
requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, constant);
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue, enumDefaultValue, enumName, style, isDeepObject, isMatrix, isAllowEmptyValue, example, examples, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, isEnumRef, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content, requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
}
@Override
@@ -382,7 +365,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
Objects.equals(getMaxItems(), that.getMaxItems()) &&
Objects.equals(getMinItems(), that.getMinItems()) &&
Objects.equals(contentType, that.contentType) &&
Objects.equals(constant, that.constant) &&
Objects.equals(multipleOf, that.multipleOf);
}
@@ -483,7 +465,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
sb.append(", contentType=").append(contentType);
sb.append(", multipleOf=").append(multipleOf);
sb.append(", constant=").append(constant);
sb.append(", isNull=").append(isNull);
sb.append(", isVoid=").append(isVoid);
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);

View File

@@ -211,9 +211,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private LinkedHashMap<String, List<String>> dependentRequired;
private CodegenProperty contains;
// JSON Schema keywords
private String constant; // for `const`
@Override
public CodegenProperty getContains() {
return contains;
@@ -1039,14 +1036,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
return isEnum || isEnumRef;
}
public void setConstant(String constant) {
this.constant = constant;
}
public String getConstant() {
return constant;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@@ -1161,7 +1150,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", format=").append(format);
sb.append(", dependentRequired=").append(dependentRequired);
sb.append(", contains=").append(contains);
sb.append(", constant=").append(constant);
sb.append('}');
return sb.toString();
}
@@ -1278,8 +1266,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
Objects.equals(xmlPrefix, that.xmlPrefix) &&
Objects.equals(xmlName, that.xmlName) &&
Objects.equals(xmlNamespace, that.xmlNamespace) &&
Objects.equals(multipleOf, that.multipleOf) &&
Objects.equals(constant, that.getConstant());
Objects.equals(multipleOf, that.multipleOf);
}
@Override
@@ -1301,6 +1288,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
xmlNamespace, isXmlWrapped, isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
format, dependentRequired, contains, constant);
format, dependentRequired, contains);
}
}

View File

@@ -478,11 +478,6 @@ 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()) {
@@ -4593,7 +4588,6 @@ public class DefaultCodegen implements CodegenConfig {
List<CodegenParameter> optionalParams = new ArrayList<>();
List<CodegenParameter> requiredAndNotNullableParams = new ArrayList<>();
List<CodegenParameter> notNullableParams = new ArrayList<>();
List<CodegenParameter> constantParams = new ArrayList<>();
CodegenParameter bodyParam = null;
RequestBody requestBody = operation.getRequestBody();
@@ -4657,22 +4651,20 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (p.constant != null) { // for constant
constantParams.add(p.copy());
} else { // a typical parameter
allParams.add(p);
if (param instanceof QueryParameter || "query".equalsIgnoreCase(param.getIn())) {
queryParams.add(p.copy());
} else if (param instanceof PathParameter || "path".equalsIgnoreCase(param.getIn())) {
pathParams.add(p.copy());
} else if (param instanceof HeaderParameter || "header".equalsIgnoreCase(param.getIn())) {
headerParams.add(p.copy());
} else if (param instanceof CookieParameter || "cookie".equalsIgnoreCase(param.getIn())) {
cookieParams.add(p.copy());
} else {
LOGGER.warn("Unknown parameter type {} for {}", p.baseType, p.baseName);
}
allParams.add(p);
if (param instanceof QueryParameter || "query".equalsIgnoreCase(param.getIn())) {
queryParams.add(p.copy());
} else if (param instanceof PathParameter || "path".equalsIgnoreCase(param.getIn())) {
pathParams.add(p.copy());
} else if (param instanceof HeaderParameter || "header".equalsIgnoreCase(param.getIn())) {
headerParams.add(p.copy());
} else if (param instanceof CookieParameter || "cookie".equalsIgnoreCase(param.getIn())) {
cookieParams.add(p.copy());
} else {
LOGGER.warn("Unknown parameter type {} for {}", p.baseType, p.baseName);
}
}
}
@@ -5358,26 +5350,6 @@ public class DefaultCodegen implements CodegenConfig {
// set default value
codegenParameter.defaultValue = toDefaultParameterValue(codegenProperty, parameterSchema);
// set constant
if (codegenParameter.getIsEnumOrRef()) { // enum with only 1 item
Schema enumSchema = ModelUtils.getReferencedSchema(openAPI, unaliasSchema(parameterSchema));
if (enumSchema.getEnum() != null && enumSchema.getEnum().size() == 1) { // only 1 element
codegenParameter.constant = toDefaultParameterValue(codegenProperty, enumSchema);
}
} else if (parameterSchema.getConst() != null) { // JSON Sschema keyword `const`
Schema temp = null;
Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?");
String constantValue = String.valueOf(parameterSchema.getConst());
if (pattern.matcher(constantValue).matches()) { // numeric constant value
temp = new NumberSchema();
temp.setDefault(constantValue);
} else { // constant value is a string
temp = new StringSchema();
temp.setDefault(constantValue);
}
codegenParameter.constant = toDefaultParameterValue(temp);
}
finishUpdatingParameter(codegenParameter, parameter);
return codegenParameter;
}
@@ -6005,10 +5977,6 @@ 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,10 +1334,8 @@ public class DefaultGenerator implements Generator {
for (Map.Entry<String, Schema> definitionsEntry : definitions.entrySet()) {
String key = definitionsEntry.getKey();
Schema schema = definitionsEntry.getValue();
if (schema == null) {
LOGGER.warn("Schema {} cannot be null in processModels", key);
continue;
}
if (schema == null)
throw new RuntimeException("schema cannot be null in processModels");
CodegenModel cm = config.fromModel(key, schema);
ModelMap mo = new ModelMap();
mo.setModel(cm);

View File

@@ -286,11 +286,6 @@ 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);
@@ -313,15 +308,13 @@ public class InlineModelResolver {
if (schema.getAdditionalProperties() != null) {
if (schema.getAdditionalProperties() instanceof Schema) {
Schema inner = (Schema) schema.getAdditionalProperties();
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);
}
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);
}
}
}
@@ -341,6 +334,10 @@ 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());
@@ -363,9 +360,6 @@ 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);
@@ -398,9 +392,6 @@ 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);
@@ -416,9 +407,6 @@ 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);
@@ -435,14 +423,12 @@ public class InlineModelResolver {
// Check not schema
if (schema.getNot() != null) {
Schema not = schema.getNot();
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);
}
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);
}
}
}
@@ -643,9 +629,6 @@ 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.oneOf != null && model.oneOf.size() > 0)) &&
((model.anyOf != null && model.anyOf.size() > 0) || (model.anyOf != null && model.oneOf.size() > 0)) &&
model.discriminator != null &&
model.discriminator.getMappedModels() != null &&
model.discriminator.getMappedModels().size() > 0);

View File

@@ -83,7 +83,6 @@ 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";
@@ -138,7 +137,6 @@ 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;
@@ -279,7 +277,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", implicitHeaders));
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
cliOptions.add(CliOption.newBoolean(AUTOSET_CONSTANTS, "Automatically set Required Params having a Single enum value i.e. Constants in generated code", autosetConstants));
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null"));
@@ -566,10 +563,6 @@ 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()));
}
@@ -1585,7 +1578,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
op.vendorExtensions.put("x-java-import", operationImports);
handleImplicitHeaders(op);
handleConstantParams(op);
}
return objs;
@@ -2060,10 +2052,6 @@ 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;
}
@@ -2306,45 +2294,6 @@ 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,17 +1981,4 @@ 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,9 +16,17 @@
package org.openapitools.codegen.languages;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import java.io.File;
import java.io.IOException;
import java.util.*;
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 org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
@@ -61,8 +69,6 @@ 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
@@ -172,7 +178,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() {
@@ -327,6 +333,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
}
@Override
public String toApiTestFilename(String name) {
return "test_" + toApiFilename(name);
@@ -629,6 +636,12 @@ 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

@@ -233,7 +233,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
ImmutableMap.Builder<String, String> frameworkBuilder = new ImmutableMap.Builder<>();
for (FrameworkStrategy frameworkStrategy : frameworkStrategies) {

View File

@@ -194,7 +194,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
ImmutableMap.Builder<String, String> frameworkBuilder = new ImmutableMap.Builder<>();
for (FrameworkStrategy frameworkStrategy : frameworkStrategies) {

View File

@@ -136,7 +136,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
}
/**

View File

@@ -568,7 +568,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
// default value in the template
additionalProperties.put("powershellVersion", "6.2"); // minimal PS version

View File

@@ -184,7 +184,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
}
@Override
@@ -464,6 +464,20 @@ 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

@@ -233,7 +233,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
this.setDisallowAdditionalPropertiesIfNotPresent(false);
}

View File

@@ -438,10 +438,6 @@ 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)) ||
@@ -553,10 +549,6 @@ 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;
@@ -1866,10 +1858,6 @@ 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())) {
@@ -1887,7 +1875,7 @@ public class ModelUtils {
* @return true if allOf is not empty
*/
public static boolean hasOneOf(Schema schema) {
if (schema != null && schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
return true;
}
@@ -1902,10 +1890,6 @@ 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())) {
@@ -1923,7 +1907,7 @@ public class ModelUtils {
* @return true if anyOf is not empty
*/
public static boolean hasAnyOf(Schema schema) {
if (schema != null && schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
return true;
}

View File

@@ -172,39 +172,18 @@ 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

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

View File

@@ -46,6 +46,15 @@ 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

@@ -1,703 +0,0 @@
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

@@ -1,42 +0,0 @@
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

@@ -46,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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,6 +46,15 @@ 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

@@ -539,10 +539,10 @@ public interface PathHandlerInterface {
* <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='{
"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, constant=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='{
}', 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='{
"type" : "string",
"format" : "date-time"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, 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=true, 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='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', 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=date-time, dependentRequired=null, contains=null, constant=null}]</p>
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, 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=true, 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='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', 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=date-time, dependentRequired=null, contains=null}]</p>
*
* <p><b>Produces</b>: [{isXml=true, mediaType=application/xml}, {isJson=true, mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link String}</p>

View File

@@ -16,7 +16,6 @@ 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,7 +2,6 @@
# 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

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