diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/Configuration.mustache index 7f43f567b32..7ee1b93d7e8 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/Configuration.mustache @@ -145,7 +145,7 @@ namespace {{packageName}}.Client { "{{{name}}}", new Dictionary { {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}, - {"default_value", "{{{defaultValue}}}"}, + {"default_value", {{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}"{{{defaultValue}}}"}, {{#enumValues}} {{#-first}} { diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ModelSignature.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ModelSignature.mustache index 1cc9190e969..86e22d57f06 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ModelSignature.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ModelSignature.mustache @@ -1 +1 @@ -{{#model.allVars}}{{>PropertyDataType}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = default{{/isNullable}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file +{{#model.allVars}}{{>PropertyDataType}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = default{{/isNullable}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file 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 15a41f6a2e0..4ad255aef4c 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache @@ -134,7 +134,7 @@ {{#hasOnlyReadOnly}} [JsonConstructorAttribute] {{/hasOnlyReadOnly}} - public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}}{{/isEnum}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#defaultValue}}{{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default({{{datatypeWithEnum}}}){{/isDateTime}}{{/defaultValue}}{{^defaultValue}}default({{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}}{{/isEnum}}){{/defaultValue}}{{^-last}}, {{/-last}}{{/readWriteVars}}){{#parent}} : base({{#parentVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^-last}}, {{/-last}}{{/parentVars}}){{/parent}} + public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}}{{/isEnum}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#defaultValue}}{{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default({{{datatypeWithEnum}}}){{/isDateTime}}{{/defaultValue}}{{^defaultValue}}default({{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}}{{/isEnum}}){{/defaultValue}}{{^-last}}, {{/-last}}{{/readWriteVars}}){{#parent}} : base({{#parentVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^-last}}, {{/-last}}{{/parentVars}}){{/parent}} { {{#vars}} {{^isInherited}} @@ -178,7 +178,7 @@ {{^conditionalSerialization}} {{^vendorExtensions.x-csharp-value-type}} // use default value if no "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" provided - this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? {{{defaultValue}}}; + this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? {{#isString}}@{{/isString}}{{{defaultValue}}}; {{/vendorExtensions.x-csharp-value-type}} {{#vendorExtensions.x-csharp-value-type}} this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; 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 21d824b0084..c9d94efc91f 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 @@ -2259,4 +2259,13 @@ components: type: object properties: value: - type: string \ No newline at end of file + type: string + LiteralStringClass: + type: object + properties: + escapedLiteralString: + type: string + default: C:\\Users\\username + unescapedLiteralString: + type: string + default: C:\Users\username \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index ca00a1d0b12..838976ae425 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -167,6 +168,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md index 56476d9a949..786ac93aab8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md @@ -193,6 +193,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs index 6d4cbf3cb87..1089897a9c0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Cat.cs index a9643944cca..6ce34d4b957 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Cat.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this._Declawed = declawed; if (this.Declawed != null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Category.cs index dd09bcdc936..babb18e4c04 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Category.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Dog.cs index 268c386ae2e..450f8c3a0a4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Dog.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this._Breed = breed; if (this.Breed != null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs index dcbf1143534..1380ddea88a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs @@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..60124dbf916 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,179 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString + { + get{ return _EscapedLiteralString;} + set + { + _EscapedLiteralString = value; + _flagEscapedLiteralString = true; + } + } + private string _EscapedLiteralString; + private bool _flagEscapedLiteralString; + + /// + /// Returns false as EscapedLiteralString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeEscapedLiteralString() + { + return _flagEscapedLiteralString; + } + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString + { + get{ return _UnescapedLiteralString;} + set + { + _UnescapedLiteralString = value; + _flagUnescapedLiteralString = true; + } + } + private string _UnescapedLiteralString; + private bool _flagUnescapedLiteralString; + + /// + /// Returns false as UnescapedLiteralString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeUnescapedLiteralString() + { + return _flagUnescapedLiteralString; + } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ParentPet.cs index 49bed679864..7e2a820d32c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ParentPet.cs @@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } 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 9d9da2869df..35efa408b97 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 @@ -54,6 +54,7 @@ docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md docs/models/IsoscelesTriangle.md docs/models/List.md +docs/models/LiteralStringClass.md docs/models/Mammal.md docs/models/MapTest.md docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -173,6 +174,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/LiteralStringClass.md new file mode 100644 index 00000000000..78202190965 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..7e31808e097 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,76 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} 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 8bd9635ba09..4b882f79e6a 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 @@ -92,6 +92,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); _jsonOptions.Converters.Add(new MammalJsonConverter()); _jsonOptions.Converters.Add(new MapTestJsonConverter()); _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 2aa4113882f..1337f2e6e9e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = "red") + public Animal(string className, string color = @"red") { ClassName = className; Color = color; 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 fd222ece114..7dd556c2132 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 @@ -38,7 +38,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = "red") : base(className, color) + internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = @"red") : base(className, color) { Dictionary = dictionary; CatAllOf = catAllOf; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index bf40829d283..7e8cde62ae7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model /// id /// name (default to "default-name") [JsonConstructor] - public Category(long id, string name = "default-name") + public Category(long id, string name = @"default-name") { Id = id; Name = name; 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 ef7bfd2e9e3..b05156f1233 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 @@ -37,7 +37,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Dog(DogAllOf dogAllOf, string className, string color = "red") : base(className, color) + internal Dog(DogAllOf dogAllOf, string className, string color = @"red") : base(className, color) { DogAllOf = dogAllOf; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index ee4aaf4bbdc..037f719500a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -35,7 +35,7 @@ namespace Org.OpenAPITools.Model /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { Bar = bar; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..0c942dc6894 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,172 @@ +// +/* + * 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.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 +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + EscapedLiteralString = escapedLiteralString; + UnescapedLiteralString = unescapedLiteralString; + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = 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 LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type LiteralStringClass + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string escapedLiteralString = default; + string unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "escapedLiteralString": + escapedLiteralString = utf8JsonReader.GetString(); + break; + case "unescapedLiteralString": + unescapedLiteralString = utf8JsonReader.GetString(); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index 9d9da2869df..35efa408b97 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -54,6 +54,7 @@ docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md docs/models/IsoscelesTriangle.md docs/models/List.md +docs/models/LiteralStringClass.md docs/models/Mammal.md docs/models/MapTest.md docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -173,6 +174,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/LiteralStringClass.md new file mode 100644 index 00000000000..78202190965 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..7e31808e097 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,76 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 34478d4be16..e5399ebe850 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -90,6 +90,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); _jsonOptions.Converters.Add(new MammalJsonConverter()); _jsonOptions.Converters.Add(new MapTestJsonConverter()); _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 830bec45669..0061eef68ee 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = "red") + public Animal(string className, string color = @"red") { ClassName = className; Color = color; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 012918369b3..63a7cbf5597 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = "red") : base(className, color) + internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = @"red") : base(className, color) { Dictionary = dictionary; CatAllOf = catAllOf; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index b8e0407d843..719a929f6e4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model /// id /// name (default to "default-name") [JsonConstructor] - public Category(long id, string name = "default-name") + public Category(long id, string name = @"default-name") { Id = id; Name = name; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index 094c1d2fc79..6bb6413c6d9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -35,7 +35,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Dog(DogAllOf dogAllOf, string className, string color = "red") : base(className, color) + internal Dog(DogAllOf dogAllOf, string className, string color = @"red") : base(className, color) { DogAllOf = dogAllOf; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index 84c8b8ea016..6b389a8547a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { Bar = bar; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..6247b0187ac --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,170 @@ +// +/* + * 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 System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +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 +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + EscapedLiteralString = escapedLiteralString; + UnescapedLiteralString = unescapedLiteralString; + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = 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 LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type LiteralStringClass + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string escapedLiteralString = default; + string unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "escapedLiteralString": + escapedLiteralString = utf8JsonReader.GetString(); + break; + case "unescapedLiteralString": + unescapedLiteralString = utf8JsonReader.GetString(); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index 9d9da2869df..35efa408b97 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -54,6 +54,7 @@ docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md docs/models/IsoscelesTriangle.md docs/models/List.md +docs/models/LiteralStringClass.md docs/models/Mammal.md docs/models/MapTest.md docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -173,6 +174,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/LiteralStringClass.md new file mode 100644 index 00000000000..78202190965 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-netstandard2.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..7e31808e097 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,76 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 34478d4be16..e5399ebe850 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -90,6 +90,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); _jsonOptions.Converters.Add(new MammalJsonConverter()); _jsonOptions.Converters.Add(new MapTestJsonConverter()); _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 830bec45669..0061eef68ee 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = "red") + public Animal(string className, string color = @"red") { ClassName = className; Color = color; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 012918369b3..63a7cbf5597 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = "red") : base(className, color) + internal Cat(Dictionary dictionary, CatAllOf catAllOf, string className, string color = @"red") : base(className, color) { Dictionary = dictionary; CatAllOf = catAllOf; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index b8e0407d843..719a929f6e4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model /// id /// name (default to "default-name") [JsonConstructor] - public Category(long id, string name = "default-name") + public Category(long id, string name = @"default-name") { Id = id; Name = name; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 094c1d2fc79..6bb6413c6d9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -35,7 +35,7 @@ namespace Org.OpenAPITools.Model /// className /// color (default to "red") [JsonConstructor] - internal Dog(DogAllOf dogAllOf, string className, string color = "red") : base(className, color) + internal Dog(DogAllOf dogAllOf, string className, string color = @"red") : base(className, color) { DogAllOf = dogAllOf; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index 84c8b8ea016..6b389a8547a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { Bar = bar; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..6247b0187ac --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,170 @@ +// +/* + * 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 System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +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 +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + EscapedLiteralString = escapedLiteralString; + UnescapedLiteralString = unescapedLiteralString; + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = 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 LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type LiteralStringClass + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string escapedLiteralString = default; + string unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "escapedLiteralString": + escapedLiteralString = utf8JsonReader.GetString(); + break; + case "unescapedLiteralString": + unescapedLiteralString = utf8JsonReader.GetString(); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES index 8b5e6fe3c0c..d0801197efe 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -164,6 +165,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md index 759cb8d2847..704da570647 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md @@ -218,6 +218,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-httpclient/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Animal.cs index dc511478a57..7300b6da74e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Animal.cs @@ -50,7 +50,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs index e151f038ad2..d2f07b2e063 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Category.cs index 7a758fc8b15..f8ceed16884 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Category.cs @@ -46,7 +46,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs index 10944760277..f8432044266 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Foo.cs index c42991826b1..d7a83d189b8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Foo.cs @@ -37,10 +37,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..2694ca6bba3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,148 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Org.OpenAPITools.Client.FileParameter; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs index b717f6edf83..5a74e4fd34f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES index ca00a1d0b12..838976ae425 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -167,6 +168,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md index 9a4d19d4718..49208c7379d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md @@ -205,6 +205,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-net47/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Animal.cs index 83397018b70..bcfe3744a9d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Animal.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs index 86ceaeed1ab..0a48e9411bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Category.cs index 94dea2b30bb..380112546ce 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Category.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs index 786270d1c4d..610859341db 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Foo.cs index e64aac7b631..2c74cfce99f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Foo.cs @@ -36,10 +36,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..51815067591 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,147 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs index 49bed679864..7e2a820d32c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs @@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES index ca00a1d0b12..838976ae425 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -167,6 +168,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md index 9a4d19d4718..49208c7379d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md @@ -205,6 +205,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-net48/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Animal.cs index 83397018b70..bcfe3744a9d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Animal.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Cat.cs index 86ceaeed1ab..0a48e9411bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Cat.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Category.cs index 94dea2b30bb..380112546ce 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Category.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Dog.cs index 786270d1c4d..610859341db 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Dog.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Foo.cs index e64aac7b631..2c74cfce99f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Foo.cs @@ -36,10 +36,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..51815067591 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,147 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ParentPet.cs index 49bed679864..7e2a820d32c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ParentPet.cs @@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES index ca00a1d0b12..838976ae425 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -167,6 +168,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md index 9a4d19d4718..49208c7379d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md @@ -205,6 +205,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-net5.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Animal.cs index 83397018b70..bcfe3744a9d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Animal.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs index 86ceaeed1ab..0a48e9411bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs index 94dea2b30bb..380112546ce 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs index 786270d1c4d..610859341db 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Foo.cs index e64aac7b631..2c74cfce99f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Foo.cs @@ -36,10 +36,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..51815067591 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,147 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs index 49bed679864..7e2a820d32c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES index fa47c7aafc2..36ec9d64116 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES @@ -49,6 +49,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -163,6 +164,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md index 7f0b8a19018..d916762b2cf 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md @@ -179,6 +179,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](HealthCheckResult.md) - [Model.IsoscelesTriangle](IsoscelesTriangle.md) - [Model.List](List.md) + - [Model.LiteralStringClass](LiteralStringClass.md) - [Model.Mammal](Mammal.md) - [Model.MapTest](MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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-unityWebRequest/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..fe53ed94de6 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,74 @@ +/* + * 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 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; +using NUnit.Framework; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Test] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'EscapedLiteralString' + /// + [Test] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Test] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Animal.cs index 543f842e5c4..0073454f667 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Animal.cs @@ -40,7 +40,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; } /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Cat.cs index 467db4f788e..2d02542a517 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Cat.cs @@ -41,7 +41,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Category.cs index 2d9702a6d7f..52680d66e36 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Category.cs @@ -40,7 +40,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Dog.cs index b027dd79ebf..cda8e3ca41c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Dog.cs @@ -41,7 +41,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Foo.cs index b496a89c893..704abb10128 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/Foo.cs @@ -34,10 +34,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; } /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..fdca36d43a8 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,138 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LiteralStringClass); + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass input) + { + if (input == null) + { + return false; + } + return + ( + this.EscapedLiteralString == input.EscapedLiteralString || + (this.EscapedLiteralString != null && + this.EscapedLiteralString.Equals(input.EscapedLiteralString)) + ) && + ( + this.UnescapedLiteralString == input.UnescapedLiteralString || + (this.UnescapedLiteralString != null && + this.UnescapedLiteralString.Equals(input.UnescapedLiteralString)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ParentPet.cs index 63f93900d87..3ab62d6dbff 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ParentPet.cs @@ -39,7 +39,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES index 28e7c49aedb..3f6001fe8dd 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -166,6 +167,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index 56476d9a949..786ac93aab8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -193,6 +193,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs index 83397018b70..bcfe3744a9d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs @@ -49,7 +49,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index 86ceaeed1ab..0a48e9411bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs index 94dea2b30bb..380112546ce 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 786270d1c4d..610859341db 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -48,7 +48,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs index e64aac7b631..2c74cfce99f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs @@ -36,10 +36,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..51815067591 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,147 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + 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; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs index 49bed679864..7e2a820d32c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES index 28e7c49aedb..3f6001fe8dd 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/IsoscelesTriangle.md docs/List.md +docs/LiteralStringClass.md docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -166,6 +167,7 @@ src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs src/Org.OpenAPITools/Model/Mammal.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index 9a4d19d4718..49208c7379d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -205,6 +205,7 @@ Class | Method | HTTP request | Description - [Model.HealthCheckResult](docs/HealthCheckResult.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) + - [Model.LiteralStringClass](docs/LiteralStringClass.md) - [Model.Mammal](docs/Mammal.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml index ad369a25587..7942c294dac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml @@ -2186,6 +2186,15 @@ components: value: type: string type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/LiteralStringClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/LiteralStringClass.md new file mode 100644 index 00000000000..6d3e0d50c1f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 00000000000..74dc17b9f4a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -0,0 +1,77 @@ +/* + * 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.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs index 86a7a429b22..478ade5f172 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs @@ -46,7 +46,7 @@ namespace Org.OpenAPITools.Model /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className = default(string), string color = @"red") { // to ensure "className" is required (not null) if (className == null) @@ -55,7 +55,7 @@ namespace Org.OpenAPITools.Model } this.ClassName = className; // use default value if no "color" provided - this.Color = color ?? "red"; + this.Color = color ?? @"red"; } /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs index c90dc4940de..f348fbe855d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// declawed. /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = @"Cat", string color = @"red") : base(className, color) { this.Declawed = declawed; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs index 1abee7610c8..dff20c6266c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs @@ -42,7 +42,7 @@ namespace Org.OpenAPITools.Model /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id = default(long), string name = @"default-name") { // to ensure "name" is required (not null) if (name == null) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs index 1d1dd51ee30..570047bd2e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs @@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model /// breed. /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = @"Dog", string color = @"red") : base(className, color) { this.Breed = breed; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Foo.cs index 3abdc1cb6a0..567bd4f778d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Foo.cs @@ -36,10 +36,10 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar = @"bar") { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; + this.Bar = bar ?? @"bar"; } /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 00000000000..3523c8d1644 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,135 @@ +/* + * 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 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 Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + [DataContract(Name = "LiteralStringClass")] + public partial class LiteralStringClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username"). + /// unescapedLiteralString (default to "C:\Users\username"). + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + { + // use default value if no "escapedLiteralString" provided + this.EscapedLiteralString = escapedLiteralString ?? @"C:\\Users\\username"; + // use default value if no "unescapedLiteralString" provided + this.UnescapedLiteralString = unescapedLiteralString ?? @"C:\Users\username"; + } + + /// + /// Gets or Sets EscapedLiteralString + /// + [DataMember(Name = "escapedLiteralString", EmitDefaultValue = false)] + public string EscapedLiteralString { get; set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [DataMember(Name = "unescapedLiteralString", EmitDefaultValue = false)] + public string UnescapedLiteralString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as LiteralStringClass).AreEqual; + } + + /// + /// Returns true if LiteralStringClass instances are equal + /// + /// Instance of LiteralStringClass to be compared + /// Boolean + public bool Equals(LiteralStringClass 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.EscapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.EscapedLiteralString.GetHashCode(); + } + if (this.UnescapedLiteralString != null) + { + hashCode = (hashCode * 59) + this.UnescapedLiteralString.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs index 06356f5a8f4..87d2eca09ae 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs @@ -44,7 +44,7 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType = @"ParentPet") : base(petType) { }