diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache
index a808b9c161a..7e318b309c9 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache
@@ -1,3 +1,4 @@
+{{#model}}
///
/// {{description}}{{^description}}{{classname}}{{/description}}
///
@@ -22,20 +23,22 @@
}
{{/isNullable}}
- {{#anyOf}}
+ {{#composedSchemas.anyOf}}
+ {{^isNull}}
///
/// Initializes a new instance of the class
- /// with the class
+ /// with the class
///
- /// An instance of {{{.}}}.
- public {{classname}}({{{.}}} actualInstance)
+ /// An instance of {{dataType}}.
+ public {{classname}}({{{dataType}}} actualInstance)
{
- this.IsNullable = {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}};
+ this.IsNullable = {{#model.isNullable}}true{{/model.isNullable}}{{^model.isNullable}}false{{/model.isNullable}};
this.SchemaType= "anyOf";
- this.ActualInstance = actualInstance{{^isNullable}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isNullable}};
+ this.ActualInstance = actualInstance{{^model.isNullable}}{{^isPrimitiveType}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isPrimitiveType}}{{#isPrimitiveType}}{{#isArray}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isArray}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isFreeFormObject}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isFreeFormObject}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isString}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isString}}{{/isPrimitiveType}}{{/model.isNullable}};
}
- {{/anyOf}}
+ {{/isNull}}
+ {{/composedSchemas.anyOf}}
private Object _actualInstance;
@@ -62,18 +65,20 @@
}
}
}
- {{#anyOf}}
+ {{#composedSchemas.anyOf}}
+ {{^isNull}}
///
- /// Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`,
+ /// Get the actual instance of `{{dataType}}`. If the actual instance is not `{{dataType}}`,
/// the InvalidClassException will be thrown
///
- /// An instance of {{{.}}}
- public {{{.}}} Get{{{.}}}()
+ /// An instance of {{dataType}}
+ public {{{dataType}}} Get{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{#isArray}}{{#lambda.titlecase}}{{{dataFormat}}}{{/lambda.titlecase}}{{/isArray}}()
{
- return ({{{.}}})this.ActualInstance;
+ return ({{{dataType}}})this.ActualInstance;
}
- {{/anyOf}}
+ {{/isNull}}
+ {{/composedSchemas.anyOf}}
///
/// Returns the string presentation of the object
@@ -233,3 +238,4 @@
return false;
}
}
+{{/model}}
\ No newline at end of file