diff --git a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0-nrt.yaml b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0-nrt.yaml
index b768000d02f..d234b5399f2 100644
--- a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0-nrt.yaml
+++ b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0-nrt.yaml
@@ -1,7 +1,7 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt
-inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
diff --git a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0.yaml b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0.yaml
index 7d83f7abc39..1b07cd23c2c 100644
--- a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0.yaml
+++ b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netcore5.0.yaml
@@ -1,7 +1,7 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0
-inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
diff --git a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netstandard2.0.yaml b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netstandard2.0.yaml
index 86259bb6209..597c9753d4f 100644
--- a/bin/configs/csharp-netcore-OpenAPIClient-generichost-netstandard2.0.yaml
+++ b/bin/configs/csharp-netcore-OpenAPIClient-generichost-netstandard2.0.yaml
@@ -1,7 +1,7 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0
-inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
index ea1c484461c..a7e1ad495c1 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
@@ -1349,6 +1349,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
cm.anyOf.remove("Null");
}
+ if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getOneOf() != null && !cm.getComposedSchemas().getOneOf().isEmpty()) {
+ cm.getComposedSchemas().getOneOf().removeIf(o -> o.dataType.equals("Null"));
+ }
+
+ if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getAnyOf() != null && !cm.getComposedSchemas().getAnyOf().isEmpty()) {
+ cm.getComposedSchemas().getAnyOf().removeIf(o -> o.dataType.equals("Null"));
+ }
+
for (CodegenProperty cp : cm.readWriteVars) {
// ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11844
// allVars may not have all properties
@@ -1385,7 +1393,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
* Check modules\openapi-generator\src\test\resources\3_0\java\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
* Without this method, property petType in GrandparentAnimal will not make it through ParentPet and into ChildCat
*/
- private void EnsureInheritedVariablesArePresent(CodegenModel derivedModel) {
+ private void EnsureInheritedPropertiesArePresent(CodegenModel derivedModel) {
// every c# generator should definetly want this, or we should fix the issue
// still, lets avoid breaking changes :(
if (Boolean.FALSE.equals(GENERICHOST.equals(getLibrary()))){
@@ -1405,7 +1413,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
}
}
- EnsureInheritedVariablesArePresent(derivedModel.parentModel);
+ EnsureInheritedPropertiesArePresent(derivedModel.parentModel);
}
/**
@@ -1430,19 +1438,19 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
}
for (CodegenModel cm : allModels) {
- if (cm.parent != null){
- // remove the parent CodegenProperty from the model
- // we need it gone so we can use allOf/oneOf/anyOf in the constructor
- cm.allOf.removeIf(item -> item.equals(cm.parent));
- cm.oneOf.removeIf(item -> item.equals(cm.parent));
- cm.anyOf.removeIf(item -> item.equals(cm.parent));
- }
-
cm.anyOf.forEach(anyOf -> removePropertiesDeclaredInComposedClass(anyOf, allModels, cm));
cm.oneOf.forEach(oneOf -> removePropertiesDeclaredInComposedClass(oneOf, allModels, cm));
cm.allOf.forEach(allOf -> removePropertiesDeclaredInComposedClass(allOf, allModels, cm));
- EnsureInheritedVariablesArePresent(cm);
+ if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getAllOf() != null && !cm.getComposedSchemas().getAllOf().isEmpty()) {
+ cm.getComposedSchemas().getAllOf().forEach(allOf -> {
+ if (allOf.dataType.equals(cm.parent)){
+ allOf.isInherited = true;
+ }
+ });
+ }
+
+ EnsureInheritedPropertiesArePresent(cm);
}
return objs;
diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/JsonConverter.mustache
index a5536994cce..0a0f7540cae 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/JsonConverter.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/JsonConverter.mustache
@@ -25,20 +25,23 @@
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
- {{#anyOf}}
- Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
- Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
+ {{#composedSchemas.anyOf}}
+ Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
+ bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
- {{/anyOf}}
- {{#oneOf}}
- Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
- Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
+ {{/composedSchemas.anyOf}}
+ {{#composedSchemas.oneOf}}
+ Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
+ bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
- {{/oneOf}}
- {{#allOf}}
- Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
- Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
- {{/allOf}}
+ {{/composedSchemas.oneOf}}
+ {{#composedSchemas.allOf}}
+ {{^isInherited}}
+ Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
+ bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
+
+ {{/isInherited}}
+ {{/composedSchemas.allOf}}
{{#allVars}}
{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default;
{{/allVars}}
@@ -104,17 +107,17 @@
}
}
- {{#oneOf}}
- if ({{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} != null)
- return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#allOf}}{{#lambda.camelcase_param}}{{.}} {{/lambda.camelcase_param}}{{/allOf}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
+ {{#composedSchemas.oneOf}}
+ if ({{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized)
+ return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{#model.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/isInherited}}{{/model.composedSchemas.allOf}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
{{#-last}}
throw new JsonException();
{{/-last}}
- {{/oneOf}}
- {{^oneOf}}
- return new {{classname}}({{#lambda.joinWithComma}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
- {{/oneOf}}
+ {{/composedSchemas.oneOf}}
+ {{^composedSchemas.oneOf}}
+ return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#model.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{/isInherited}}{{/model.composedSchemas.allOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
+ {{/composedSchemas.oneOf}}
}
///
diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/modelGeneric.mustache
index cace31d6f56..1f18f91bce0 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/modelGeneric.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/modelGeneric.mustache
@@ -3,21 +3,23 @@
///
{{>visibility}} partial class {{classname}} : {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}{{^parentModel}}, IValidatableObject{{/parentModel}}{{/validatable}}
{
- {{#oneOf}}
+ {{#composedSchemas.oneOf}}
///
/// Initializes a new instance of the class.
///
- /// {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}
- {{#allOf}}
- /// {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}
- {{/allOf}}
- {{#anyOf}}
- /// {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}
- {{/anyOf}}
+ ///
+ {{#composedSchemas.allOf}}
+ {{^isInherited}}
+ ///
+ {{/isInherited}}
+ {{/composedSchemas.allOf}}
+ {{#composedSchemas.anyOf}}
+ ///
+ {{/composedSchemas.anyOf}}
{{#allVars}}
/// {{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}
{{/allVars}}
- public {{classname}}({{#lambda.joinWithComma}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#allOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
+ public {{classname}}({{#lambda.joinWithComma}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{#model.composedSchemas.allOf}}{{^isInherited}}{{{dataType}}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/isInherited}}{{/model.composedSchemas.allOf}}{{#model.composedSchemas.anyOf}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#model.allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/model.allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{#parentModel.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/isInherited}}{{/parentModel.composedSchemas.allOf}}{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
{
{{#allVars}}
{{^isInherited}}
@@ -30,13 +32,13 @@
{{/required}}
{{/isInherited}}
{{/allVars}}
- {{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
- {{#allOf}}
- {{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
- {{/allOf}}
- {{#anyOf}}
- {{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
- {{/anyOf}}
+ {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
+ {{#composedSchemas.allOf}}
+ {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
+ {{/composedSchemas.allOf}}
+ {{#composedSchemas.anyOf}}
+ {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
+ {{/composedSchemas.anyOf}}
{{#allVars}}
{{^isInherited}}
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
@@ -44,21 +46,23 @@
{{/allVars}}
}
- {{/oneOf}}
- {{^oneOf}}
+ {{/composedSchemas.oneOf}}
+ {{^composedSchemas.oneOf}}
///
/// Initializes a new instance of the class.
///
- {{#allOf}}
- /// {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}
- {{/allOf}}
- {{#anyOf}}
- /// {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}
- {{/anyOf}}
+ {{#composedSchemas.allOf}}
+ {{^isInherited}}
+ ///
+ {{/isInherited}}
+ {{/composedSchemas.allOf}}
+ {{#composedSchemas.anyOf}}
+ ///
+ {{/composedSchemas.anyOf}}
{{#allVars}}
/// {{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}
{{/allVars}}
- public {{classname}}({{#lambda.joinWithComma}}{{#allOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
+ public {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.allOf}}{{^isInherited}}{{{dataType}}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/isInherited}}{{/composedSchemas.allOf}}{{#composedSchemas.anyOf}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/composedSchemas.anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{#parentModel.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/isInherited}}{{/parentModel.composedSchemas.allOf}}{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
{
{{#allVars}}
{{^isInherited}}
@@ -71,12 +75,14 @@
{{/required}}
{{/isInherited}}
{{/allVars}}
- {{#allOf}}
- {{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
- {{/allOf}}
- {{#anyOf}}
- {{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
- {{/anyOf}}
+ {{#composedSchemas.allOf}}
+ {{^isInherited}}
+ {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
+ {{/isInherited}}
+ {{/composedSchemas.allOf}}
+ {{#composedSchemas.anyOf}}
+ {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}};
+ {{/composedSchemas.anyOf}}
{{#allVars}}
{{^isInherited}}
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
@@ -84,7 +90,7 @@
{{/allVars}}
}
- {{/oneOf}}
+ {{/composedSchemas.oneOf}}
{{#vars}}
{{#items.isEnum}}
{{#items}}
@@ -113,39 +119,41 @@
{{/isEnum}}
{{/vars}}
- {{#anyOf}}
+ {{#composedSchemas.anyOf}}
///
- /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
+ /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
/// {{#description}}
/// {{.}}{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
- public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
+ public {{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
- {{/anyOf}}
- {{#oneOf}}
+ {{/composedSchemas.anyOf}}
+ {{#composedSchemas.oneOf}}
///
- /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
+ /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
/// {{#description}}
/// {{.}}{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
- public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
+ public {{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
- {{/oneOf}}
- {{#allOf}}
+ {{/composedSchemas.oneOf}}
+ {{#composedSchemas.allOf}}
+ {{^isInherited}}
///
- /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
+ /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
/// {{#description}}
/// {{.}}{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
- public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
+ public {{{dataType}}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
- {{/allOf}}
+ {{/isInherited}}
+ {{/composedSchemas.allOf}}
{{#allVars}}
{{^isInherited}}
{{^isEnum}}
diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
deleted file mode 100644
index 93afc08ad0c..00000000000
--- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
+++ /dev/null
@@ -1,2156 +0,0 @@
-openapi: 3.0.0
-info:
- description: >-
- This spec is mainly for testing Petstore server and contains fake endpoints,
- models. Please do not use this for any other purpose. Special characters: "
- \
- version: 1.0.0
- title: OpenAPI Petstore
- license:
- name: Apache-2.0
- url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
-tags:
- - name: pet
- description: Everything about your Pets
- - name: store
- description: Access to Petstore orders
- - name: user
- description: Operations about user
-paths:
- /foo:
- get:
- responses:
- default:
- description: response
- content:
- application/json:
- schema:
- type: object
- properties:
- string:
- $ref: '#/components/schemas/Foo'
- /pet:
- servers:
- - url: 'http://petstore.swagger.io/v2'
- - url: 'http://path-server-test.petstore.local/v2'
- post:
- tags:
- - pet
- summary: Add a new pet to the store
- description: ''
- operationId: addPet
- responses:
- '405':
- description: Invalid input
- security:
- - http_signature_test: []
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- requestBody:
- $ref: '#/components/requestBodies/Pet'
- put:
- tags:
- - pet
- summary: Update an existing pet
- description: ''
- operationId: updatePet
- responses:
- '400':
- description: Invalid ID supplied
- '404':
- description: Pet not found
- '405':
- description: Validation exception
- security:
- - http_signature_test: []
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- requestBody:
- $ref: '#/components/requestBodies/Pet'
- /pet/findByStatus:
- get:
- tags:
- - pet
- summary: Finds Pets by status
- description: Multiple status values can be provided with comma separated strings
- operationId: findPetsByStatus
- parameters:
- - name: status
- in: query
- description: Status values that need to be considered for filter
- required: true
- style: form
- explode: false
- deprecated: true
- schema:
- type: array
- items:
- type: string
- enum:
- - available
- - pending
- - sold
- default: available
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/Pet'
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/Pet'
- '400':
- description: Invalid status value
- security:
- - http_signature_test: []
- - 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
- parameters:
- - name: tags
- in: query
- description: Tags to filter by
- required: true
- style: form
- explode: false
- schema:
- type: array
- items:
- type: string
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/Pet'
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/Pet'
- '400':
- description: Invalid tag value
- security:
- - http_signature_test: []
- - 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
- parameters:
- - name: petId
- in: path
- description: ID of pet to return
- required: true
- schema:
- type: integer
- format: int64
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- $ref: '#/components/schemas/Pet'
- application/json:
- schema:
- $ref: '#/components/schemas/Pet'
- '400':
- description: Invalid ID supplied
- '404':
- description: Pet not found
- security:
- - api_key: []
- post:
- tags:
- - pet
- summary: Updates a pet in the store with form data
- description: ''
- operationId: updatePetWithForm
- parameters:
- - name: petId
- in: path
- description: ID of pet that needs to be updated
- required: true
- schema:
- type: integer
- format: int64
- responses:
- '405':
- description: Invalid input
- security:
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- requestBody:
- content:
- application/x-www-form-urlencoded:
- schema:
- type: object
- properties:
- name:
- description: Updated name of the pet
- type: string
- status:
- description: Updated status of the pet
- type: string
- delete:
- tags:
- - pet
- summary: Deletes a pet
- description: ''
- operationId: deletePet
- parameters:
- - name: api_key
- in: header
- required: false
- schema:
- type: string
- - name: petId
- in: path
- description: Pet id to delete
- required: true
- schema:
- type: integer
- format: int64
- responses:
- '400':
- description: Invalid pet value
- security:
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- '/pet/{petId}/uploadImage':
- post:
- tags:
- - pet
- summary: uploads an image
- description: ''
- operationId: uploadFile
- parameters:
- - name: petId
- in: path
- description: ID of pet to update
- required: true
- schema:
- type: integer
- format: int64
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- security:
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- requestBody:
- content:
- multipart/form-data:
- schema:
- type: object
- properties:
- additionalMetadata:
- description: Additional data to pass to server
- type: string
- file:
- description: file to upload
- type: string
- format: binary
- /store/inventory:
- get:
- tags:
- - store
- summary: Returns pet inventories by status
- description: Returns a map of status codes to quantities
- operationId: getInventory
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- 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
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- $ref: '#/components/schemas/Order'
- application/json:
- schema:
- $ref: '#/components/schemas/Order'
- '400':
- description: Invalid Order
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Order'
- description: order placed for purchasing the pet
- required: true
- '/store/order/{order_id}':
- get:
- tags:
- - store
- summary: Find purchase order by ID
- description: >-
- For valid response try integer IDs with value <= 5 or > 10. Other values
- will generated exceptions
- operationId: getOrderById
- parameters:
- - name: order_id
- in: path
- description: ID of pet that needs to be fetched
- required: true
- schema:
- type: integer
- format: int64
- minimum: 1
- maximum: 5
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- $ref: '#/components/schemas/Order'
- application/json:
- schema:
- $ref: '#/components/schemas/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
- parameters:
- - name: order_id
- in: path
- description: ID of the order that needs to be deleted
- required: true
- schema:
- 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
- responses:
- default:
- description: successful operation
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: Created user object
- required: true
- /user/createWithArray:
- post:
- tags:
- - user
- summary: Creates list of users with given input array
- description: ''
- operationId: createUsersWithArrayInput
- responses:
- default:
- description: successful operation
- requestBody:
- $ref: '#/components/requestBodies/UserArray'
- /user/createWithList:
- post:
- tags:
- - user
- summary: Creates list of users with given input array
- description: ''
- operationId: createUsersWithListInput
- responses:
- default:
- description: successful operation
- requestBody:
- $ref: '#/components/requestBodies/UserArray'
- /user/login:
- get:
- tags:
- - user
- summary: Logs user into the system
- description: ''
- operationId: loginUser
- parameters:
- - name: username
- in: query
- description: The user name for login
- required: true
- schema:
- type: string
- - name: password
- in: query
- description: The password for login in clear text
- required: true
- schema:
- type: string
- responses:
- '200':
- description: successful operation
- headers:
- X-Rate-Limit:
- description: calls per hour allowed by the user
- schema:
- type: integer
- format: int32
- X-Expires-After:
- description: date in UTC when token expires
- schema:
- type: string
- format: date-time
- content:
- application/xml:
- schema:
- type: string
- application/json:
- schema:
- type: string
- '400':
- description: Invalid username/password supplied
- /user/logout:
- get:
- tags:
- - user
- summary: Logs out current logged in user session
- description: ''
- operationId: logoutUser
- responses:
- default:
- description: successful operation
- '/user/{username}':
- get:
- tags:
- - user
- summary: Get user by user name
- description: ''
- operationId: getUserByName
- parameters:
- - name: username
- in: path
- description: The name that needs to be fetched. Use user1 for testing.
- required: true
- schema:
- type: string
- responses:
- '200':
- description: successful operation
- content:
- application/xml:
- schema:
- $ref: '#/components/schemas/User'
- application/json:
- schema:
- $ref: '#/components/schemas/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
- parameters:
- - name: username
- in: path
- description: name that need to be deleted
- required: true
- schema:
- type: string
- responses:
- '400':
- description: Invalid user supplied
- '404':
- description: User not found
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: Updated user object
- required: true
- delete:
- tags:
- - user
- summary: Delete user
- description: This can only be done by the logged in user.
- operationId: deleteUser
- parameters:
- - name: username
- in: path
- description: The name that needs to be deleted
- required: true
- schema:
- type: string
- responses:
- '400':
- description: Invalid username supplied
- '404':
- description: User not found
- /fake_classname_test:
- patch:
- tags:
- - 'fake_classname_tags 123#$%^'
- summary: To test class name in snake case
- description: To test class name in snake case
- operationId: testClassname
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Client'
- security:
- - api_key_query: []
- requestBody:
- $ref: '#/components/requestBodies/Client'
- /fake:
- patch:
- tags:
- - fake
- summary: To test "client" model
- description: To test "client" model
- operationId: testClientModel
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Client'
- requestBody:
- $ref: '#/components/requestBodies/Client'
- get:
- tags:
- - fake
- summary: To test enum parameters
- description: To test enum parameters
- operationId: testEnumParameters
- parameters:
- - name: enum_header_string_array
- in: header
- description: Header parameter enum test (string array)
- schema:
- type: array
- items:
- type: string
- default: $
- enum:
- - '>'
- - $
- - name: enum_header_string
- in: header
- description: Header parameter enum test (string)
- schema:
- type: string
- enum:
- - _abc
- - '-efg'
- - (xyz)
- default: '-efg'
- - name: enum_query_string_array
- in: query
- description: Query parameter enum test (string array)
- schema:
- type: array
- items:
- type: string
- default: $
- enum:
- - '>'
- - $
- - name: enum_query_string
- in: query
- description: Query parameter enum test (string)
- schema:
- type: string
- enum:
- - _abc
- - '-efg'
- - (xyz)
- default: '-efg'
- - name: enum_query_integer
- in: query
- description: Query parameter enum test (double)
- schema:
- type: integer
- format: int32
- enum:
- - 1
- - -2
- - name: enum_query_double
- in: query
- description: Query parameter enum test (double)
- schema:
- type: number
- format: double
- enum:
- - 1.1
- - -1.2
- responses:
- '400':
- description: Invalid request
- '404':
- description: Not found
- requestBody:
- content:
- application/x-www-form-urlencoded:
- schema:
- type: object
- properties:
- enum_form_string_array:
- description: Form parameter enum test (string array)
- type: array
- items:
- type: string
- default: $
- enum:
- - '>'
- - $
- enum_form_string:
- description: Form parameter enum test (string)
- type: string
- enum:
- - _abc
- - '-efg'
- - (xyz)
- default: '-efg'
- post:
- tags:
- - fake
- summary: |
- Fake endpoint for testing various parameters
- 假端點
- 偽のエンドポイント
- 가짜 엔드 포인트
- description: |
- Fake endpoint for testing various parameters
- 假端點
- 偽のエンドポイント
- 가짜 엔드 포인트
- operationId: testEndpointParameters
- responses:
- '400':
- description: Invalid username supplied
- '404':
- description: User not found
- security:
- - http_basic_test: []
- requestBody:
- content:
- application/x-www-form-urlencoded:
- schema:
- type: object
- properties:
- integer:
- description: None
- type: integer
- minimum: 10
- maximum: 100
- int32:
- description: None
- type: integer
- format: int32
- minimum: 20
- maximum: 200
- int64:
- description: None
- type: integer
- format: int64
- number:
- description: None
- type: number
- minimum: 32.1
- maximum: 543.2
- float:
- description: None
- type: number
- format: float
- maximum: 987.6
- double:
- description: None
- type: number
- format: double
- minimum: 67.8
- maximum: 123.4
- string:
- description: None
- type: string
- pattern: '/[a-z]/i'
- pattern_without_delimiter:
- description: None
- type: string
- pattern: '^[A-Z].*'
- byte:
- description: None
- type: string
- format: byte
- binary:
- description: None
- type: string
- format: binary
- date:
- description: None
- type: string
- format: date
- dateTime:
- description: None
- type: string
- format: date-time
- default: '2010-02-01T10:20:10.11111+01:00'
- example: '2020-02-02T20:20:20.22222Z'
- password:
- description: None
- type: string
- format: password
- minLength: 10
- maxLength: 64
- callback:
- description: None
- type: string
- required:
- - number
- - double
- - pattern_without_delimiter
- - byte
- delete:
- tags:
- - fake
- security:
- - bearer_test: []
- summary: Fake endpoint to test group parameters (optional)
- description: Fake endpoint to test group parameters (optional)
- operationId: testGroupParameters
- x-group-parameters: true
- parameters:
- - name: required_string_group
- in: query
- description: Required String in group parameters
- required: true
- schema:
- type: integer
- - name: required_boolean_group
- in: header
- description: Required Boolean in group parameters
- required: true
- schema:
- type: boolean
- - name: required_int64_group
- in: query
- description: Required Integer in group parameters
- required: true
- schema:
- type: integer
- format: int64
- - name: string_group
- in: query
- description: String in group parameters
- schema:
- type: integer
- - name: boolean_group
- in: header
- description: Boolean in group parameters
- schema:
- type: boolean
- - name: int64_group
- in: query
- description: Integer in group parameters
- schema:
- type: integer
- format: int64
- responses:
- '400':
- description: Someting wrong
- /fake/outer/number:
- post:
- tags:
- - fake
- description: Test serialization of outer number types
- operationId: fakeOuterNumberSerialize
- responses:
- '200':
- description: Output number
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/OuterNumber'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/OuterNumber'
- description: Input number as post body
- /fake/outer/string:
- post:
- tags:
- - fake
- description: Test serialization of outer string types
- operationId: fakeOuterStringSerialize
- responses:
- '200':
- description: Output string
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/OuterString'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/OuterString'
- description: Input string as post body
- /fake/outer/boolean:
- post:
- tags:
- - fake
- description: Test serialization of outer boolean types
- operationId: fakeOuterBooleanSerialize
- responses:
- '200':
- description: Output boolean
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/OuterBoolean'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/OuterBoolean'
- description: Input boolean as post body
- /fake/outer/composite:
- post:
- tags:
- - fake
- description: Test serialization of object with outer number type
- operationId: fakeOuterCompositeSerialize
- responses:
- '200':
- description: Output composite
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/OuterComposite'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/OuterComposite'
- description: Input composite as post body
- /fake/jsonFormData:
- get:
- tags:
- - fake
- summary: test json serialization of form data
- description: ''
- operationId: testJsonFormData
- responses:
- '200':
- description: successful operation
- requestBody:
- content:
- application/x-www-form-urlencoded:
- schema:
- type: object
- properties:
- param:
- description: field1
- type: string
- param2:
- description: field2
- type: string
- required:
- - param
- - param2
- /fake/inline-additionalProperties:
- post:
- tags:
- - fake
- summary: test inline additionalProperties
- description: ''
- operationId: testInlineAdditionalProperties
- responses:
- '200':
- description: successful operation
- requestBody:
- content:
- application/json:
- schema:
- type: object
- additionalProperties:
- type: string
- description: request body
- required: true
- /fake/body-with-query-params:
- put:
- tags:
- - fake
- operationId: testBodyWithQueryParams
- parameters:
- - name: query
- in: query
- required: true
- schema:
- type: string
- responses:
- '200':
- description: Success
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- required: true
- /another-fake/dummy:
- patch:
- tags:
- - $another-fake?
- summary: To test special tags
- description: To test special tags and operation ID starting with number
- operationId: '123_test_@#$%_special_tags'
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Client'
- requestBody:
- $ref: '#/components/requestBodies/Client'
- /fake/body-with-file-schema:
- put:
- tags:
- - fake
- description: >-
- For this test, the body for this request much reference a schema named
- `File`.
- operationId: testBodyWithFileSchema
- responses:
- '200':
- description: Success
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/FileSchemaTestClass'
- required: true
- /fake/test-query-parameters:
- put:
- tags:
- - fake
- description: To test the collection format in query parameters
- operationId: testQueryParameterCollectionFormat
- parameters:
- - name: pipe
- in: query
- required: true
- schema:
- type: array
- items:
- type: string
- - name: ioutil
- in: query
- required: true
- style: form
- explode: false
- schema:
- type: array
- items:
- type: string
- - name: http
- in: query
- required: true
- style: spaceDelimited
- schema:
- type: array
- items:
- type: string
- - name: url
- in: query
- required: true
- style: form
- explode: false
- schema:
- type: array
- items:
- type: string
- - name: context
- in: query
- required: true
- explode: true
- schema:
- type: array
- items:
- type: string
- responses:
- "200":
- description: Success
- '/fake/{petId}/uploadImageWithRequiredFile':
- post:
- tags:
- - pet
- summary: uploads an image (required)
- description: ''
- operationId: uploadFileWithRequiredFile
- parameters:
- - name: petId
- in: path
- description: ID of pet to update
- required: true
- schema:
- type: integer
- format: int64
- responses:
- '200':
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- security:
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
- requestBody:
- content:
- multipart/form-data:
- schema:
- type: object
- properties:
- additionalMetadata:
- description: Additional data to pass to server
- type: string
- requiredFile:
- description: file to upload
- type: string
- format: binary
- required:
- - requiredFile
- /fake/health:
- get:
- tags:
- - fake
- summary: Health check endpoint
- responses:
- 200:
- description: The instance started successfully
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/HealthCheckResult'
- /fake/array-of-enums:
- get:
- tags:
- - fake
- summary: Array of Enums
- operationId: getArrayOfEnums
- responses:
- 200:
- description: Got named array of enums
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ArrayOfEnums'
-servers:
- - url: 'http://{server}.swagger.io:{port}/v2'
- description: petstore server
- variables:
- server:
- enum:
- - 'petstore'
- - 'qa-petstore'
- - 'dev-petstore'
- default: 'petstore'
- port:
- enum:
- - 80
- - 8080
- default: 80
- - url: https://localhost:8080/{version}
- description: The local server
- variables:
- version:
- enum:
- - 'v1'
- - 'v2'
- default: 'v2'
- - url: https://127.0.0.1/no_variable
- description: The local server without variables
-components:
- requestBodies:
- UserArray:
- content:
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/User'
- examples:
- simple-list:
- summary: Simple list example
- description: Should not get into code examples
- value:
- - username: foo
- - username: bar
- description: List of user object
- required: true
- Client:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Client'
- description: client model
- required: true
- Pet:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Pet'
- application/xml:
- schema:
- $ref: '#/components/schemas/Pet'
- description: Pet object that needs to be added to the store
- required: true
- securitySchemes:
- petstore_auth:
- type: oauth2
- flows:
- implicit:
- authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
- scopes:
- 'write:pets': modify pets in your account
- 'read:pets': read your pets
- api_key:
- type: apiKey
- name: api_key
- in: header
- api_key_query:
- type: apiKey
- name: api_key_query
- in: query
- http_basic_test:
- type: http
- scheme: basic
- bearer_test:
- type: http
- scheme: bearer
- bearerFormat: JWT
- http_signature_test:
- # Test the 'HTTP signature' security scheme.
- # Each HTTP request is cryptographically signed as specified
- # in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
- type: http
- scheme: signature
- schemas:
- Foo:
- type: object
- properties:
- bar:
- $ref: '#/components/schemas/Bar'
- Bar:
- type: string
- default: bar
- Order:
- type: object
- properties:
- id:
- type: integer
- format: int64
- petId:
- type: integer
- format: int64
- quantity:
- type: integer
- format: int32
- shipDate:
- type: string
- format: date-time
- example: '2020-02-02T20:20:20.000222Z'
- status:
- type: string
- description: Order Status
- enum:
- - placed
- - approved
- - delivered
- complete:
- type: boolean
- default: false
- xml:
- name: Order
- Category:
- type: object
- required:
- - name
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- default: default-name
- xml:
- name: Category
- User:
- type: object
- properties:
- id:
- type: integer
- format: int64
- x-is-unique: true
- 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
- objectWithNoDeclaredProps:
- type: object
- # Note: the 'additionalProperties' keyword is not specified, which is
- # equivalent to allowing undeclared properties of any type.
- description: test code generation for objects
- Value must be a map of strings to values. It cannot be the 'null' value.
- objectWithNoDeclaredPropsNullable:
- type: object
- # Note: the 'additionalProperties' keyword is not specified, which is
- # equivalent to allowing undeclared properties of any type.
- description: test code generation for nullable objects.
- Value must be a map of strings to values or the 'null' value.
- nullable: true
- anyTypeProp:
- description: test code generation for any type
- Here the 'type' attribute is not specified, which means the value can be anything,
- including the null value, string, number, boolean, array or object.
- See https://github.com/OAI/OpenAPI-Specification/issues/1389
- # TODO: this should be supported, currently there are some issues in the code generation.
- #anyTypeExceptNullProp:
- # description: any type except 'null'
- # Here the 'type' attribute is not specified, which means the value can be anything,
- # including the null value, string, number, boolean, array or object.
- # not:
- # type: 'null'
- anyTypePropNullable:
- description: test code generation for any type
- Here the 'type' attribute is not specified, which means the value can be anything,
- including the null value, string, number, boolean, array or object.
- The 'nullable' attribute does not change the allowed values.
- nullable: true
- xml:
- name: User
- Tag:
- type: object
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- xml:
- name: Tag
- Pet:
- type: object
- required:
- - name
- - photoUrls
- properties:
- id:
- type: integer
- format: int64
- x-is-unique: true
- category:
- $ref: '#/components/schemas/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: '#/components/schemas/Tag'
- status:
- type: string
- description: pet status in the store
- enum:
- - available
- - pending
- - sold
- xml:
- name: Pet
- ApiResponse:
- type: object
- properties:
- code:
- type: integer
- format: int32
- type:
- type: string
- message:
- type: string
- Return:
- description: Model for testing reserved words
- properties:
- return:
- type: integer
- format: int32
- xml:
- name: Return
- Name:
- description: Model for testing model name same as property name
- required:
- - name
- properties:
- name:
- type: integer
- format: int32
- snake_case:
- readOnly: true
- type: integer
- format: int32
- property:
- type: string
- 123Number:
- type: integer
- readOnly: true
- xml:
- name: Name
- 200_response:
- description: Model for testing model name starting with number
- properties:
- name:
- type: integer
- format: int32
- class:
- type: string
- xml:
- name: Name
- ClassModel:
- description: Model for testing model with "_class" property
- properties:
- _class:
- type: string
- Dog:
- allOf:
- - $ref: '#/components/schemas/Animal'
- - type: object
- properties:
- breed:
- type: string
- Cat:
- allOf:
- - $ref: '#/components/schemas/Animal'
- - $ref: '#/components/schemas/Address'
- - type: object
- properties:
- declawed:
- type: boolean
- Address:
- type: object
- additionalProperties:
- type: integer
- Animal:
- type: object
- discriminator:
- propertyName: className
- required:
- - className
- properties:
- className:
- type: string
- color:
- type: string
- default: red
- AnimalFarm:
- type: array
- items:
- $ref: '#/components/schemas/Animal'
- format_test:
- type: object
- required:
- - number
- - byte
- - date
- - password
- properties:
- integer:
- type: integer
- maximum: 100
- minimum: 10
- multipleOf: 2
- int32:
- type: integer
- format: int32
- maximum: 200
- minimum: 20
- int64:
- type: integer
- format: int64
- number:
- maximum: 543.2
- minimum: 32.1
- type: number
- multipleOf: 32.5
- float:
- type: number
- format: float
- maximum: 987.6
- minimum: 54.3
- double:
- type: number
- format: double
- maximum: 123.4
- minimum: 67.8
- decimal:
- type: string
- format: number
- string:
- type: string
- pattern: '/[a-z]/i'
- byte:
- type: string
- format: byte
- binary:
- type: string
- format: binary
- date:
- type: string
- format: date
- example: '2020-02-02'
- dateTime:
- type: string
- format: date-time
- example: '2007-12-03T10:15:30+01:00'
- uuid:
- type: string
- format: uuid
- example: 72f98069-206d-4f12-9f12-3d1e525a8e84
- password:
- type: string
- format: password
- maxLength: 64
- minLength: 10
- pattern_with_digits:
- description: A string that is a 10 digit number. Can have leading zeros.
- type: string
- pattern: '^\d{10}$'
- pattern_with_digits_and_delimiter:
- description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
- type: string
- pattern: '/^image_\d{1,3}$/i'
- EnumClass:
- type: string
- default: '-efg'
- enum:
- - _abc
- - '-efg'
- - (xyz)
- Enum_Test:
- type: object
- required:
- - enum_string_required
- properties:
- enum_string:
- type: string
- enum:
- - UPPER
- - lower
- - ''
- enum_string_required:
- type: string
- enum:
- - UPPER
- - lower
- - ''
- enum_integer:
- type: integer
- format: int32
- enum:
- - 1
- - -1
- enum_integer_only:
- type: integer
- enum:
- - 2
- - -2
- enum_number:
- type: number
- format: double
- enum:
- - 1.1
- - -1.2
- outerEnum:
- $ref: '#/components/schemas/OuterEnum'
- outerEnumInteger:
- $ref: '#/components/schemas/OuterEnumInteger'
- outerEnumDefaultValue:
- $ref: '#/components/schemas/OuterEnumDefaultValue'
- outerEnumIntegerDefaultValue:
- $ref: '#/components/schemas/OuterEnumIntegerDefaultValue'
- AdditionalPropertiesClass:
- type: object
- properties:
- map_property:
- type: object
- additionalProperties:
- type: string
- map_of_map_property:
- type: object
- additionalProperties:
- type: object
- additionalProperties:
- type: string
- anytype_1: {}
- map_with_undeclared_properties_anytype_1:
- type: object
- map_with_undeclared_properties_anytype_2:
- type: object
- properties: {}
- map_with_undeclared_properties_anytype_3:
- type: object
- additionalProperties: true
- empty_map:
- type: object
- description: an object with no declared properties and no undeclared
- properties, hence it's an empty map.
- additionalProperties: false
- map_with_undeclared_properties_string:
- type: object
- additionalProperties:
- type: string
- MixedPropertiesAndAdditionalPropertiesClass:
- type: object
- properties:
- uuid:
- type: string
- format: uuid
- dateTime:
- type: string
- format: date-time
- map:
- type: object
- additionalProperties:
- $ref: '#/components/schemas/Animal'
- List:
- type: object
- properties:
- 123-list:
- type: string
- Client:
- type: object
- properties:
- client:
- type: string
- ReadOnlyFirst:
- type: object
- properties:
- bar:
- type: string
- readOnly: true
- baz:
- type: string
- hasOnlyReadOnly:
- type: object
- properties:
- bar:
- type: string
- readOnly: true
- foo:
- type: string
- readOnly: true
- Capitalization:
- type: object
- properties:
- smallCamel:
- type: string
- CapitalCamel:
- type: string
- small_Snake:
- type: string
- Capital_Snake:
- type: string
- SCA_ETH_Flow_Points:
- type: string
- ATT_NAME:
- description: |
- Name of the pet
- type: string
- MapTest:
- type: object
- properties:
- map_map_of_string:
- type: object
- additionalProperties:
- type: object
- additionalProperties:
- type: string
- map_of_enum_string:
- type: object
- additionalProperties:
- type: string
- enum:
- - UPPER
- - lower
- direct_map:
- type: object
- additionalProperties:
- type: boolean
- indirect_map:
- $ref: '#/components/schemas/StringBooleanMap'
- ArrayTest:
- type: object
- properties:
- array_of_string:
- type: array
- items:
- type: string
- array_array_of_integer:
- type: array
- items:
- type: array
- items:
- type: integer
- format: int64
- array_array_of_model:
- type: array
- items:
- type: array
- items:
- $ref: '#/components/schemas/ReadOnlyFirst'
- NumberOnly:
- type: object
- properties:
- JustNumber:
- type: number
- ArrayOfNumberOnly:
- type: object
- properties:
- ArrayNumber:
- type: array
- items:
- type: number
- ArrayOfArrayOfNumberOnly:
- type: object
- properties:
- ArrayArrayNumber:
- type: array
- items:
- type: array
- items:
- type: number
- EnumArrays:
- type: object
- properties:
- just_symbol:
- type: string
- enum:
- - '>='
- - $
- array_enum:
- type: array
- items:
- type: string
- enum:
- - fish
- - crab
- OuterEnum:
- nullable: true
- type: string
- enum:
- - placed
- - approved
- - delivered
- OuterEnumInteger:
- type: integer
- enum:
- - 0
- - 1
- - 2
- OuterEnumDefaultValue:
- type: string
- enum:
- - placed
- - approved
- - delivered
- default: placed
- OuterEnumIntegerDefaultValue:
- type: integer
- enum:
- - 0
- - 1
- - 2
- default: 0
- OuterComposite:
- type: object
- properties:
- my_number:
- $ref: '#/components/schemas/OuterNumber'
- my_string:
- $ref: '#/components/schemas/OuterString'
- my_boolean:
- $ref: '#/components/schemas/OuterBoolean'
- OuterNumber:
- type: number
- OuterString:
- type: string
- OuterBoolean:
- type: boolean
- x-codegen-body-parameter-name: boolean_post_body
- StringBooleanMap:
- additionalProperties:
- type: boolean
- FileSchemaTestClass:
- type: object
- properties:
- file:
- $ref: '#/components/schemas/File'
- files:
- type: array
- items:
- $ref: '#/components/schemas/File'
- File:
- type: object
- description: Must be named `File` for test.
- properties:
- sourceURI:
- description: Test capitalization
- type: string
- _special_model.name_:
- properties:
- '$special[property.name]':
- type: integer
- format: int64
- '_special_model.name_':
- type: string
- xml:
- name: '$special[model.name]'
- HealthCheckResult:
- type: object
- properties:
- NullableMessage:
- nullable: true
- type: string
- description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
- NullableClass:
- type: object
- properties:
- integer_prop:
- type: integer
- nullable: true
- number_prop:
- type: number
- nullable: true
- boolean_prop:
- type: boolean
- nullable: true
- string_prop:
- type: string
- nullable: true
- date_prop:
- type: string
- format: date
- nullable: true
- datetime_prop:
- type: string
- format: date-time
- nullable: true
- array_nullable_prop:
- type: array
- nullable: true
- items:
- type: object
- array_and_items_nullable_prop:
- type: array
- nullable: true
- items:
- type: object
- nullable: true
- array_items_nullable:
- type: array
- items:
- type: object
- nullable: true
- object_nullable_prop:
- type: object
- nullable: true
- additionalProperties:
- type: object
- object_and_items_nullable_prop:
- type: object
- nullable: true
- additionalProperties:
- type: object
- nullable: true
- object_items_nullable:
- type: object
- additionalProperties:
- type: object
- nullable: true
- additionalProperties:
- type: object
- nullable: true
- fruit:
- properties:
- color:
- type: string
- oneOf:
- - $ref: '#/components/schemas/apple'
- - $ref: '#/components/schemas/banana'
- # Below additionalProperties is set to false to validate the use
- # case when a composed schema has additionalProperties set to false.
- additionalProperties: false
- apple:
- type: object
- properties:
- cultivar:
- type: string
- pattern: ^[a-zA-Z\s]*$
- origin:
- type: string
- pattern: /^[A-Z\s]*$/i
- nullable: true
- banana:
- type: object
- properties:
- lengthCm:
- type: number
- mammal:
- oneOf:
- - $ref: '#/components/schemas/whale'
- - $ref: '#/components/schemas/zebra'
- - $ref: '#/components/schemas/Pig'
- discriminator:
- propertyName: className
- whale:
- type: object
- properties:
- hasBaleen:
- type: boolean
- hasTeeth:
- type: boolean
- className:
- type: string
- required:
- - className
- zebra:
- type: object
- properties:
- type:
- type: string
- enum:
- - plains
- - mountain
- - grevys
- className:
- type: string
- required:
- - className
- additionalProperties: true
- Pig:
- oneOf:
- - $ref: '#/components/schemas/BasquePig'
- - $ref: '#/components/schemas/DanishPig'
- discriminator:
- propertyName: className
- BasquePig:
- type: object
- properties:
- className:
- type: string
- required:
- - className
- DanishPig:
- type: object
- properties:
- className:
- type: string
- required:
- - className
- gmFruit:
- properties:
- color:
- type: string
- anyOf:
- - $ref: '#/components/schemas/apple'
- - $ref: '#/components/schemas/banana'
- additionalProperties: false
- fruitReq:
- oneOf:
- - type: 'null'
- - $ref: '#/components/schemas/appleReq'
- - $ref: '#/components/schemas/bananaReq'
- additionalProperties: false
- appleReq:
- type: object
- properties:
- cultivar:
- type: string
- mealy:
- type: boolean
- required:
- - cultivar
- additionalProperties: false
- bananaReq:
- type: object
- properties:
- lengthCm:
- type: number
- sweet:
- type: boolean
- required:
- - lengthCm
- additionalProperties: false
- # go-experimental is unable to make Triangle and Quadrilateral models
- # correctly https://github.com/OpenAPITools/openapi-generator/issues/6149
- Drawing:
- type: object
- properties:
- mainShape:
- # A property whose value is a 'oneOf' type, and the type is referenced instead
- # of being defined inline. The value cannot be null.
- $ref: '#/components/schemas/Shape'
- shapeOrNull:
- # A property whose value is a 'oneOf' type, and the type is referenced instead
- # of being defined inline. The value may be null because ShapeOrNull has 'null'
- # type as a child schema of 'oneOf'.
- $ref: '#/components/schemas/ShapeOrNull'
- nullableShape:
- # A property whose value is a 'oneOf' type, and the type is referenced instead
- # of being defined inline. The value may be null because NullableShape has the
- # 'nullable: true' attribute. For this specific scenario this is exactly the
- # same thing as 'shapeOrNull'.
- $ref: '#/components/schemas/NullableShape'
- shapes:
- type: array
- items:
- $ref: '#/components/schemas/Shape'
- additionalProperties:
- # Here the additional properties are specified using a referenced schema.
- # This is just to validate the generated code works when using $ref
- # under 'additionalProperties'.
- $ref: '#/components/schemas/fruit'
- Shape:
- oneOf:
- - $ref: '#/components/schemas/Triangle'
- - $ref: '#/components/schemas/Quadrilateral'
- discriminator:
- propertyName: shapeType
- ShapeOrNull:
- description: The value may be a shape or the 'null' value.
- This is introduced in OAS schema >= 3.1.
- oneOf:
- - type: 'null'
- - $ref: '#/components/schemas/Triangle'
- - $ref: '#/components/schemas/Quadrilateral'
- discriminator:
- propertyName: shapeType
- NullableShape:
- description: The value may be a shape or the 'null' value.
- The 'nullable' attribute was introduced in OAS schema >= 3.0
- and has been deprecated in OAS schema >= 3.1.
- oneOf:
- - $ref: '#/components/schemas/Triangle'
- - $ref: '#/components/schemas/Quadrilateral'
- discriminator:
- propertyName: shapeType
- nullable: true
- ShapeInterface:
- properties:
- shapeType:
- type: string
- required:
- - shapeType
- TriangleInterface:
- properties:
- triangleType:
- type: string
- required:
- - triangleType
- Triangle:
- oneOf:
- - $ref: '#/components/schemas/EquilateralTriangle'
- - $ref: '#/components/schemas/IsoscelesTriangle'
- - $ref: '#/components/schemas/ScaleneTriangle'
- discriminator:
- propertyName: triangleType
- # Note: the 'additionalProperties' keyword is not specified, which is
- # equivalent to allowing undeclared properties of any type.
- EquilateralTriangle:
- allOf:
- - $ref: '#/components/schemas/ShapeInterface'
- - $ref: '#/components/schemas/TriangleInterface'
- IsoscelesTriangle:
- allOf:
- - $ref: '#/components/schemas/ShapeInterface'
- - $ref: '#/components/schemas/TriangleInterface'
- additionalProperties: false
- ScaleneTriangle:
- allOf:
- - $ref: '#/components/schemas/ShapeInterface'
- - $ref: '#/components/schemas/TriangleInterface'
- QuadrilateralInterface:
- properties:
- quadrilateralType:
- type: string
- required:
- - quadrilateralType
- Quadrilateral:
- oneOf:
- - $ref: '#/components/schemas/SimpleQuadrilateral'
- - $ref: '#/components/schemas/ComplexQuadrilateral'
- discriminator:
- propertyName: quadrilateralType
- SimpleQuadrilateral:
- allOf:
- - $ref: '#/components/schemas/ShapeInterface'
- - $ref: '#/components/schemas/QuadrilateralInterface'
- ComplexQuadrilateral:
- allOf:
- - $ref: '#/components/schemas/ShapeInterface'
- - $ref: '#/components/schemas/QuadrilateralInterface'
- GrandparentAnimal:
- type: object
- required:
- - pet_type
- properties:
- pet_type:
- type: string
- discriminator:
- propertyName: pet_type
- ParentPet:
- type: object
- allOf:
- - $ref: '#/components/schemas/GrandparentAnimal'
- ChildCat:
- allOf:
- - $ref: '#/components/schemas/ParentPet'
- - type: object
- properties:
- name:
- type: string
- pet_type:
- x-enum-as-string: true
- type: string
- enum:
- - ChildCat
- default: ChildCat
- ArrayOfEnums:
- type: array
- items:
- $ref: '#/components/schemas/OuterEnum'
- DateTimeTest:
- type: string
- default: '2010-01-01T10:10:10.000111+01:00'
- example: '2010-01-01T10:10:10.000111+01:00'
- format: date-time
- DeprecatedObject:
- type: object
- deprecated: true
- properties:
- name:
- type: string
- ObjectWithDeprecatedFields:
- type: object
- properties:
- uuid:
- type: string
- id:
- type: number
- deprecated: true
- deprecatedRef:
- $ref: '#/components/schemas/DeprecatedObject'
- bars:
- type: array
- deprecated: true
- items:
- $ref: '#/components/schemas/Bar'
- #PolymorphicProperty:
- # oneOf:
- # - type: boolean
- # - type: string
- # - type: object
- # - type: array
- # items:
- # $ref: '#/components/schemas/StringArrayItem'
- #StringArrayItem:
- # type: string
- # format: string
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES
index e0849670523..e19a38918ec 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES
@@ -69,6 +69,7 @@ docs/models/OuterEnumIntegerDefaultValue.md
docs/models/ParentPet.md
docs/models/Pet.md
docs/models/Pig.md
+docs/models/PolymorphicProperty.md
docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
@@ -174,6 +175,7 @@ src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
src/Org.OpenAPITools/Model/ParentPet.cs
src/Org.OpenAPITools/Model/Pet.cs
src/Org.OpenAPITools/Model/Pig.cs
+src/Org.OpenAPITools/Model/PolymorphicProperty.cs
src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/PolymorphicProperty.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/PolymorphicProperty.md
new file mode 100644
index 00000000000..4507ec41cd5
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/PolymorphicProperty.md
@@ -0,0 +1,9 @@
+# Org.OpenAPITools.Model.PolymorphicProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
+
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs
new file mode 100644
index 00000000000..eff3c6ddc9b
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs
@@ -0,0 +1,62 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using Xunit;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test.Model
+{
+ ///
+ /// Class for testing PolymorphicProperty
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class PolymorphicPropertyTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for PolymorphicProperty
+ //private PolymorphicProperty instance;
+
+ public PolymorphicPropertyTests()
+ {
+ // TODO uncomment below to create an instance of PolymorphicProperty
+ //instance = new PolymorphicProperty();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of PolymorphicProperty
+ ///
+ [Fact]
+ public void PolymorphicPropertyInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" PolymorphicProperty
+ //Assert.IsType(instance);
+ }
+
+
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 5a478f6ef80..d0346cfb491 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -51,7 +51,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
_jsonOptions.Converters.Add(new MammalJsonConverter());
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
+ _jsonOptions.Converters.Add(new ParentPetJsonConverter());
_jsonOptions.Converters.Add(new PigJsonConverter());
+ _jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter());
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
_jsonOptions.Converters.Add(new ShapeJsonConverter());
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs
index 51022bffef0..b18b39a2c74 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs
@@ -34,18 +34,25 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// catAllOf
+ ///
+ ///
/// className (required)
/// color (default to "red")
- public Cat(CatAllOf? catAllOf, string className, string? color = "red") : base(className, color)
+ public Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string? color = "red") : base(className, color)
{
+ Dictionary = dictionary;
CatAllOf = catAllOf;
}
///
- /// Gets or Sets Cat
+ /// Gets or Sets Dictionary
///
- public CatAllOf? CatAllOf { get; set; }
+ public Dictionary Dictionary { get; set; }
+
+ ///
+ /// Gets or Sets CatAllOf
+ ///
+ public CatAllOf CatAllOf { get; set; }
///
/// Returns the string presentation of the object
@@ -122,8 +129,12 @@ namespace Org.OpenAPITools.Model
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
+ Utf8JsonReader dictionaryReader = reader;
+ bool dictionaryDeserialized = Client.ClientUtils.TryDeserialize>(ref dictionaryReader, options, out Dictionary? dictionary);
+
Utf8JsonReader catAllOfReader = reader;
- Client.ClientUtils.TryDeserialize(ref catAllOfReader, options, out CatAllOf? catAllOf);
+ bool catAllOfDeserialized = Client.ClientUtils.TryDeserialize(ref catAllOfReader, options, out CatAllOf? catAllOf);
+
string? className = default;
string? color = default;
@@ -149,7 +160,7 @@ namespace Org.OpenAPITools.Model
}
}
- return new Cat(catAllOf, className, color);
+ return new Cat(dictionary, catAllOf, className, color);
}
///
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs
index fa07814bc38..57c72e45da9 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs
@@ -34,17 +34,17 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// childCatAllOf
+ ///
/// petType (required)
- public ChildCat(ChildCatAllOf? childCatAllOf, string petType) : base(petType)
+ public ChildCat(ChildCatAllOf childCatAllOf, string petType) : base(petType)
{
ChildCatAllOf = childCatAllOf;
}
///
- /// Gets or Sets ChildCat
+ /// Gets or Sets ChildCatAllOf
///
- public ChildCatAllOf? ChildCatAllOf { get; set; }
+ public ChildCatAllOf ChildCatAllOf { get; set; }
///
/// Returns the string presentation of the object
@@ -122,7 +122,8 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader childCatAllOfReader = reader;
- Client.ClientUtils.TryDeserialize(ref childCatAllOfReader, options, out ChildCatAllOf? childCatAllOf);
+ bool childCatAllOfDeserialized = Client.ClientUtils.TryDeserialize(ref childCatAllOfReader, options, out ChildCatAllOf? childCatAllOf);
+
string? petType = default;
while (reader.Read())
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
index 1e0b81090a5..1a3fe55f3c5 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
@@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// quadrilateralInterface
- /// shapeInterface
- public ComplexQuadrilateral(QuadrilateralInterface? quadrilateralInterface, ShapeInterface? shapeInterface)
+ ///
+ ///
+ public ComplexQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
{
- QuadrilateralInterface = quadrilateralInterface;
ShapeInterface = shapeInterface;
+ QuadrilateralInterface = quadrilateralInterface;
}
///
- /// Gets or Sets ComplexQuadrilateral
+ /// Gets or Sets ShapeInterface
///
- public QuadrilateralInterface? QuadrilateralInterface { get; set; }
+ public ShapeInterface ShapeInterface { get; set; }
///
- /// Gets or Sets ComplexQuadrilateral
+ /// Gets or Sets QuadrilateralInterface
///
- public ShapeInterface? ShapeInterface { get; set; }
+ public QuadrilateralInterface QuadrilateralInterface { get; set; }
///
/// Gets or Sets additional properties
@@ -146,10 +146,12 @@ namespace Org.OpenAPITools.Model
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
- Utf8JsonReader quadrilateralInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
Utf8JsonReader shapeInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+ bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+
+ Utf8JsonReader quadrilateralInterfaceReader = reader;
+ bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
+
while (reader.Read())
{
@@ -167,7 +169,7 @@ namespace Org.OpenAPITools.Model
}
}
- return new ComplexQuadrilateral(quadrilateralInterface, shapeInterface);
+ return new ComplexQuadrilateral(shapeInterface, quadrilateralInterface);
}
///
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs
index 9ec60e67ab8..7ce3f26883b 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs
@@ -34,18 +34,18 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// dogAllOf
+ ///
/// className (required)
/// color (default to "red")
- public Dog(DogAllOf? dogAllOf, string className, string? color = "red") : base(className, color)
+ public Dog(DogAllOf dogAllOf, string className, string? color = "red") : base(className, color)
{
DogAllOf = dogAllOf;
}
///
- /// Gets or Sets Dog
+ /// Gets or Sets DogAllOf
///
- public DogAllOf? DogAllOf { get; set; }
+ public DogAllOf DogAllOf { get; set; }
///
/// Returns the string presentation of the object
@@ -123,7 +123,8 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader dogAllOfReader = reader;
- Client.ClientUtils.TryDeserialize(ref dogAllOfReader, options, out DogAllOf? dogAllOf);
+ bool dogAllOfDeserialized = Client.ClientUtils.TryDeserialize(ref dogAllOfReader, options, out DogAllOf? dogAllOf);
+
string? className = default;
string? color = default;
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs
index 85657bffeb4..8a4946d99b8 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs
@@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// shapeInterface
- /// triangleInterface
- public EquilateralTriangle(ShapeInterface? shapeInterface, TriangleInterface? triangleInterface)
+ ///
+ ///
+ public EquilateralTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
{
ShapeInterface = shapeInterface;
TriangleInterface = triangleInterface;
}
///
- /// Gets or Sets EquilateralTriangle
+ /// Gets or Sets ShapeInterface
///
- public ShapeInterface? ShapeInterface { get; set; }
+ public ShapeInterface ShapeInterface { get; set; }
///
- /// Gets or Sets EquilateralTriangle
+ /// Gets or Sets TriangleInterface
///
- public TriangleInterface? TriangleInterface { get; set; }
+ public TriangleInterface TriangleInterface { get; set; }
///
/// Gets or Sets additional properties
@@ -147,9 +147,11 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader shapeInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+ bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+
Utf8JsonReader triangleInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
+ bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
+
while (reader.Read())
{
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs
index 081a09bce7d..4e173ba6d51 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs
@@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// apple
+ ///
/// color
public Fruit(Apple? apple, string? color = default)
{
@@ -45,23 +45,23 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// banana
+ ///
/// color
- public Fruit(Banana? banana, string? color = default)
+ public Fruit(Banana banana, string? color = default)
{
Banana = banana;
Color = color;
}
///
- /// Gets or Sets fruit
+ /// Gets or Sets Apple
///
public Apple? Apple { get; set; }
///
- /// Gets or Sets fruit
+ /// Gets or Sets Banana
///
- public Banana? Banana { get; set; }
+ public Banana Banana { get; set; }
///
/// Gets or Sets Color
@@ -158,10 +158,10 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader appleReader = reader;
- Client.ClientUtils.TryDeserialize(ref appleReader, options, out Apple? apple);
+ bool appleDeserialized = Client.ClientUtils.TryDeserialize(ref appleReader, options, out Apple? apple);
Utf8JsonReader bananaReader = reader;
- Client.ClientUtils.TryDeserialize(ref bananaReader, options, out Banana? banana);
+ bool bananaDeserialized = Client.ClientUtils.TryDeserialize(ref bananaReader, options, out Banana? banana);
string? color = default;
@@ -184,10 +184,10 @@ namespace Org.OpenAPITools.Model
}
}
- if (apple != null)
+ if (appleDeserialized)
return new Fruit(apple, color);
- if (banana != null)
+ if (bananaDeserialized)
return new Fruit(banana, color);
throw new JsonException();
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs
index d6aed82b9ca..98f30ed1e7d 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs
@@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// appleReq
- public FruitReq(AppleReq? appleReq)
+ ///
+ public FruitReq(AppleReq appleReq)
{
AppleReq = appleReq;
}
@@ -43,21 +43,21 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// bananaReq
- public FruitReq(BananaReq? bananaReq)
+ ///
+ public FruitReq(BananaReq bananaReq)
{
BananaReq = bananaReq;
}
///
- /// Gets or Sets fruitReq
+ /// Gets or Sets AppleReq
///
- public AppleReq? AppleReq { get; set; }
+ public AppleReq AppleReq { get; set; }
///
- /// Gets or Sets fruitReq
+ /// Gets or Sets BananaReq
///
- public BananaReq? BananaReq { get; set; }
+ public BananaReq BananaReq { get; set; }
///
/// Returns the string presentation of the object
@@ -143,10 +143,10 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader appleReqReader = reader;
- Client.ClientUtils.TryDeserialize(ref appleReqReader, options, out AppleReq? appleReq);
+ bool appleReqDeserialized = Client.ClientUtils.TryDeserialize(ref appleReqReader, options, out AppleReq? appleReq);
Utf8JsonReader bananaReqReader = reader;
- Client.ClientUtils.TryDeserialize(ref bananaReqReader, options, out BananaReq? bananaReq);
+ bool bananaReqDeserialized = Client.ClientUtils.TryDeserialize(ref bananaReqReader, options, out BananaReq? bananaReq);
while (reader.Read())
@@ -165,10 +165,10 @@ namespace Org.OpenAPITools.Model
}
}
- if (appleReq != null)
+ if (appleReqDeserialized)
return new FruitReq(appleReq);
- if (bananaReq != null)
+ if (bananaReqDeserialized)
return new FruitReq(bananaReq);
throw new JsonException();
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs
index dafca39bc42..bdb883115d6 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs
@@ -34,25 +34,25 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// apple
- /// banana
+ ///
+ ///
/// color
- public GmFruit(Apple? apple, Banana? banana, string? color = default)
+ public GmFruit(Apple? apple, Banana banana, string? color = default)
{
- Apple = apple;
- Banana = banana;
+ Apple = Apple;
+ Banana = Banana;
Color = color;
}
///
- /// Gets or Sets gmFruit
+ /// Gets or Sets Apple
///
public Apple? Apple { get; set; }
///
- /// Gets or Sets gmFruit
+ /// Gets or Sets Banana
///
- public Banana? Banana { get; set; }
+ public Banana Banana { get; set; }
///
/// Gets or Sets Color
@@ -149,10 +149,10 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader appleReader = reader;
- Client.ClientUtils.TryDeserialize(ref appleReader, options, out Apple? apple);
+ bool appleDeserialized = Client.ClientUtils.TryDeserialize(ref appleReader, options, out Apple? apple);
Utf8JsonReader bananaReader = reader;
- Client.ClientUtils.TryDeserialize(ref bananaReader, options, out Banana? banana);
+ bool bananaDeserialized = Client.ClientUtils.TryDeserialize(ref bananaReader, options, out Banana? banana);
string? color = default;
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs
index a4bb6f1fd2b..e207d964b03 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs
@@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// shapeInterface
- /// triangleInterface
- public IsoscelesTriangle(ShapeInterface? shapeInterface, TriangleInterface? triangleInterface)
+ ///
+ ///
+ public IsoscelesTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
{
ShapeInterface = shapeInterface;
TriangleInterface = triangleInterface;
}
///
- /// Gets or Sets IsoscelesTriangle
+ /// Gets or Sets ShapeInterface
///
- public ShapeInterface? ShapeInterface { get; set; }
+ public ShapeInterface ShapeInterface { get; set; }
///
- /// Gets or Sets IsoscelesTriangle
+ /// Gets or Sets TriangleInterface
///
- public TriangleInterface? TriangleInterface { get; set; }
+ public TriangleInterface TriangleInterface { get; set; }
///
/// Returns the string presentation of the object
@@ -136,9 +136,11 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader shapeInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+ bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
+
Utf8JsonReader triangleInterfaceReader = reader;
- Client.ClientUtils.TryDeserialize(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
+ bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
+
while (reader.Read())
{
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs
index 3ee8383a14f..f7ca7b5b607 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs
@@ -34,17 +34,8 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// pig
- public Mammal(Pig? pig)
- {
- Pig = pig;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// whale
- public Mammal(Whale? whale)
+ ///
+ public Mammal(Whale whale)
{
Whale = whale;
}
@@ -52,26 +43,35 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// zebra
- public Mammal(Zebra? zebra)
+ ///
+ public Mammal(Zebra zebra)
{
Zebra = zebra;
}
///
- /// Gets or Sets mammal
+ /// Initializes a new instance of the class.
///
- public Pig? Pig { get; set; }
+ ///
+ public Mammal(Pig pig)
+ {
+ Pig = pig;
+ }
///
- /// Gets or Sets mammal
+ /// Gets or Sets Whale
///
- public Whale? Whale { get; set; }
+ public Whale Whale { get; set; }
///
- /// Gets or Sets mammal
+ /// Gets or Sets Zebra
///
- public Zebra? Zebra { get; set; }
+ public Zebra Zebra { get; set; }
+
+ ///
+ /// Gets or Sets Pig
+ ///
+ public Pig Pig { get; set; }
///
/// Gets or Sets additional properties
@@ -177,14 +177,14 @@ namespace Org.OpenAPITools.Model
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
- Utf8JsonReader pigReader = reader;
- Client.ClientUtils.TryDeserialize(ref pigReader, options, out Pig? pig);
-
Utf8JsonReader whaleReader = reader;
- Client.ClientUtils.TryDeserialize(ref whaleReader, options, out Whale? whale);
+ bool whaleDeserialized = Client.ClientUtils.TryDeserialize(ref whaleReader, options, out Whale? whale);
Utf8JsonReader zebraReader = reader;
- Client.ClientUtils.TryDeserialize(ref zebraReader, options, out Zebra? zebra);
+ bool zebraDeserialized = Client.ClientUtils.TryDeserialize(ref zebraReader, options, out Zebra? zebra);
+
+ Utf8JsonReader pigReader = reader;
+ bool pigDeserialized = Client.ClientUtils.TryDeserialize(ref pigReader, options, out Pig? pig);
while (reader.Read())
@@ -203,15 +203,15 @@ namespace Org.OpenAPITools.Model
}
}
- if (pig != null)
- return new Mammal(pig);
-
- if (whale != null)
+ if (whaleDeserialized)
return new Mammal(whale);
- if (zebra != null)
+ if (zebraDeserialized)
return new Mammal(zebra);
+ if (pigDeserialized)
+ return new Mammal(pig);
+
throw new JsonException();
}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs
index 0fe8fac635e..f5eb1bcd8ec 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs
@@ -34,32 +34,30 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// quadrilateral
- public NullableShape(Quadrilateral? quadrilateral)
- {
- Quadrilateral = quadrilateral;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// triangle
- public NullableShape(Triangle? triangle)
+ ///
+ public NullableShape(Triangle triangle)
{
Triangle = triangle;
}
///
- /// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
+ /// Initializes a new instance of the class.
///
- /// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
- public Quadrilateral? Quadrilateral { get; set; }
+ ///
+ public NullableShape(Quadrilateral quadrilateral)
+ {
+ Quadrilateral = quadrilateral;
+ }
///
- /// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
+ /// Gets or Sets Triangle
///
- /// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
- public Triangle? Triangle { get; set; }
+ public Triangle Triangle { get; set; }
+
+ ///
+ /// Gets or Sets Quadrilateral
+ ///
+ public Quadrilateral Quadrilateral { get; set; }
///
/// Gets or Sets additional properties
@@ -165,11 +163,11 @@ namespace Org.OpenAPITools.Model
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
- Utf8JsonReader quadrilateralReader = reader;
- Client.ClientUtils.TryDeserialize(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
-
Utf8JsonReader triangleReader = reader;
- Client.ClientUtils.TryDeserialize(ref triangleReader, options, out Triangle? triangle);
+ bool triangleDeserialized = Client.ClientUtils.TryDeserialize(ref triangleReader, options, out Triangle? triangle);
+
+ Utf8JsonReader quadrilateralReader = reader;
+ bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
while (reader.Read())
@@ -188,12 +186,12 @@ namespace Org.OpenAPITools.Model
}
}
- if (quadrilateral != null)
- return new NullableShape(quadrilateral);
-
- if (triangle != null)
+ if (triangleDeserialized)
return new NullableShape(triangle);
+ if (quadrilateralDeserialized)
+ return new NullableShape(quadrilateral);
+
throw new JsonException();
}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs
index 2f3aeeda770..58475dcfe23 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs
@@ -87,4 +87,64 @@ namespace Org.OpenAPITools.Model
}
+ ///
+ /// A Json converter for type ParentPet
+ ///
+ public class ParentPetJsonConverter : JsonConverter
+ {
+ ///
+ /// Returns a boolean if the type is compatible with this converter.
+ ///
+ ///
+ ///
+ public override bool CanConvert(Type typeToConvert) => typeof(ParentPet).IsAssignableFrom(typeToConvert);
+
+ ///
+ /// A Json reader.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override ParentPet Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ int currentDepth = reader.CurrentDepth;
+
+ if (reader.TokenType != JsonTokenType.StartObject)
+ throw new JsonException();
+
+ string? petType = default;
+
+ while (reader.Read())
+ {
+ if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
+ break;
+
+ if (reader.TokenType == JsonTokenType.PropertyName)
+ {
+ string? propertyName = reader.GetString();
+ reader.Read();
+
+ switch (propertyName)
+ {
+ case "pet_type":
+ petType = reader.GetString();
+ break;
+ }
+ }
+ }
+
+ return new ParentPet(petType);
+ }
+
+ ///
+ /// A Json writer
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions options) => throw new NotImplementedException();
+ }
}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs
index 35b4df7d509..e80f7c4c372 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs
@@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// basquePig
- public Pig(BasquePig? basquePig)
+ ///
+ public Pig(BasquePig basquePig)
{
BasquePig = basquePig;
}
@@ -43,21 +43,21 @@ namespace Org.OpenAPITools.Model
///
/// Initializes a new instance of the class.
///
- /// danishPig
- public Pig(DanishPig? danishPig)
+ ///
+ public Pig(DanishPig danishPig)
{
DanishPig = danishPig;
}
///
- /// Gets or Sets Pig
+ /// Gets or Sets BasquePig
///
- public BasquePig? BasquePig { get; set; }
+ public BasquePig BasquePig { get; set; }
///
- /// Gets or Sets Pig
+ /// Gets or Sets DanishPig
///
- public DanishPig? DanishPig { get; set; }
+ public DanishPig DanishPig { get; set; }
///
/// Gets or Sets additional properties
@@ -164,10 +164,10 @@ namespace Org.OpenAPITools.Model
throw new JsonException();
Utf8JsonReader basquePigReader = reader;
- Client.ClientUtils.TryDeserialize(ref basquePigReader, options, out BasquePig? basquePig);
+ bool basquePigDeserialized = Client.ClientUtils.TryDeserialize(ref basquePigReader, options, out BasquePig? basquePig);
Utf8JsonReader danishPigReader = reader;
- Client.ClientUtils.TryDeserialize(ref danishPigReader, options, out DanishPig? danishPig);
+ bool danishPigDeserialized = Client.ClientUtils.TryDeserialize(ref danishPigReader, options, out DanishPig? danishPig);
while (reader.Read())
@@ -186,10 +186,10 @@ namespace Org.OpenAPITools.Model
}
}
- if (basquePig != null)
+ if (basquePigDeserialized)
return new Pig(basquePig);
- if (danishPig != null)
+ if (danishPigDeserialized)
return new Pig(danishPig);
throw new JsonException();
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs
new file mode 100644
index 00000000000..b9bc60379ae
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs
@@ -0,0 +1,237 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// PolymorphicProperty
+ ///
+ public partial class PolymorphicProperty : IEquatable, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public PolymorphicProperty(bool _bool)
+ {
+ Bool = _bool;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public PolymorphicProperty(string _string)
+ {
+ String = _string;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public PolymorphicProperty(Object _object)
+ {
+ Object = _object;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public PolymorphicProperty(List liststring)
+ {
+ Liststring = liststring;
+ }
+
+ ///
+ /// Gets or Sets Bool
+ ///
+ public bool Bool { get; set; }
+
+ ///
+ /// Gets or Sets String
+ ///
+ public string String { get; set; }
+
+ ///
+ /// Gets or Sets Object
+ ///
+ public Object Object { get; set; }
+
+ ///
+ /// Gets or Sets Liststring
+ ///
+ public List Liststring { get; set; }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; set; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class PolymorphicProperty {\n");
+ sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object? input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input as PolymorphicProperty).AreEqual;
+ }
+
+ ///
+ /// Returns true if PolymorphicProperty instances are equal
+ ///
+ /// Instance of PolymorphicProperty to be compared
+ /// Boolean
+ public bool Equals(PolymorphicProperty? input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ if (this.AdditionalProperties != null)
+ {
+ hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
+ }
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type PolymorphicProperty
+ ///
+ public class PolymorphicPropertyJsonConverter : JsonConverter
+ {
+ ///
+ /// Returns a boolean if the type is compatible with this converter.
+ ///
+ ///
+ ///
+ public override bool CanConvert(Type typeToConvert) => typeof(PolymorphicProperty).IsAssignableFrom(typeToConvert);
+
+ ///
+ /// A Json reader.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override PolymorphicProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ int currentDepth = reader.CurrentDepth;
+
+ if (reader.TokenType != JsonTokenType.StartObject)
+ throw new JsonException();
+
+ Utf8JsonReader _boolReader = reader;
+ bool _boolDeserialized = Client.ClientUtils.TryDeserialize(ref _boolReader, options, out bool _bool);
+
+ Utf8JsonReader _stringReader = reader;
+ bool _stringDeserialized = Client.ClientUtils.TryDeserialize(ref _stringReader, options, out string? _string);
+
+ Utf8JsonReader _objectReader = reader;
+ bool _objectDeserialized = Client.ClientUtils.TryDeserialize