Skip to content

Commit

Permalink
[csharp-netcore] Add support for ComVisible, CLSCompliant attributes (#…
Browse files Browse the repository at this point in the history
…12733)

* add support for ComVisible, CLSCompliant attributes in csharp-netcore clients

* fix import
  • Loading branch information
wing328 authored Jul 1, 2022
1 parent 280de38 commit d0a0b82
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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}}
Expand All @@ -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}}
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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}}
Expand All @@ -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}}
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/// <summary>
/// {{description}}{{^description}}{{classname}}{{/description}}
/// </summary>
{{#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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
{{#description}}
/// <value>{{.}}</value>
{{/description}}
{{#vendorExtensions.x-cls-compliant}}
[CLSCompliant({{{.}}})]
{{/vendorExtensions.x-cls-compliant}}
{{#vendorExtensions.x-com-visible}}
[ComVisible({{{.}}})]
{{/vendorExtensions.x-com-visible}}
{{#allowableValues}}
{{#enumVars}}
{{#-first}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/// <summary>
/// {{description}}{{^description}}{{classname}}{{/description}}
/// </summary>
{{#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}}}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
/// <summary>
/// {{description}}{{^description}}{{classname}}{{/description}}
/// </summary>
{{#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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,8 @@ components:
items:
$ref: '#/components/schemas/ReadOnlyFirst'
NumberOnly:
x-cls-compliant: true
x-com-visible: true
type: object
properties:
JustNumber:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,6 +31,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,8 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// NumberOnly
/// </summary>
[CLSCompliant(true)]
[ComVisible(true)]
[DataContract(Name = "NumberOnly")]
public partial class NumberOnly : IEquatable<NumberOnly>, IValidatableObject
{
Expand Down

0 comments on commit d0a0b82

Please sign in to comment.