diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache index 0de1e05e5140..f84de7f64327 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache @@ -1,19 +1,22 @@ {{>partial_header}} +{{#models}} +{{#model}} using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; +{{#vendorExtensions.x-com-visible}} +using System.Runtime.InteropServices; +{{/vendorExtensions.x-com-visible}} using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; -{{#models}} -{{#model}} {{#discriminator}} using JsonSubTypes; {{/discriminator}} @@ -34,11 +37,11 @@ using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; using System.Reflection; {{/-first}} {{/oneOf}} -{{#aneOf}} +{{#anyOf}} {{#-first}} using System.Reflection; {{/-first}} -{{/aneOf}} +{{/anyOf}} namespace {{packageName}}.{{modelPackage}} { diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache index 339a6d2f76b7..0d0c0b683541 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache @@ -1,19 +1,22 @@ {{>partial_header}} +{{#models}} +{{#model}} using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; +{{#vendorExtensions.x-com-visible}} +using System.Runtime.InteropServices; +{{/vendorExtensions.x-com-visible}} using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; -{{#models}} -{{#model}} {{#discriminator}} using JsonSubTypes; {{/discriminator}} @@ -33,11 +36,11 @@ using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; using System.Reflection; {{/-first}} {{/oneOf}} -{{#aneOf}} +{{#anyOf}} {{#-first}} using System.Reflection; {{/-first}} -{{/aneOf}} +{{/anyOf}} namespace {{packageName}}.{{modelPackage}} { 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 d889a3e1fda6..a808b9c161a5 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelAnyOf.mustache @@ -1,6 +1,12 @@ /// /// {{description}}{{^description}}{{classname}}{{/description}} /// + {{#vendorExtensions.x-cls-compliant}} + [CLSCompliant({{{.}}})] + {{/vendorExtensions.x-cls-compliant}} + {{#vendorExtensions.x-com-visible}} + [ComVisible({{{.}}})] + {{/vendorExtensions.x-com-visible}} [JsonConverter(typeof({{classname}}JsonConverter))] [DataContract(Name = "{{{name}}}")] {{>visibility}} partial class {{classname}} : AbstractOpenAPISchema, {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/modelEnum.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/modelEnum.mustache index c993fc2cc3d6..514542d70e4f 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelEnum.mustache @@ -4,6 +4,12 @@ {{#description}} /// {{.}} {{/description}} + {{#vendorExtensions.x-cls-compliant}} + [CLSCompliant({{{.}}})] + {{/vendorExtensions.x-cls-compliant}} + {{#vendorExtensions.x-com-visible}} + [ComVisible({{{.}}})] + {{/vendorExtensions.x-com-visible}} {{#allowableValues}} {{#enumVars}} {{#-first}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache index 2fb5ecc51a89..a998c81e7c67 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache @@ -1,6 +1,12 @@ /// /// {{description}}{{^description}}{{classname}}{{/description}} /// + {{#vendorExtensions.x-cls-compliant}} + [CLSCompliant({{{vendorExtensions.x-cls-compliant}}})] + {{/vendorExtensions.x-cls-compliant}} + {{#vendorExtensions.x-com-visible}} + [ComVisible({{{vendorExtensions.x-com-visible}}})] + {{/vendorExtensions.x-com-visible}} [DataContract(Name = "{{{name}}}")] {{#discriminator}} [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/modelOneOf.mustache index 272b6cf93181..a7756c16045c 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelOneOf.mustache @@ -2,6 +2,12 @@ /// /// {{description}}{{^description}}{{classname}}{{/description}} /// + {{#vendorExtensions.x-cls-compliant}} + [CLSCompliant({{{.}}})] + {{/vendorExtensions.x-cls-compliant}} + {{#vendorExtensions.x-com-visible}} + [ComVisible({{{.}}})] + {{/vendorExtensions.x-com-visible}} [JsonConverter(typeof({{classname}}JsonConverter))] [DataContract(Name = "{{{name}}}")] {{>visibility}} partial class {{classname}} : AbstractOpenAPISchema, {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}} diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 8e46b9e9344e..4e4d668d0559 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1697,6 +1697,8 @@ components: items: $ref: '#/components/schemas/ReadOnlyFirst' NumberOnly: + x-cls-compliant: true + x-com-visible: true type: object properties: JustNumber: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/GmFruit.cs index bd8f4435c92f..9d97bc6177fc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/NumberOnly.cs index 8d5098e344e1..585e3eadb7f0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs index e189eff9406c..2eb305679d51 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs @@ -24,6 +24,7 @@ using FileParameter = Org.OpenAPITools.Client.FileParameter; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs index 15281d72033c..e4f90a8e77bf 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -30,6 +31,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs index bd8f4435c92f..9d97bc6177fc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/NumberOnly.cs index 97f869b0ebc1..0331e1c8db8f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/GmFruit.cs index bd8f4435c92f..9d97bc6177fc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 97f869b0ebc1..0331e1c8db8f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs index bd8f4435c92f..9d97bc6177fc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/NumberOnly.cs index 97f869b0ebc1..0331e1c8db8f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs index bd8f4435c92f..9d97bc6177fc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs index 467579e6689c..d7ad1d2e3e68 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model /// /// NumberOnly /// + [CLSCompliant(true)] + [ComVisible(true)] [DataContract(Name = "NumberOnly")] public partial class NumberOnly : IEquatable, IValidatableObject {