diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiException.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiException.mustache index 03ad75ce5a09..6c9d4e986000 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiException.mustache @@ -22,21 +22,21 @@ namespace {{packageName}}.Client /// /// The raw data returned by the api /// - public string RawData { get; } + public string RawContent { get; } /// /// Construct the ApiException from parts of the reponse /// /// /// - /// - public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawData) : base(reasonPhrase ?? rawData) + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) { ReasonPhrase = reasonPhrase; StatusCode = statusCode; - RawData = rawData; + RawContent = rawContent; } } } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiResponse.mustache index 5bb4b0261573..31421aac9f3b 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiResponse.mustache @@ -31,20 +31,20 @@ namespace {{packageName}}.Client /// /// The raw content of this response /// - string RawData { get; } + string RawContent { get; } } /// /// API Response /// - public class ApiResponse : IApiResponse + {{>visibility}} partial class ApiResponse : IApiResponse { #region Properties /// - /// The deserialized data + /// The deserialized content /// - public T? Data { get; set; } + public T??? Content { get; set; } /// /// Gets or sets the status code (HTTP status code) @@ -68,7 +68,7 @@ namespace {{packageName}}.Client /// /// The raw data /// - public string RawData { get; } + public string RawContent { get; } /// /// The IsSuccessStatusCode from the api response @@ -78,7 +78,7 @@ namespace {{packageName}}.Client /// /// The reason phrase contained in the api response /// - public string? ReasonPhrase { get; } + public string??? ReasonPhrase { get; } /// /// The headers contained in the api response @@ -91,14 +91,14 @@ namespace {{packageName}}.Client /// Construct the reponse using an HttpResponseMessage /// /// - /// - public ApiResponse(System.Net.Http.HttpResponseMessage response, string rawData) + /// + public ApiResponse(System.Net.Http.HttpResponseMessage response, string rawContent) { StatusCode = response.StatusCode; Headers = response.Headers; IsSuccessStatusCode = response.IsSuccessStatusCode; ReasonPhrase = response.ReasonPhrase; - RawData = rawData; + RawContent = rawContent; } } } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/AssemblyInfo.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/AssemblyInfo.mustache new file mode 100644 index 000000000000..c5d19bfd2357 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/AssemblyInfo.mustache @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("{{packageTitle}}")] +[assembly: AssemblyDescription("{{packageDescription}}")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("{{packageCompany}}")] +[assembly: AssemblyProduct("{{packageProductName}}")] +[assembly: AssemblyCopyright("{{packageCopyright}}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("{{packageVersion}}")] +[assembly: AssemblyFileVersion("{{packageVersion}}")] +{{^supportsAsync}} +[assembly: InternalsVisibleTo("NewtonSoft.Json")] +[assembly: InternalsVisibleTo("JsonSubTypes")] +{{/supportsAsync}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/README.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/README.mustache new file mode 100644 index 000000000000..08386374f42c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/README.mustache @@ -0,0 +1,252 @@ +This library requires some post procesing. You can use this PowerShell script to run the generator and process the results. + +If you are not using .Net Standard, consider setting validatable to false in your generator-config.json due to this bug: https://github.com/dotnet/project-system/issues/3934 + +``` +java -jar "../openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i "your-swagger-file.yml" ` + -c generator-config.json ` + -o output ` + -t templates ` + --library httpclient + +$files = Get-ChildItem output -Recurse | Where-Object {-Not($_.PSIsContainer)} +foreach ($file in $files) +{ + $content=Get-Content $file.PSPath + + if (-Not($content)){ + continue; + } + + # if null reference types are enabled + $content=$content -replace '\?{3,4}', '?' # replace every three to four consecutive occurrences of '?' with a single one + + # if null reference types are not enabled + # $content=$content.Replace("????", "?") # reference type + # $content=$content.Replace("???", "") # value type + + Set-Content $file.PSPath $content +} +``` + +# {{packageName}} - the C# library for the {{appName}} + +{{#appDescriptionWithNewLines}} +{{{appDescriptionWithNewLines}}} +{{/appDescriptionWithNewLines}} + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +- SDK version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + + +## Frameworks supported +{{#netStandard}} +- .NET Core >=1.0 +- .NET Framework >=4.6 +- Mono/Xamarin >=vNext +{{/netStandard}} + + +## Dependencies + +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later +{{#useCompareNetObjects}} +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +{{/useCompareNetObjects}} +{{#validatable}} +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later +{{/validatable}} + +The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package Newtonsoft.Json +Install-Package JsonSubTypes +{{#validatable}} +Install-Package System.ComponentModel.Annotations +{{/validatable}} +{{#useCompareNetObjects}} +Install-Package CompareNETObjects +{{/useCompareNetObjects}} +``` + + +## Installation +{{#netStandard}} +Generate the DLL using your preferred tool (e.g. `dotnet build`) +{{/netStandard}} +{{^netStandard}} +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh build.sh` +- [Windows] `build.bat` +{{/netStandard}} + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using {{packageName}}.{{apiPackage}}; +using {{packageName}}.Client; +using {{packageName}}.{{modelPackage}}; +``` +{{^netStandard}} + +## Packaging + +A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. + +This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: + +``` +nuget pack -Build -OutputDirectory out {{packageName}}.csproj +``` + +Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. + +{{/netStandard}} + +## Usage + +To use the API client with a HTTP proxy, setup a `System.Net.WebProxy` +```csharp +Configuration c = new Configuration(); +System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/"); +webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; +c.Proxy = webProxy; +``` + + +## Getting Started + +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using {{packageName}}.{{apiPackage}}; +using {{packageName}}.Client; +using {{packageName}}.{{modelPackage}}; + +namespace Example +{ + public class {{operationId}}Example + { + public static void Main() + { +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} + Configuration config = new Configuration(); + config.BasePath = "{{{basePath}}}"; + {{#hasAuthMethods}} + {{#authMethods}} + {{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + config.Username = "YOUR_USERNAME"; + config.Password = "YOUR_PASSWORD"; + {{/isBasicBasic}} + {{#isBasicBearer}} + // Configure Bearer token for authorization: {{{name}}} + config.AccessToken = "YOUR_BEARER_TOKEN"; + {{/isBasicBearer}} + {{#isApiKey}} + // Configure API key authorization: {{{name}}} + config.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer"); + {{/isApiKey}} + {{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + config.AccessToken = "YOUR_ACCESS_TOKEN"; + {{/isOAuth}} + {{/authMethods}} + + {{/hasAuthMethods}} + var apiInstance = new {{classname}}(config); + {{#allParams}} + {{#isPrimitiveType}} + var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{/allParams}} + + try + { + {{#summary}} + // {{{.}}} + {{/summary}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + Debug.WriteLine(result);{{/returnType}} + } + catch (ApiException e) + { + Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *{{{basePath}}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + + +## Documentation for Models + +{{#modelPackage}} +{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} +{{/modelPackage}} +{{^modelPackage}} +No model defined in this package +{{/modelPackage}} + + +## Documentation for Authorization + +{{^authMethods}} +All endpoints do not require authorization. +{{/authMethods}} +{{#authMethods}} +{{#last}} +Authentication schemes defined for the API: +{{/last}} +{{/authMethods}} +{{#authMethods}} + +### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}}- **Type**: Bearer Authentication +{{/isBasicBearer}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache index ce8e721df46a..d250749ab934 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache @@ -110,7 +110,7 @@ namespace {{packageName}}.{{apiPackage}} public async System.Threading.Tasks.Task<{{{returnType}}}> {{operationId}}Async({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{^required}}{{{dataType}}}??? {{paramName}} = null{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken? cancellationToken = null) { {{packageName}}.Client.ApiResponse<{{{returnType}}}> result = await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } {{/returnType}} @@ -129,7 +129,7 @@ namespace {{packageName}}.{{apiPackage}} {{packageName}}.Client.ApiResponse<{{{returnType}}}> result = await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } {{/returnType}} @@ -228,7 +228,7 @@ namespace {{packageName}}.{{apiPackage}} {{/formParams}} {{#bodyParam}} - // todo localVarRequestOptions.Data = {{paramName}}; + // todo localVarRequestOptions.Content = {{paramName}}; {{/bodyParam}} {{#authMethods}} @@ -312,10 +312,10 @@ namespace {{packageName}}.{{apiPackage}} string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> apiResponse = new(responseMessage, responseContent); + ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> apiResponse = new ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>(apiResponse.RawContent, {{packageName}}.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api_test.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api_test.mustache index 65a16c67e0c6..87187868dfad 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api_test.mustache @@ -25,11 +25,13 @@ namespace {{packageName}}.Test.Api /// public class {{classname}}Tests : IDisposable { - private {{classname}} instance; + private readonly {{classname}} _instance; + + private readonly System.Net.Http.HttpClient _httpClient = new System.Net.Http.HttpClient(); public {{classname}}Tests() { - //instance = new {{classname}}(); + //_instance = new {{classname}}(_httpClient); } public void Dispose() @@ -44,7 +46,7 @@ namespace {{packageName}}.Test.Api public void {{operationId}}InstanceTest() { // TODO uncomment below to test 'IsType' {{classname}} - //Assert.IsType<{{classname}}>(instance); + //Assert.IsType<{{classname}}>(_instance); } {{#operations}} {{#operation}} @@ -59,7 +61,7 @@ namespace {{packageName}}.Test.Api {{#allParams}} //{{{dataType}}} {{paramName}} = null; {{/allParams}} - //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + //{{#returnType}}var response = {{/returnType}}_instance.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#returnType}} //Assert.IsType<{{{returnType}}}>(response); {{/returnType}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache new file mode 100644 index 000000000000..93af226b3102 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/model.mustache @@ -0,0 +1,44 @@ +{{>partial_header}} + +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; +{{#models}} +{{#model}} +{{#discriminator}} +using JsonSubTypes; +{{/discriminator}} +{{/model}} +{{/models}} +{{#validatable}} +using System.ComponentModel.DataAnnotations; +{{/validatable}} +using OpenAPIDateConverter = {{packageName}}.Client.OpenAPIDateConverter; +{{#useCompareNetObjects}} +using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; +{{/useCompareNetObjects}} +{{#models}} +{{#model}} +{{#oneOf}} +{{#-first}} +using System.Reflection; +{{/-first}} +{{/oneOf}} +{{#anyOf}} +{{#-first}} +using System.Reflection; +{{/-first}} +{{/anyOf}} + +namespace {{packageName}}.{{modelPackage}} +{ +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#anyOf}}{{#-first}}{{>modelAnyOf}}{{/-first}}{{/anyOf}}{{^oneOf}}{{^anyOf}}{{>modelGeneric}}{{/anyOf}}{{/oneOf}}{{/isEnum}} +{{/model}} +{{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelGeneric.mustache new file mode 100644 index 000000000000..1827f9f61e3a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelGeneric.mustache @@ -0,0 +1,353 @@ + /// + /// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + /// + [DataContract(Name = "{{{name}}}")] + {{#discriminator}} + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] + {{#mappedModels}} + [JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")] + {{/mappedModels}} + {{/discriminator}} + {{>visibility}} partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}} + { + {{#vars}} + {{#items.isEnum}} + {{#items}} + {{^complexType}} +{{>modelInnerEnum}} + {{/complexType}} + {{/items}} + {{/items.isEnum}} + {{#isEnum}} + {{^complexType}} +{{>modelInnerEnum}} + {{/complexType}} + {{/isEnum}} + {{#isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} + [DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})] + public {{#complexType}}{{{complexType}}}{{/complexType}}{{^complexType}}{{{datatypeWithEnum}}}{{/complexType}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}} {{name}} { get; set; } + + {{#isReadOnly}} + /// + /// Returns false as {{name}} should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerialize{{name}}() + { + return false; + } + + {{/isReadOnly}} + {{/isEnum}} + {{/vars}} + {{#hasRequired}} + {{^hasOnlyReadOnly}} + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + {{^isAdditionalPropertiesTrue}} + protected {{classname}}() { } + {{/isAdditionalPropertiesTrue}} + {{#isAdditionalPropertiesTrue}} + protected {{classname}}() + { + this.AdditionalProperties = new Dictionary(); + } + + {{/isAdditionalPropertiesTrue}} + {{/hasOnlyReadOnly}} + {{/hasRequired}} + /// + /// Initializes a new instance of the class. + /// + {{#readWriteVars}} + /// {{#description}}{{description}}{{/description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. + {{/readWriteVars}} + {{#hasOnlyReadOnly}} + [JsonConstructorAttribute] + {{/hasOnlyReadOnly}} + public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}}{{/isEnum}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^-last}}, {{/-last}}{{/readWriteVars}}){{#parent}} : base({{#parentVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^-last}}, {{/-last}}{{/parentVars}}){{/parent}} + { + {{#vars}} + {{^isInherited}} + {{^isReadOnly}} + {{#required}} + {{^vendorExtensions.x-csharp-value-type}} + // to ensure "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" is required (not null) + {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? throw new ArgumentNullException("{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} is a required property for {{classname}} and cannot be null"); + {{/vendorExtensions.x-csharp-value-type}} + {{#vendorExtensions.x-csharp-value-type}} + {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{/vendorExtensions.x-csharp-value-type}} + + {{/required}} + {{/isReadOnly}} + {{/isInherited}} + {{/vars}} + {{#vars}} + {{^isInherited}} + {{^isReadOnly}} + {{^required}} + {{#defaultValue}} + {{^vendorExtensions.x-csharp-value-type}} + // use default value if no "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" provided + {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? {{{defaultValue}}}; + {{/vendorExtensions.x-csharp-value-type}} + {{#vendorExtensions.x-csharp-value-type}} + {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{/vendorExtensions.x-csharp-value-type}} + {{/defaultValue}} + {{^defaultValue}} + {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{/defaultValue}} + {{/required}} + {{/isReadOnly}} + {{/isInherited}} + {{/vars}} + {{#isAdditionalPropertiesTrue}} + AdditionalProperties = new Dictionary(); + {{/isAdditionalPropertiesTrue}} + } + + {{#vars}} + {{^isInherited}} + {{^isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// {{#description}} + /// {{description}}{{/description}} + [DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})] + {{#isDate}} + [Newtonsoft.Json.JsonConverter(typeof(OpenAPIDateConverter))] + {{/isDate}} + public {{{dataType}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } + + {{#isReadOnly}} + /// + /// Returns false as {{name}} should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerialize{{name}}() + { + return false; + } + + {{/isReadOnly}} + {{/isEnum}} + {{/isInherited}} + {{/vars}} + {{#isAdditionalPropertiesTrue}} + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + {{/isAdditionalPropertiesTrue}} + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class {{classname}} {\n"); + {{#parent}} + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + {{/parent}} + {{#vars}} + sb.Append(" {{name}}: ").Append({{name}}).Append('\n'); + {{/vars}} + {{#isAdditionalPropertiesTrue}} + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); + {{/isAdditionalPropertiesTrue}} + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public {{#parent}}{{^isArray}}{{^isMap}}override {{/isMap}}{{/isArray}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? {{packageName}}.Client.ClientUtils.JsonSerializerSettings); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object??? input) + { + {{#useCompareNetObjects}} + return OpenAPIClientUtils.compareLogic.Compare(this, input as {{classname}}).AreEqual; + {{/useCompareNetObjects}} + {{^useCompareNetObjects}} + return Equals(input as {{classname}}); + {{/useCompareNetObjects}} + } + + /// + /// Returns true if {{classname}} instances are equal + /// + /// Instance of {{classname}} to be compared + /// Boolean + public bool Equals({{classname}}? input) + { + {{#useCompareNetObjects}} + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + {{/useCompareNetObjects}} + {{^useCompareNetObjects}} + if (input == null) + return false; + + return {{#vars}}{{#parent}}base.Equals(input) && {{/parent}}{{^isContainer}} + ( + {{name}} == input.{{name}} || + {{^vendorExtensions.x-is-value-type}} + ({{name}} != null && + {{name}}.Equals(input.{{name}})) + {{/vendorExtensions.x-is-value-type}} + {{#vendorExtensions.x-is-value-type}} + {{name}}.Equals(input.{{name}}) + {{/vendorExtensions.x-is-value-type}} + ){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}} + ( + {{name}} == input.{{name}} || + {{^vendorExtensions.x-is-value-type}}{{name}} != null && + input.{{name}} != null && + {{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(input.{{name}}) + ){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}} + {{#isAdditionalPropertiesTrue}} + && (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any()); + {{/isAdditionalPropertiesTrue}} + {{/useCompareNetObjects}} + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + {{#parent}} + int hashCode = base.GetHashCode(); + {{/parent}} + {{^parent}} + int hashCode = 41; + {{/parent}} + {{#vars}} + {{^vendorExtensions.x-is-value-type}} + if (this.{{name}} != null) + hashCode = hashCode * 59 + this.{{name}}.GetHashCode(); + {{/vendorExtensions.x-is-value-type}} + {{#vendorExtensions.x-is-value-type}} + hashCode = hashCode * 59 + this.{{name}}.GetHashCode(); + {{/vendorExtensions.x-is-value-type}} + {{/vars}} + {{#isAdditionalPropertiesTrue}} + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + {{/isAdditionalPropertiesTrue}} + return hashCode; + } + } + +{{#validatable}} +{{#discriminator}} + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { +{{/discriminator}} +{{^discriminator}} + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { +{{/discriminator}} + {{#parent}} + {{^isArray}} + {{^isMap}} + foreach(var x in BaseValidate(validationContext)) yield return x; + {{/isMap}} + {{/isArray}} + {{/parent}} + {{#vars}} + {{#hasValidation}} + {{#maxLength}} + // {{{name}}} ({{{dataType}}}) maxLength + if(this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}}) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be less than {{maxLength}}.", new [] { "{{{name}}}" }); + } + + {{/maxLength}} + {{#minLength}} + // {{{name}}} ({{{dataType}}}) minLength + if(this.{{{name}}} != null && this.{{{name}}}.Length < {{minLength}}) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be greater than {{minLength}}.", new [] { "{{{name}}}" }); + } + + {{/minLength}} + {{#maximum}} + // {{{name}}} ({{{dataType}}}) maximum + if(this.{{{name}}} > ({{{dataType}}}){{maximum}}) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" }); + } + + {{/maximum}} + {{#minimum}} + // {{{name}}} ({{{dataType}}}) minimum + if(this.{{{name}}} < ({{{dataType}}}){{minimum}}) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" }); + } + + {{/minimum}} + {{#pattern}} + {{^isByteArray}} + // {{{name}}} ({{{dataType}}}) pattern + Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); + if (false == regex{{{name}}}.Match(this.{{{name}}}).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); + } + + {{/isByteArray}} + {{/pattern}} + {{/hasValidation}} + {{/vars}} + yield break; + } +{{/validatable}} + } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelInnerEnum.mustache new file mode 100644 index 000000000000..8c17023f38a0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/modelInnerEnum.mustache @@ -0,0 +1,26 @@ + {{^isContainer}} + /// + /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} + {{#isString}} + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + {{/isString}} + {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} + { + {{#allowableValues}} + {{#enumVars}} + /// + /// Enum {{name}} for value: {{{value}}} + /// + {{#isString}} + [EnumMember(Value = "{{{value}}}")] + {{/isString}} + {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}} + + {{/enumVars}} + {{/allowableValues}} + } + {{/isContainer}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/netcore_project.mustache index 650dcb9247c7..b7684dd9af61 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/netcore_project.mustache @@ -2,7 +2,7 @@ false - net5.0 + {{targetFramework}} {{packageName}} {{packageName}} Library @@ -28,11 +28,9 @@ {{/useCompareNetObjects}} - {{#validatable}} - + {{/validatable}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/nuspec.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/nuspec.mustache new file mode 100644 index 000000000000..4b9b30a5fe25 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/nuspec.mustache @@ -0,0 +1,51 @@ + + + + + $id$ + {{packageTitle}} + + + $version$ + + + $author$ + + + $author$ + false + false + + + {{packageDescription}} + {{#termsOfService}} + {{termsOfService}} + {{/termsOfService}} + {{#licenseUrl}} + {{licenseUrl}} + {{/licenseUrl}} + + + + + + {{#useCompareNetObjects}} + + {{/useCompareNetObjects}} + + {{#validatable}} + + {{/validatable}} + + + + + + + + + + + diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache index 339a6d2f76b7..bcc56c75044f 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/model.mustache @@ -33,11 +33,11 @@ using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; using System.Reflection; {{/-first}} {{/oneOf}} -{{#aneOf}} +{{#anyOf}} {{#-first}} using System.Reflection; {{/-first}} -{{/aneOf}} +{{/anyOf}} namespace {{packageName}}.{{modelPackage}} { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md index 1cca61e28718..a273e0c51575 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md @@ -1,3 +1,36 @@ +This library requires some post procesing. You can use this PowerShell script to run the generator and process the results. + +If you are not using .Net Standard, consider setting validatable to false in your generator-config.json due to this bug: https://github.com/dotnet/project-system/issues/3934 + +``` +java -jar "../openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i "your-swagger-file.yml" ` + -c generator-config.json ` + -o output ` + -t templates ` + --library httpclient + +$files = Get-ChildItem output -Recurse | Where-Object {-Not($_.PSIsContainer)} +foreach ($file in $files) +{ + $content=Get-Content $file.PSPath + + if (-Not($content)){ + continue; + } + + # if null reference types are enabled + $content=$content -replace '\?{3,4}', '?' # replace every three to four consecutive occurrences of '?' with a single one + + # if null reference types are not enabled + # $content=$content.Replace("????", "?") # reference type + # $content=$content.Replace("???", "") # value type + + Set-Content $file.PSPath $content +} +``` + # Org.OpenAPITools - the C# library for the 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: \" \\ @@ -17,7 +50,6 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap ## Dependencies -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later - [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later - [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later - [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later @@ -25,15 +57,12 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` -Install-Package RestSharp Install-Package Newtonsoft.Json Install-Package JsonSubTypes Install-Package System.ComponentModel.Annotations Install-Package CompareNETObjects ``` -NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) - ## Installation Generate the DLL using your preferred tool (e.g. `dotnet build`) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 0d6ff9ad905b..eb9f5c92647f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -100,7 +100,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCall123TestSpecialTag public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -115,7 +115,7 @@ public async System.Threading.Tasks.Task Call123TestSpecialTagsAsyn Org.OpenAPITools.Client.ApiResponse result = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -151,7 +151,7 @@ public async System.Threading.Tasks.Task Call123TestSpecialTagsAsyn - // todo localVarRequestOptions.Data = modelClient; + // todo localVarRequestOptions.Content = modelClient; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -169,10 +169,10 @@ public async System.Threading.Tasks.Task Call123TestSpecialTagsAsyn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs index 5ee6e54c869a..4932f85fa838 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -95,7 +95,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFooGetRequestAsync(Sy public async System.Threading.Tasks.Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -109,7 +109,7 @@ public async System.Threading.Tasks.Task FooGetAsync(Syst Org.OpenAPITools.Client.ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -157,10 +157,10 @@ public async System.Threading.Tasks.Task FooGetAsync(Syst string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs index f4aee0c37628..12278f589c02 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -550,7 +550,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFakeHealthGetRequestA public async System.Threading.Tasks.Task FakeHealthGetAsync(System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FakeHealthGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -564,7 +564,7 @@ public async System.Threading.Tasks.Task FakeHealthGetAsync(S Org.OpenAPITools.Client.ApiResponse result = await FakeHealthGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -612,10 +612,10 @@ public async System.Threading.Tasks.Task FakeHealthGetAsync(S string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -638,7 +638,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFakeOuterBooleanSeria public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool???? body = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -653,7 +653,7 @@ public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bo Org.OpenAPITools.Client.ApiResponse result = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -687,7 +687,7 @@ public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bo - // todo localVarRequestOptions.Data = body; + // todo localVarRequestOptions.Content = body; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -705,10 +705,10 @@ public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bo string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -731,7 +731,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFakeOuterCompositeSer public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite??? outerComposite = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -746,7 +746,7 @@ public async System.Threading.Tasks.Task FakeOuterCompositeSeria Org.OpenAPITools.Client.ApiResponse result = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -780,7 +780,7 @@ public async System.Threading.Tasks.Task FakeOuterCompositeSeria - // todo localVarRequestOptions.Data = outerComposite; + // todo localVarRequestOptions.Content = outerComposite; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -798,10 +798,10 @@ public async System.Threading.Tasks.Task FakeOuterCompositeSeria string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -824,7 +824,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFakeOuterNumberSerial public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal???? body = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FakeOuterNumberSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -839,7 +839,7 @@ public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync( Org.OpenAPITools.Client.ApiResponse result = await FakeOuterNumberSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -873,7 +873,7 @@ public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync( - // todo localVarRequestOptions.Data = body; + // todo localVarRequestOptions.Content = body; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -891,10 +891,10 @@ public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync( string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -917,7 +917,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFakeOuterStringSerial public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(string??? body = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await FakeOuterStringSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -932,7 +932,7 @@ public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(s Org.OpenAPITools.Client.ApiResponse result = await FakeOuterStringSerializeWithHttpInfoAsync(body, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -966,7 +966,7 @@ public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(s - // todo localVarRequestOptions.Data = body; + // todo localVarRequestOptions.Content = body; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -984,10 +984,10 @@ public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(s string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1008,7 +1008,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateGetArrayOfEnumsReques public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse> result = await GetArrayOfEnumsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -1022,7 +1022,7 @@ public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(S Org.OpenAPITools.Client.ApiResponse> result = await GetArrayOfEnumsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -1070,10 +1070,10 @@ public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(S string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse> apiResponse = new(responseMessage, responseContent); + ApiResponse> apiResponse = new ApiResponse>(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1120,7 +1120,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestBodyWithFileSchem - // todo localVarRequestOptions.Data = fileSchemaTestClass; + // todo localVarRequestOptions.Content = fileSchemaTestClass; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -1137,10 +1137,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestBodyWithFileSchem string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1193,7 +1193,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestBodyWithQueryPara - // todo localVarRequestOptions.Data = user; + // todo localVarRequestOptions.Content = user; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -1210,10 +1210,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestBodyWithQueryPara string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1236,7 +1236,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestClientModelReques public async System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await TestClientModelWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -1251,7 +1251,7 @@ public async System.Threading.Tasks.Task TestClientModelAsync(Model Org.OpenAPITools.Client.ApiResponse result = await TestClientModelWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -1287,7 +1287,7 @@ public async System.Threading.Tasks.Task TestClientModelAsync(Model - // todo localVarRequestOptions.Data = modelClient; + // todo localVarRequestOptions.Content = modelClient; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -1305,10 +1305,10 @@ public async System.Threading.Tasks.Task TestClientModelAsync(Model string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1447,10 +1447,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestEndpointParameter string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1549,10 +1549,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestEnumParametersReq string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1639,10 +1639,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestGroupParametersRe string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1689,7 +1689,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestInlineAdditionalP - // todo localVarRequestOptions.Data = requestBody; + // todo localVarRequestOptions.Content = requestBody; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -1706,10 +1706,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestInlineAdditionalP string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1778,10 +1778,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestJsonFormDataReque string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1868,10 +1868,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestQueryParameterCol string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 4ce310c787d1..6f465616b245 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -100,7 +100,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateTestClassnameRequestA public async System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await TestClassnameWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -115,7 +115,7 @@ public async System.Threading.Tasks.Task TestClassnameAsync(ModelCl Org.OpenAPITools.Client.ApiResponse result = await TestClassnameWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -151,7 +151,7 @@ public async System.Threading.Tasks.Task TestClassnameAsync(ModelCl - // todo localVarRequestOptions.Data = modelClient; + // todo localVarRequestOptions.Content = modelClient; // authentication (api_key_query) required //todo if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) @@ -172,10 +172,10 @@ public async System.Threading.Tasks.Task TestClassnameAsync(ModelCl string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs index 69f4202763cc..47bfa210df29 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs @@ -374,7 +374,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateAddPetRequestAsync(Pe - // todo localVarRequestOptions.Data = pet; + // todo localVarRequestOptions.Content = pet; // authentication (http_signature_test) required //todo @@ -416,10 +416,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateAddPetRequestAsync(Pe string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -488,10 +488,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateDeletePetRequestAsync string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -514,7 +514,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFindPetsByStatusReque public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse> result = await FindPetsByStatusWithHttpInfoAsync(status, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -529,7 +529,7 @@ public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List> result = await FindPetsByStatusWithHttpInfoAsync(status, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -606,10 +606,10 @@ public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List> apiResponse = new(responseMessage, responseContent); + ApiResponse> apiResponse = new ApiResponse>(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -632,7 +632,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateFindPetsByTagsRequest public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse> result = await FindPetsByTagsWithHttpInfoAsync(tags, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -647,7 +647,7 @@ public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List> result = await FindPetsByTagsWithHttpInfoAsync(tags, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -724,10 +724,10 @@ public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List> apiResponse = new(responseMessage, responseContent); + ApiResponse> apiResponse = new ApiResponse>(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -750,7 +750,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateGetPetByIdRequestAsyn public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await GetPetByIdWithHttpInfoAsync(petId, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -765,7 +765,7 @@ public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, System Org.OpenAPITools.Client.ApiResponse result = await GetPetByIdWithHttpInfoAsync(petId, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -825,10 +825,10 @@ public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, System string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -875,7 +875,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUpdatePetRequestAsync - // todo localVarRequestOptions.Data = pet; + // todo localVarRequestOptions.Content = pet; // authentication (http_signature_test) required //todo @@ -917,10 +917,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUpdatePetRequestAsync string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -999,10 +999,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUpdatePetWithFormRequ string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1029,7 +1029,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUploadFileRequestAsyn public async System.Threading.Tasks.Task UploadFileAsync(long petId, string??? additionalMetadata = null, System.IO.Stream??? file = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -1046,7 +1046,7 @@ public async System.Threading.Tasks.Task UploadFileAsync(long petId Org.OpenAPITools.Client.ApiResponse result = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -1113,10 +1113,10 @@ public async System.Threading.Tasks.Task UploadFileAsync(long petId string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -1143,7 +1143,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUploadFileWithRequire public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string??? additionalMetadata = null, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -1160,7 +1160,7 @@ public async System.Threading.Tasks.Task UploadFileWithRequiredFile Org.OpenAPITools.Client.ApiResponse result = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -1226,10 +1226,10 @@ public async System.Threading.Tasks.Task UploadFileWithRequiredFile string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs index a182683c6885..93e133c8c6d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs @@ -229,10 +229,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateDeleteOrderRequestAsy string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -253,7 +253,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateGetInventoryRequestAs public async System.Threading.Tasks.Task> GetInventoryAsync(System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse> result = await GetInventoryWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -267,7 +267,7 @@ public async System.Threading.Tasks.Task> GetInventoryAs Org.OpenAPITools.Client.ApiResponse> result = await GetInventoryWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -323,10 +323,10 @@ public async System.Threading.Tasks.Task> GetInventoryAs string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse> apiResponse = new(responseMessage, responseContent); + ApiResponse> apiResponse = new ApiResponse>(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject>(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -349,7 +349,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateGetOrderByIdRequestAs public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await GetOrderByIdWithHttpInfoAsync(orderId, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -364,7 +364,7 @@ public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, Org.OpenAPITools.Client.ApiResponse result = await GetOrderByIdWithHttpInfoAsync(orderId, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -416,10 +416,10 @@ public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -442,7 +442,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidatePlaceOrderRequestAsyn public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await PlaceOrderWithHttpInfoAsync(order, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -457,7 +457,7 @@ public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, Sys Org.OpenAPITools.Client.ApiResponse result = await PlaceOrderWithHttpInfoAsync(order, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -493,7 +493,7 @@ public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, Sys - // todo localVarRequestOptions.Data = order; + // todo localVarRequestOptions.Content = order; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -512,10 +512,10 @@ public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, Sys string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs index ba76f373a2e2..bf6b9cb60b49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs @@ -305,7 +305,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUserRequestAsyn - // todo localVarRequestOptions.Data = user; + // todo localVarRequestOptions.Content = user; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -322,10 +322,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUserRequestAsyn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -372,7 +372,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUsersWithArrayI - // todo localVarRequestOptions.Data = user; + // todo localVarRequestOptions.Content = user; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -389,10 +389,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUsersWithArrayI string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -439,7 +439,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUsersWithListIn - // todo localVarRequestOptions.Data = user; + // todo localVarRequestOptions.Content = user; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -456,10 +456,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateCreateUsersWithListIn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -522,10 +522,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateDeleteUserRequestAsyn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -548,7 +548,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateGetUserByNameRequestA public async System.Threading.Tasks.Task GetUserByNameAsync(string username, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await GetUserByNameWithHttpInfoAsync(username, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -563,7 +563,7 @@ public async System.Threading.Tasks.Task GetUserByNameAsync(string usernam Org.OpenAPITools.Client.ApiResponse result = await GetUserByNameWithHttpInfoAsync(username, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -617,10 +617,10 @@ public async System.Threading.Tasks.Task GetUserByNameAsync(string usernam string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -645,7 +645,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateLoginUserRequestAsync public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, System.Threading.CancellationToken? cancellationToken = null) { Org.OpenAPITools.Client.ApiResponse result = await LoginUserWithHttpInfoAsync(username, password, cancellationToken).ConfigureAwait(false); - return result.Data ?? throw new NullReferenceException(); + return result.Content ?? throw new NullReferenceException(); } /// @@ -661,7 +661,7 @@ public async System.Threading.Tasks.Task LoginUserAsync(string username, Org.OpenAPITools.Client.ApiResponse result = await LoginUserWithHttpInfoAsync(username, password, cancellationToken).ConfigureAwait(false); return result.IsSuccessStatusCode - ? result.Data + ? result.Content : null; } @@ -720,10 +720,10 @@ public async System.Threading.Tasks.Task LoginUserAsync(string username, string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -780,10 +780,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateLogoutUserRequestAsyn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } @@ -836,7 +836,7 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUpdateUserRequestAsyn - // todo localVarRequestOptions.Data = user; + // todo localVarRequestOptions.Content = user; request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); @@ -853,10 +853,10 @@ protected virtual System.Threading.Tasks.ValueTask ValidateUpdateUserRequestAsyn string responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiResponse apiResponse = new(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Data = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawData, CocApi.Client.ClientUtils.JsonSerializerSettings); + apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject(apiResponse.RawContent, Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiException.cs index b804a84b7ea4..4a44193cd046 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiException.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiException.cs @@ -30,21 +30,21 @@ public class ApiException : Exception /// /// The raw data returned by the api /// - public string RawData { get; } + public string RawContent { get; } /// /// Construct the ApiException from parts of the reponse /// /// /// - /// - public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawData) : base(reasonPhrase ?? rawData) + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) { ReasonPhrase = reasonPhrase; StatusCode = statusCode; - RawData = rawData; + RawContent = rawContent; } } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiResponse.cs index dddc3fd48d12..a4f46cd204be 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiResponse.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiResponse.cs @@ -39,20 +39,20 @@ public interface IApiResponse /// /// The raw content of this response /// - string RawData { get; } + string RawContent { get; } } /// /// API Response /// - public class ApiResponse : IApiResponse + public partial class ApiResponse : IApiResponse { #region Properties /// - /// The deserialized data + /// The deserialized content /// - public T? Data { get; set; } + public T??? Content { get; set; } /// /// Gets or sets the status code (HTTP status code) @@ -76,7 +76,7 @@ public Type ResponseType /// /// The raw data /// - public string RawData { get; } + public string RawContent { get; } /// /// The IsSuccessStatusCode from the api response @@ -86,7 +86,7 @@ public Type ResponseType /// /// The reason phrase contained in the api response /// - public string? ReasonPhrase { get; } + public string??? ReasonPhrase { get; } /// /// The headers contained in the api response @@ -99,14 +99,14 @@ public Type ResponseType /// Construct the reponse using an HttpResponseMessage /// /// - /// - public ApiResponse(System.Net.Http.HttpResponseMessage response, string rawData) + /// + public ApiResponse(System.Net.Http.HttpResponseMessage response, string rawContent) { StatusCode = response.StatusCode; Headers = response.Headers; IsSuccessStatusCode = response.IsSuccessStatusCode; ReasonPhrase = response.ReasonPhrase; - RawData = rawData; + RawContent = rawContent; } } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 5f212ec734f2..1f3ffcfe3377 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -17,9 +17,6 @@ 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; @@ -43,17 +40,17 @@ public partial class AdditionalPropertiesClass : IEquatablemapWithUndeclaredPropertiesAnytype3. /// an object with no declared properties and no undeclared properties, hence it's an empty map.. /// mapWithUndeclaredPropertiesString. - public AdditionalPropertiesClass(Dictionary mapProperty = default(Dictionary), Dictionary> mapOfMapProperty = default(Dictionary>), Object anytype1 = default(Object), Object mapWithUndeclaredPropertiesAnytype1 = default(Object), Object mapWithUndeclaredPropertiesAnytype2 = default(Object), Dictionary mapWithUndeclaredPropertiesAnytype3 = default(Dictionary), Object emptyMap = default(Object), Dictionary mapWithUndeclaredPropertiesString = default(Dictionary)) + public AdditionalPropertiesClass(Dictionary mapProperty, Dictionary> mapOfMapProperty, Object anytype1, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Object emptyMap, Dictionary mapWithUndeclaredPropertiesString) { - this.MapProperty = mapProperty; - this.MapOfMapProperty = mapOfMapProperty; - this.Anytype1 = anytype1; - this.MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; - this.MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; - this.MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; - this.EmptyMap = emptyMap; - this.MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; - this.AdditionalProperties = new Dictionary(); + MapProperty = mapProperty; + MapOfMapProperty = mapOfMapProperty; + Anytype1 = anytype1; + MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + EmptyMap = emptyMap; + MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + AdditionalProperties = new Dictionary(); } /// @@ -119,15 +116,15 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class AdditionalPropertiesClass {\n"); - sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); - sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); - sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); - sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append("\n"); - sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); - sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); - sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); - sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append('\n'); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append('\n'); + sb.Append(" Anytype1: ").Append(Anytype1).Append('\n'); + sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append('\n'); + sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append('\n'); + sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append('\n'); + sb.Append(" EmptyMap: ").Append(EmptyMap).Append('\n'); + sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -136,9 +133,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -146,7 +143,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as AdditionalPropertiesClass).AreEqual; } @@ -156,7 +153,7 @@ public override bool Equals(object input) /// /// Instance of AdditionalPropertiesClass to be compared /// Boolean - public bool Equals(AdditionalPropertiesClass input) + public bool Equals(AdditionalPropertiesClass? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } 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 95c79122ad70..27315b09c419 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 @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,7 +28,7 @@ namespace Org.OpenAPITools.Model /// Animal /// [DataContract(Name = "Animal")] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "ClassName")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] public partial class Animal : IEquatable, IValidatableObject @@ -44,18 +41,20 @@ protected Animal() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// className (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string className, string color) { // to ensure "className" is required (not null) - this.ClassName = className ?? throw new ArgumentNullException("className is a required property for Animal and cannot be null"); + ClassName = className ?? throw new ArgumentNullException("className is a required property for Animal and cannot be null"); + // use default value if no "color" provided - this.Color = color ?? "red"; - this.AdditionalProperties = new Dictionary(); + Color = color ?? "red"; + AdditionalProperties = new Dictionary(); } /// @@ -84,9 +83,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Animal {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Color: ").Append(Color).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ClassName: ").Append(ClassName).Append('\n'); + sb.Append(" Color: ").Append(Color).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -95,9 +94,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -105,7 +104,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Animal).AreEqual; } @@ -115,7 +114,7 @@ public override bool Equals(object input) /// /// Instance of Animal to be compared /// Boolean - public bool Equals(Animal input) + public bool Equals(Animal? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ApiResponse.cs index c9a0a78efa72..cbccff5c47e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -17,9 +17,6 @@ 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; @@ -38,12 +35,12 @@ public partial class ApiResponse : IEquatable, IValidatableObject /// code. /// type. /// message. - public ApiResponse(int code = default(int), string type = default(string), string message = default(string)) + public ApiResponse(int code, string type, string message) { - this.Code = code; - this.Type = type; - this.Message = message; - this.AdditionalProperties = new Dictionary(); + Code = code; + Type = type; + Message = message; + AdditionalProperties = new Dictionary(); } /// @@ -78,10 +75,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ApiResponse {\n"); - sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Code: ").Append(Code).Append('\n'); + sb.Append(" Type: ").Append(Type).Append('\n'); + sb.Append(" Message: ").Append(Message).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -90,9 +87,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -100,7 +97,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ApiResponse).AreEqual; } @@ -110,7 +107,7 @@ public override bool Equals(object input) /// /// Instance of ApiResponse to be compared /// Boolean - public bool Equals(ApiResponse input) + public bool Equals(ApiResponse? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index b414d3021a66..1ae420255734 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -17,9 +17,6 @@ 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; @@ -37,11 +34,11 @@ public partial class Apple : IEquatable, IValidatableObject /// /// cultivar. /// origin. - public Apple(string cultivar = default(string), string origin = default(string)) + public Apple(string cultivar, string origin) { - this.Cultivar = cultivar; - this.Origin = origin; - this.AdditionalProperties = new Dictionary(); + Cultivar = cultivar; + Origin = origin; + AdditionalProperties = new Dictionary(); } /// @@ -70,9 +67,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Apple {\n"); - sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); - sb.Append(" Origin: ").Append(Origin).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append('\n'); + sb.Append(" Origin: ").Append(Origin).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +78,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +88,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Apple).AreEqual; } @@ -101,7 +98,7 @@ public override bool Equals(object input) /// /// Instance of Apple to be compared /// Boolean - public bool Equals(Apple input) + public bool Equals(Apple? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AppleReq.cs index 7501463d8012..0d18a148eaa7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/AppleReq.cs @@ -17,9 +17,6 @@ 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; @@ -42,11 +39,12 @@ protected AppleReq() { } /// /// cultivar (required). /// mealy. - public AppleReq(string cultivar = default(string), bool mealy = default(bool)) + public AppleReq(string cultivar, bool mealy) { // to ensure "cultivar" is required (not null) - this.Cultivar = cultivar ?? throw new ArgumentNullException("cultivar is a required property for AppleReq and cannot be null"); - this.Mealy = mealy; + Cultivar = cultivar ?? throw new ArgumentNullException("cultivar is a required property for AppleReq and cannot be null"); + + Mealy = mealy; } /// @@ -69,8 +67,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class AppleReq {\n"); - sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); - sb.Append(" Mealy: ").Append(Mealy).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append('\n'); + sb.Append(" Mealy: ").Append(Mealy).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -79,9 +77,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -89,7 +87,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as AppleReq).AreEqual; } @@ -99,7 +97,7 @@ public override bool Equals(object input) /// /// Instance of AppleReq to be compared /// Boolean - public bool Equals(AppleReq input) + public bool Equals(AppleReq? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index bf2c8663ff64..dd3ebfb7e343 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class ArrayOfArrayOfNumberOnly : IEquatable class. /// /// arrayArrayNumber. - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber = default(List>)) + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) { - this.ArrayArrayNumber = arrayArrayNumber; - this.AdditionalProperties = new Dictionary(); + ArrayArrayNumber = arrayArrayNumber; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ArrayOfArrayOfNumberOnly {\n"); - sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfArrayOfNumberOnly).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of ArrayOfArrayOfNumberOnly to be compared /// Boolean - public bool Equals(ArrayOfArrayOfNumberOnly input) + public bool Equals(ArrayOfArrayOfNumberOnly? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 09a9bbb88500..297ee6c14eca 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class ArrayOfNumberOnly : IEquatable, IValidat /// Initializes a new instance of the class. /// /// arrayNumber. - public ArrayOfNumberOnly(List arrayNumber = default(List)) + public ArrayOfNumberOnly(List arrayNumber) { - this.ArrayNumber = arrayNumber; - this.AdditionalProperties = new Dictionary(); + ArrayNumber = arrayNumber; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ArrayOfNumberOnly {\n"); - sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfNumberOnly).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of ArrayOfNumberOnly to be compared /// Boolean - public bool Equals(ArrayOfNumberOnly input) + public bool Equals(ArrayOfNumberOnly? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayTest.cs index 4406ffb33ea8..9c22f08d15d7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -17,9 +17,6 @@ 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; @@ -38,12 +35,12 @@ public partial class ArrayTest : IEquatable, IValidatableObject /// arrayOfString. /// arrayArrayOfInteger. /// arrayArrayOfModel. - public ArrayTest(List arrayOfString = default(List), List> arrayArrayOfInteger = default(List>), List> arrayArrayOfModel = default(List>)) + public ArrayTest(List arrayOfString, List> arrayArrayOfInteger, List> arrayArrayOfModel) { - this.ArrayOfString = arrayOfString; - this.ArrayArrayOfInteger = arrayArrayOfInteger; - this.ArrayArrayOfModel = arrayArrayOfModel; - this.AdditionalProperties = new Dictionary(); + ArrayOfString = arrayOfString; + ArrayArrayOfInteger = arrayArrayOfInteger; + ArrayArrayOfModel = arrayArrayOfModel; + AdditionalProperties = new Dictionary(); } /// @@ -78,10 +75,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ArrayTest {\n"); - sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); - sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); - sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append('\n'); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append('\n'); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -90,9 +87,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -100,7 +97,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayTest).AreEqual; } @@ -110,7 +107,7 @@ public override bool Equals(object input) /// /// Instance of ArrayTest to be compared /// Boolean - public bool Equals(ArrayTest input) + public bool Equals(ArrayTest? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Banana.cs index a7513bb453af..ff4e3de7bcb7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Banana.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class Banana : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// lengthCm. - public Banana(decimal lengthCm = default(decimal)) + public Banana(decimal lengthCm) { - this.LengthCm = lengthCm; - this.AdditionalProperties = new Dictionary(); + LengthCm = lengthCm; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Banana {\n"); - sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Banana).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of Banana to be compared /// Boolean - public bool Equals(Banana input) + public bool Equals(Banana? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BananaReq.cs index 6e7c0c7fb3bd..c1cc13285c3a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BananaReq.cs @@ -17,9 +17,6 @@ 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; @@ -42,10 +39,11 @@ protected BananaReq() { } /// /// lengthCm (required). /// sweet. - public BananaReq(decimal lengthCm = default(decimal), bool sweet = default(bool)) + public BananaReq(decimal lengthCm, bool sweet) { - this.LengthCm = lengthCm; - this.Sweet = sweet; + LengthCm = lengthCm; + + Sweet = sweet; } /// @@ -68,8 +66,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class BananaReq {\n"); - sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); - sb.Append(" Sweet: ").Append(Sweet).Append("\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append('\n'); + sb.Append(" Sweet: ").Append(Sweet).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -78,9 +76,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -88,7 +86,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as BananaReq).AreEqual; } @@ -98,7 +96,7 @@ public override bool Equals(object input) /// /// Instance of BananaReq to be compared /// Boolean - public bool Equals(BananaReq input) + public bool Equals(BananaReq? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BasquePig.cs index 5c6f9a0e83db..66259ad4bb22 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/BasquePig.cs @@ -17,9 +17,6 @@ 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; @@ -40,15 +37,17 @@ protected BasquePig() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// className (required). - public BasquePig(string className = default(string)) + public BasquePig(string className) { // to ensure "className" is required (not null) - this.ClassName = className ?? throw new ArgumentNullException("className is a required property for BasquePig and cannot be null"); - this.AdditionalProperties = new Dictionary(); + ClassName = className ?? throw new ArgumentNullException("className is a required property for BasquePig and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -71,8 +70,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class BasquePig {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ClassName: ").Append(ClassName).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +80,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +90,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as BasquePig).AreEqual; } @@ -101,7 +100,7 @@ public override bool Equals(object input) /// /// Instance of BasquePig to be compared /// Boolean - public bool Equals(BasquePig input) + public bool Equals(BasquePig? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Capitalization.cs index a4ab27bd8986..6d20b732d026 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Capitalization.cs @@ -17,9 +17,6 @@ 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; @@ -41,15 +38,15 @@ public partial class Capitalization : IEquatable, IValidatableOb /// capitalSnake. /// sCAETHFlowPoints. /// Name of the pet . - public Capitalization(string smallCamel = default(string), string capitalCamel = default(string), string smallSnake = default(string), string capitalSnake = default(string), string sCAETHFlowPoints = default(string), string aTTNAME = default(string)) + public Capitalization(string smallCamel, string capitalCamel, string smallSnake, string capitalSnake, string sCAETHFlowPoints, string aTTNAME) { - this.SmallCamel = smallCamel; - this.CapitalCamel = capitalCamel; - this.SmallSnake = smallSnake; - this.CapitalSnake = capitalSnake; - this.SCAETHFlowPoints = sCAETHFlowPoints; - this.ATT_NAME = aTTNAME; - this.AdditionalProperties = new Dictionary(); + SmallCamel = smallCamel; + CapitalCamel = capitalCamel; + SmallSnake = smallSnake; + CapitalSnake = capitalSnake; + SCAETHFlowPoints = sCAETHFlowPoints; + ATT_NAME = aTTNAME; + AdditionalProperties = new Dictionary(); } /// @@ -103,13 +100,13 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Capitalization {\n"); - sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); - sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); - sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); - sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); - sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); - sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append('\n'); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append('\n'); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append('\n'); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append('\n'); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append('\n'); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -118,9 +115,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -128,7 +125,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Capitalization).AreEqual; } @@ -138,7 +135,7 @@ public override bool Equals(object input) /// /// Instance of Capitalization to be compared /// Boolean - public bool Equals(Capitalization input) + public bool Equals(Capitalization? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } 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 1c6fa0f4220b..e60a6507ec8b 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 @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,7 +28,7 @@ namespace Org.OpenAPITools.Model /// Cat /// [DataContract(Name = "Cat")] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "ClassName")] public partial class Cat : Animal, IEquatable, IValidatableObject { /// @@ -42,16 +39,17 @@ protected Cat() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// 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, string className, string color) : base(className, color) { - this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); + Declawed = declawed; + AdditionalProperties = new Dictionary(); } /// @@ -74,9 +72,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" Declawed: ").Append(Declawed).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -85,9 +83,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public override string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -95,7 +93,7 @@ public override string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Cat).AreEqual; } @@ -105,7 +103,7 @@ public override bool Equals(object input) /// /// Instance of Cat to be compared /// Boolean - public bool Equals(Cat input) + public bool Equals(Cat? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/CatAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/CatAllOf.cs index ed6a94eedebc..3dc55b472918 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/CatAllOf.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/CatAllOf.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class CatAllOf : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// declawed. - public CatAllOf(bool declawed = default(bool)) + public CatAllOf(bool declawed) { - this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); + Declawed = declawed; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class CatAllOf {\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as CatAllOf).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of CatAllOf to be compared /// Boolean - public bool Equals(CatAllOf input) + public bool Equals(CatAllOf? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } 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 581a23ef2a59..61fcf845854d 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 @@ -17,9 +17,6 @@ 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; @@ -40,17 +37,19 @@ protected Category() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// id. /// name (required) (default to "default-name"). - public Category(long id = default(long), string name = "default-name") + public Category(long id, string name) { // to ensure "name" is required (not null) - this.Name = name ?? throw new ArgumentNullException("name is a required property for Category and cannot be null"); - this.Id = id; - this.AdditionalProperties = new Dictionary(); + Name = name ?? throw new ArgumentNullException("name is a required property for Category and cannot be null"); + + Id = id; + AdditionalProperties = new Dictionary(); } /// @@ -79,9 +78,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Id: ").Append(Id).Append('\n'); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -90,9 +89,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -100,7 +99,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Category).AreEqual; } @@ -110,7 +109,7 @@ public override bool Equals(object input) /// /// Instance of Category to be compared /// Boolean - public bool Equals(Category input) + public bool Equals(Category? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs index 8c2d77ca45d0..effd531402ca 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,13 +28,13 @@ namespace Org.OpenAPITools.Model /// ChildCat /// [DataContract(Name = "ChildCat")] - [JsonConverter(typeof(JsonSubtypes), "PetType")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "PetType")] public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum PetTypeEnum { /// @@ -53,6 +50,7 @@ public enum PetTypeEnum /// [DataMember(Name = "pet_type", IsRequired = true, EmitDefaultValue = false)] public PetTypeEnum PetType { get; set; } + /// /// Initializes a new instance of the class. /// @@ -61,16 +59,18 @@ protected ChildCat() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name, PetTypeEnum petType) : base() { - this.PetType = petType; - this.Name = name; - this.AdditionalProperties = new Dictionary(); + PetType = petType; + + Name = name; + AdditionalProperties = new Dictionary(); } /// @@ -93,10 +93,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" PetType: ").Append(PetType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -105,9 +105,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public override string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -115,7 +115,7 @@ public override string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCat).AreEqual; } @@ -125,7 +125,7 @@ public override bool Equals(object input) /// /// Instance of ChildCat to be compared /// Boolean - public bool Equals(ChildCat input) + public bool Equals(ChildCat? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCatAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCatAllOf.cs index a8a0e05b660f..12eba360d3e3 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCatAllOf.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCatAllOf.cs @@ -17,9 +17,6 @@ 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; @@ -35,7 +32,7 @@ public partial class ChildCatAllOf : IEquatable, IValidatableObje /// /// Defines PetType /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum PetTypeEnum { /// @@ -51,16 +48,17 @@ public enum PetTypeEnum /// [DataMember(Name = "pet_type", EmitDefaultValue = false)] public PetTypeEnum? PetType { get; set; } + /// /// Initializes a new instance of the class. /// /// name. /// petType (default to PetTypeEnum.ChildCat). - public ChildCatAllOf(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat) + public ChildCatAllOf(string name, PetTypeEnum? petType) { - this.Name = name; - this.PetType = petType; - this.AdditionalProperties = new Dictionary(); + Name = name; + PetType = petType; + AdditionalProperties = new Dictionary(); } /// @@ -83,9 +81,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCatAllOf {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" PetType: ").Append(PetType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -94,9 +92,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -104,7 +102,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCatAllOf).AreEqual; } @@ -114,7 +112,7 @@ public override bool Equals(object input) /// /// Instance of ChildCatAllOf to be compared /// Boolean - public bool Equals(ChildCatAllOf input) + public bool Equals(ChildCatAllOf? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ClassModel.cs index bb2121cd5177..cba532bef754 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ClassModel.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class ClassModel : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// _class. - public ClassModel(string _class = default(string)) + public ClassModel(string _class) { - this.Class = _class; - this.AdditionalProperties = new Dictionary(); + Class = _class; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ClassModel {\n"); - sb.Append(" Class: ").Append(Class).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Class: ").Append(Class).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ClassModel).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of ClassModel to be compared /// Boolean - public bool Equals(ClassModel input) + public bool Equals(ClassModel? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 78f3c6c03e3a..e064e5a0ff0e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -17,9 +17,6 @@ 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; @@ -40,18 +37,21 @@ protected ComplexQuadrilateral() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// shapeType (required). /// quadrilateralType (required). - public ComplexQuadrilateral(string shapeType = default(string), string quadrilateralType = default(string)) + public ComplexQuadrilateral(string shapeType, string quadrilateralType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); + // to ensure "quadrilateralType" is required (not null) - this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); + QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -80,9 +80,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ComplexQuadrilateral {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -91,9 +91,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -101,7 +101,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ComplexQuadrilateral).AreEqual; } @@ -111,7 +111,7 @@ public override bool Equals(object input) /// /// Instance of ComplexQuadrilateral to be compared /// Boolean - public bool Equals(ComplexQuadrilateral input) + public bool Equals(ComplexQuadrilateral? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DanishPig.cs index dd2de1d038a5..6eff67a555ba 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DanishPig.cs @@ -17,9 +17,6 @@ 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; @@ -40,15 +37,17 @@ protected DanishPig() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// className (required). - public DanishPig(string className = default(string)) + public DanishPig(string className) { // to ensure "className" is required (not null) - this.ClassName = className ?? throw new ArgumentNullException("className is a required property for DanishPig and cannot be null"); - this.AdditionalProperties = new Dictionary(); + ClassName = className ?? throw new ArgumentNullException("className is a required property for DanishPig and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -71,8 +70,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class DanishPig {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ClassName: ").Append(ClassName).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +80,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +90,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as DanishPig).AreEqual; } @@ -101,7 +100,7 @@ public override bool Equals(object input) /// /// Instance of DanishPig to be compared /// Boolean - public bool Equals(DanishPig input) + public bool Equals(DanishPig? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } 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 1ff9ab1624dc..a3a9889e51bb 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 @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,7 +28,7 @@ namespace Org.OpenAPITools.Model /// Dog /// [DataContract(Name = "Dog")] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "ClassName")] public partial class Dog : Animal, IEquatable, IValidatableObject { /// @@ -42,16 +39,17 @@ protected Dog() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// 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, string className, string color) : base(className, color) { - this.Breed = breed; - this.AdditionalProperties = new Dictionary(); + Breed = breed; + AdditionalProperties = new Dictionary(); } /// @@ -74,9 +72,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" Breed: ").Append(Breed).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -85,9 +83,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public override string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -95,7 +93,7 @@ public override string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Dog).AreEqual; } @@ -105,7 +103,7 @@ public override bool Equals(object input) /// /// Instance of Dog to be compared /// Boolean - public bool Equals(Dog input) + public bool Equals(Dog? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DogAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DogAllOf.cs index cd2f1a0eeecc..eb14c5d63774 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DogAllOf.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/DogAllOf.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class DogAllOf : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// breed. - public DogAllOf(string breed = default(string)) + public DogAllOf(string breed) { - this.Breed = breed; - this.AdditionalProperties = new Dictionary(); + Breed = breed; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class DogAllOf {\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as DogAllOf).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of DogAllOf to be compared /// Boolean - public bool Equals(DogAllOf input) + public bool Equals(DogAllOf? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Drawing.cs index 28e2ea556933..50e4de4c197c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Drawing.cs @@ -17,9 +17,6 @@ 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; @@ -39,12 +36,12 @@ public partial class Drawing : Dictionary, IEquatable, I /// shapeOrNull. /// nullableShape. /// shapes. - public Drawing(Shape mainShape = default(Shape), ShapeOrNull shapeOrNull = default(ShapeOrNull), NullableShape nullableShape = default(NullableShape), List shapes = default(List)) : base() + public Drawing(Shape mainShape, ShapeOrNull shapeOrNull, NullableShape nullableShape, List shapes) : base() { - this.MainShape = mainShape; - this.ShapeOrNull = shapeOrNull; - this.NullableShape = nullableShape; - this.Shapes = shapes; + MainShape = mainShape; + ShapeOrNull = shapeOrNull; + NullableShape = nullableShape; + Shapes = shapes; } /// @@ -79,11 +76,11 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Drawing {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" MainShape: ").Append(MainShape).Append("\n"); - sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); - sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); - sb.Append(" Shapes: ").Append(Shapes).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" MainShape: ").Append(MainShape).Append('\n'); + sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append('\n'); + sb.Append(" NullableShape: ").Append(NullableShape).Append('\n'); + sb.Append(" Shapes: ").Append(Shapes).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -92,9 +89,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public string ToJson() + public string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -102,7 +99,7 @@ public string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Drawing).AreEqual; } @@ -112,7 +109,7 @@ public override bool Equals(object input) /// /// Instance of Drawing to be compared /// Boolean - public bool Equals(Drawing input) + public bool Equals(Drawing? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumArrays.cs index 8befbb0b5047..7ad39af66ea8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -17,9 +17,6 @@ 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; @@ -35,7 +32,7 @@ public partial class EnumArrays : IEquatable, IValidatableObject /// /// Defines JustSymbol /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum JustSymbolEnum { /// @@ -57,10 +54,11 @@ public enum JustSymbolEnum /// [DataMember(Name = "just_symbol", EmitDefaultValue = false)] public JustSymbolEnum? JustSymbol { get; set; } + /// /// Defines ArrayEnum /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ArrayEnumEnum { /// @@ -83,16 +81,17 @@ public enum ArrayEnumEnum /// [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default(JustSymbolEnum?), List arrayEnum = default(List)) + public EnumArrays(JustSymbolEnum? justSymbol, List arrayEnum) { - this.JustSymbol = justSymbol; - this.ArrayEnum = arrayEnum; - this.AdditionalProperties = new Dictionary(); + JustSymbol = justSymbol; + ArrayEnum = arrayEnum; + AdditionalProperties = new Dictionary(); } /// @@ -109,9 +108,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class EnumArrays {\n"); - sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); - sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append('\n'); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -120,9 +119,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -130,7 +129,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as EnumArrays).AreEqual; } @@ -140,7 +139,7 @@ public override bool Equals(object input) /// /// Instance of EnumArrays to be compared /// Boolean - public bool Equals(EnumArrays input) + public bool Equals(EnumArrays? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumClass.cs index 99f8afbbbfd5..e2300190ba1d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumClass.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumTest.cs index 233087cc1705..ce68379d944b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EnumTest.cs @@ -17,9 +17,6 @@ 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; @@ -35,7 +32,7 @@ public partial class EnumTest : IEquatable, IValidatableObject /// /// Defines EnumString /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum EnumStringEnum { /// @@ -63,10 +60,11 @@ public enum EnumStringEnum /// [DataMember(Name = "enum_string", EmitDefaultValue = false)] public EnumStringEnum? EnumString { get; set; } + /// /// Defines EnumStringRequired /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum EnumStringRequiredEnum { /// @@ -94,6 +92,7 @@ public enum EnumStringRequiredEnum /// [DataMember(Name = "enum_string_required", IsRequired = true, EmitDefaultValue = false)] public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// @@ -116,10 +115,11 @@ public enum EnumIntegerEnum /// [DataMember(Name = "enum_integer", EmitDefaultValue = false)] public EnumIntegerEnum? EnumInteger { get; set; } + /// /// Defines EnumNumber /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum EnumNumberEnum { /// @@ -141,26 +141,31 @@ public enum EnumNumberEnum /// [DataMember(Name = "enum_number", EmitDefaultValue = false)] public EnumNumberEnum? EnumNumber { get; set; } + /// /// Gets or Sets OuterEnum /// [DataMember(Name = "outerEnum", EmitDefaultValue = true)] public OuterEnum? OuterEnum { get; set; } + /// /// Gets or Sets OuterEnumInteger /// [DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)] public OuterEnumInteger? OuterEnumInteger { get; set; } + /// /// Gets or Sets OuterEnumDefaultValue /// [DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)] public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; } + /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [DataMember(Name = "outerEnumIntegerDefaultValue", EmitDefaultValue = false)] public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get; set; } + /// /// Initializes a new instance of the class. /// @@ -169,6 +174,7 @@ protected EnumTest() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// @@ -180,17 +186,18 @@ protected EnumTest() /// outerEnumInteger. /// outerEnumDefaultValue. /// outerEnumIntegerDefaultValue. - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?)) + public EnumTest(EnumStringEnum? enumString, EnumStringRequiredEnum enumStringRequired, EnumIntegerEnum? enumInteger, EnumNumberEnum? enumNumber, OuterEnum? outerEnum, OuterEnumInteger? outerEnumInteger, OuterEnumDefaultValue? outerEnumDefaultValue, OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue) { - this.EnumStringRequired = enumStringRequired; - this.EnumString = enumString; - this.EnumInteger = enumInteger; - this.EnumNumber = enumNumber; - this.OuterEnum = outerEnum; - this.OuterEnumInteger = outerEnumInteger; - this.OuterEnumDefaultValue = outerEnumDefaultValue; - this.OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; - this.AdditionalProperties = new Dictionary(); + EnumStringRequired = enumStringRequired; + + EnumString = enumString; + EnumInteger = enumInteger; + EnumNumber = enumNumber; + OuterEnum = outerEnum; + OuterEnumInteger = outerEnumInteger; + OuterEnumDefaultValue = outerEnumDefaultValue; + OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + AdditionalProperties = new Dictionary(); } /// @@ -207,15 +214,15 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class EnumTest {\n"); - sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); - sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); - sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); - sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); - sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); - sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" EnumString: ").Append(EnumString).Append('\n'); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append('\n'); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append('\n'); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append('\n'); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append('\n'); + sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append('\n'); + sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append('\n'); + sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -224,9 +231,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -234,7 +241,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as EnumTest).AreEqual; } @@ -244,7 +251,7 @@ public override bool Equals(object input) /// /// Instance of EnumTest to be compared /// Boolean - public bool Equals(EnumTest input) + public bool Equals(EnumTest? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index ed443f68cf77..c870b32f841f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -17,9 +17,6 @@ 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; @@ -40,18 +37,21 @@ protected EquilateralTriangle() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// shapeType (required). /// triangleType (required). - public EquilateralTriangle(string shapeType = default(string), string triangleType = default(string)) + public EquilateralTriangle(string shapeType, string triangleType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); + // to ensure "triangleType" is required (not null) - this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); + TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -80,9 +80,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class EquilateralTriangle {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" TriangleType: ").Append(TriangleType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -91,9 +91,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -101,7 +101,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as EquilateralTriangle).AreEqual; } @@ -111,7 +111,7 @@ public override bool Equals(object input) /// /// Instance of EquilateralTriangle to be compared /// Boolean - public bool Equals(EquilateralTriangle input) + public bool Equals(EquilateralTriangle? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/File.cs index af4a38ae023d..9e67654e5691 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/File.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class File : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// Test capitalization. - public File(string sourceURI = default(string)) + public File(string sourceURI) { - this.SourceURI = sourceURI; - this.AdditionalProperties = new Dictionary(); + SourceURI = sourceURI; + AdditionalProperties = new Dictionary(); } /// @@ -63,8 +60,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class File {\n"); - sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -73,9 +70,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -83,7 +80,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as File).AreEqual; } @@ -93,7 +90,7 @@ public override bool Equals(object input) /// /// Instance of File to be compared /// Boolean - public bool Equals(File input) + public bool Equals(File? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index cc6b3e34c5db..2f67bda493ed 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -17,9 +17,6 @@ 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; @@ -37,11 +34,11 @@ public partial class FileSchemaTestClass : IEquatable, IVal /// /// file. /// files. - public FileSchemaTestClass(File file = default(File), List files = default(List)) + public FileSchemaTestClass(File file, List files) { - this.File = file; - this.Files = files; - this.AdditionalProperties = new Dictionary(); + File = file; + Files = files; + AdditionalProperties = new Dictionary(); } /// @@ -70,9 +67,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class FileSchemaTestClass {\n"); - sb.Append(" File: ").Append(File).Append("\n"); - sb.Append(" Files: ").Append(Files).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" File: ").Append(File).Append('\n'); + sb.Append(" Files: ").Append(Files).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +78,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +88,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as FileSchemaTestClass).AreEqual; } @@ -101,7 +98,7 @@ public override bool Equals(object input) /// /// Instance of FileSchemaTestClass to be compared /// Boolean - public bool Equals(FileSchemaTestClass input) + public bool Equals(FileSchemaTestClass? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } 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 836374681193..9643e1ab97fc 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 @@ -17,9 +17,6 @@ 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; @@ -36,11 +33,11 @@ public partial class Foo : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// bar (default to "bar"). - public Foo(string bar = "bar") + public Foo(string bar) { // use default value if no "bar" provided - this.Bar = bar ?? "bar"; - this.AdditionalProperties = new Dictionary(); + Bar = bar ?? "bar"; + AdditionalProperties = new Dictionary(); } /// @@ -63,8 +60,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Foo {\n"); - sb.Append(" Bar: ").Append(Bar).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Bar: ").Append(Bar).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -73,9 +70,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -83,7 +80,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Foo).AreEqual; } @@ -93,7 +90,7 @@ public override bool Equals(object input) /// /// Instance of Foo to be compared /// Boolean - public bool Equals(Foo input) + public bool Equals(Foo? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index 9e7466bb502e..b224071573d6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -17,9 +17,6 @@ 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; @@ -40,6 +37,7 @@ protected FormatTest() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// @@ -59,27 +57,31 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), long int64 = default(long), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + public FormatTest(int integer, int int32, long int64, decimal number, float _float, double _double, decimal _decimal, string _string, byte[] _byte, System.IO.Stream binary, DateTime date, DateTime dateTime, Guid uuid, string password, string patternWithDigits, string patternWithDigitsAndDelimiter) { - this.Number = number; + Number = number; + // to ensure "_byte" is required (not null) - this.Byte = _byte ?? throw new ArgumentNullException("_byte is a required property for FormatTest and cannot be null"); - this.Date = date; + Byte = _byte ?? throw new ArgumentNullException("_byte is a required property for FormatTest and cannot be null"); + + Date = date; + // to ensure "password" is required (not null) - this.Password = password ?? throw new ArgumentNullException("password is a required property for FormatTest and cannot be null"); - this.Integer = integer; - this.Int32 = int32; - this.Int64 = int64; - this.Float = _float; - this.Double = _double; - this.Decimal = _decimal; - this.String = _string; - this.Binary = binary; - this.DateTime = dateTime; - this.Uuid = uuid; - this.PatternWithDigits = patternWithDigits; - this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; - this.AdditionalProperties = new Dictionary(); + Password = password ?? throw new ArgumentNullException("password is a required property for FormatTest and cannot be null"); + + Integer = integer; + Int32 = int32; + Int64 = int64; + Float = _float; + Double = _double; + Decimal = _decimal; + String = _string; + Binary = binary; + DateTime = dateTime; + Uuid = uuid; + PatternWithDigits = patternWithDigits; + PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + AdditionalProperties = new Dictionary(); } /// @@ -146,7 +148,7 @@ protected FormatTest() /// Gets or Sets Date /// [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] + [Newtonsoft.Json.JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } /// @@ -195,23 +197,23 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Int32: ").Append(Int32).Append("\n"); - sb.Append(" Int64: ").Append(Int64).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Float: ").Append(Float).Append("\n"); - sb.Append(" Double: ").Append(Double).Append("\n"); - sb.Append(" Decimal: ").Append(Decimal).Append("\n"); - sb.Append(" String: ").Append(String).Append("\n"); - sb.Append(" Byte: ").Append(Byte).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); - sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); - sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Integer: ").Append(Integer).Append('\n'); + sb.Append(" Int32: ").Append(Int32).Append('\n'); + sb.Append(" Int64: ").Append(Int64).Append('\n'); + sb.Append(" Number: ").Append(Number).Append('\n'); + sb.Append(" Float: ").Append(Float).Append('\n'); + sb.Append(" Double: ").Append(Double).Append('\n'); + sb.Append(" Decimal: ").Append(Decimal).Append('\n'); + sb.Append(" String: ").Append(String).Append('\n'); + sb.Append(" Byte: ").Append(Byte).Append('\n'); + sb.Append(" Binary: ").Append(Binary).Append('\n'); + sb.Append(" Date: ").Append(Date).Append('\n'); + sb.Append(" DateTime: ").Append(DateTime).Append('\n'); + sb.Append(" Uuid: ").Append(Uuid).Append('\n'); + sb.Append(" Password: ").Append(Password).Append('\n'); + sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append('\n'); + sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -220,9 +222,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -230,7 +232,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as FormatTest).AreEqual; } @@ -240,7 +242,7 @@ public override bool Equals(object input) /// /// Instance of FormatTest to be compared /// Boolean - public bool Equals(FormatTest input) + public bool Equals(FormatTest? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Fruit.cs index 8226bbd0a2fe..f173794fade2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Fruit.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FruitReq.cs index 57d5d8d271bd..77141c1860d9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FruitReq.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs index c168aa41d4ce..5d83a2d14eb4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GmFruit.cs @@ -17,12 +17,10 @@ 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; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 9352d27022f2..4a85e09bd443 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,7 +28,7 @@ namespace Org.OpenAPITools.Model /// GrandparentAnimal /// [DataContract(Name = "GrandparentAnimal")] - [JsonConverter(typeof(JsonSubtypes), "PetType")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] [JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")] public partial class GrandparentAnimal : IEquatable, IValidatableObject @@ -44,15 +41,17 @@ protected GrandparentAnimal() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// petType (required). - public GrandparentAnimal(string petType = default(string)) + public GrandparentAnimal(string petType) { // to ensure "petType" is required (not null) - this.PetType = petType ?? throw new ArgumentNullException("petType is a required property for GrandparentAnimal and cannot be null"); - this.AdditionalProperties = new Dictionary(); + PetType = petType ?? throw new ArgumentNullException("petType is a required property for GrandparentAnimal and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -75,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class GrandparentAnimal {\n"); - sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" PetType: ").Append(PetType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -85,9 +84,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -95,7 +94,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as GrandparentAnimal).AreEqual; } @@ -105,7 +104,7 @@ public override bool Equals(object input) /// /// Instance of GrandparentAnimal to be compared /// Boolean - public bool Equals(GrandparentAnimal input) + public bool Equals(GrandparentAnimal? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 3a2c3d26a92c..ff580ed1bc4c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -17,9 +17,6 @@ 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; @@ -38,7 +35,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable [JsonConstructorAttribute] public HasOnlyReadOnly() { - this.AdditionalProperties = new Dictionary(); + AdditionalProperties = new Dictionary(); } /// @@ -85,9 +82,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class HasOnlyReadOnly {\n"); - sb.Append(" Bar: ").Append(Bar).Append("\n"); - sb.Append(" Foo: ").Append(Foo).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Bar: ").Append(Bar).Append('\n'); + sb.Append(" Foo: ").Append(Foo).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -96,9 +93,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -106,7 +103,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; } @@ -116,7 +113,7 @@ public override bool Equals(object input) /// /// Instance of HasOnlyReadOnly to be compared /// Boolean - public bool Equals(HasOnlyReadOnly input) + public bool Equals(HasOnlyReadOnly? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 1cd90560cbed..33abc7169e17 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class HealthCheckResult : IEquatable, IValidat /// Initializes a new instance of the class. /// /// nullableMessage. - public HealthCheckResult(string nullableMessage = default(string)) + public HealthCheckResult(string nullableMessage) { - this.NullableMessage = nullableMessage; - this.AdditionalProperties = new Dictionary(); + NullableMessage = nullableMessage; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class HealthCheckResult {\n"); - sb.Append(" NullableMessage: ").Append(NullableMessage).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" NullableMessage: ").Append(NullableMessage).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as HealthCheckResult).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of HealthCheckResult to be compared /// Boolean - public bool Equals(HealthCheckResult input) + public bool Equals(HealthCheckResult? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs index 5f4b24acafa1..21318273d8d2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class InlineResponseDefault : IEquatable, /// Initializes a new instance of the class. /// /// _string. - public InlineResponseDefault(Foo _string = default(Foo)) + public InlineResponseDefault(Foo _string) { - this.String = _string; - this.AdditionalProperties = new Dictionary(); + String = _string; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class InlineResponseDefault {\n"); - sb.Append(" String: ").Append(String).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" String: ").Append(String).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as InlineResponseDefault).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of InlineResponseDefault to be compared /// Boolean - public bool Equals(InlineResponseDefault input) + public bool Equals(InlineResponseDefault? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 46963173f71a..1314675aaf9d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -17,9 +17,6 @@ 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; @@ -42,12 +39,14 @@ protected IsoscelesTriangle() { } /// /// shapeType (required). /// triangleType (required). - public IsoscelesTriangle(string shapeType = default(string), string triangleType = default(string)) + public IsoscelesTriangle(string shapeType, string triangleType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for IsoscelesTriangle and cannot be null"); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for IsoscelesTriangle and cannot be null"); + // to ensure "triangleType" is required (not null) - this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for IsoscelesTriangle and cannot be null"); + TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for IsoscelesTriangle and cannot be null"); + } /// @@ -70,8 +69,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class IsoscelesTriangle {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" TriangleType: ").Append(TriangleType).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -80,9 +79,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -90,7 +89,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as IsoscelesTriangle).AreEqual; } @@ -100,7 +99,7 @@ public override bool Equals(object input) /// /// Instance of IsoscelesTriangle to be compared /// Boolean - public bool Equals(IsoscelesTriangle input) + public bool Equals(IsoscelesTriangle? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/List.cs index ecf4e8ff00ea..becac7836312 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/List.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class List : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// _123list. - public List(string _123list = default(string)) + public List(string _123list) { - this._123List = _123list; - this.AdditionalProperties = new Dictionary(); + _123List = _123list; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class List {\n"); - sb.Append(" _123List: ").Append(_123List).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" _123List: ").Append(_123List).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as List).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of List to be compared /// Boolean - public bool Equals(List input) + public bool Equals(List? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Mammal.cs index c8e3229ed3b2..abebdf3a81e4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Mammal.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MapTest.cs index 0f9e49a98b35..b0947aafb55e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MapTest.cs @@ -17,9 +17,6 @@ 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; @@ -35,7 +32,7 @@ public partial class MapTest : IEquatable, IValidatableObject /// /// Defines Inner /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum InnerEnum { /// @@ -58,6 +55,7 @@ public enum InnerEnum /// [DataMember(Name = "map_of_enum_string", EmitDefaultValue = false)] public Dictionary MapOfEnumString { get; set; } + /// /// Initializes a new instance of the class. /// @@ -65,13 +63,13 @@ public enum InnerEnum /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) + public MapTest(Dictionary> mapMapOfString, Dictionary mapOfEnumString, Dictionary directMap, Dictionary indirectMap) { - this.MapMapOfString = mapMapOfString; - this.MapOfEnumString = mapOfEnumString; - this.DirectMap = directMap; - this.IndirectMap = indirectMap; - this.AdditionalProperties = new Dictionary(); + MapMapOfString = mapMapOfString; + MapOfEnumString = mapOfEnumString; + DirectMap = directMap; + IndirectMap = indirectMap; + AdditionalProperties = new Dictionary(); } /// @@ -106,11 +104,11 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class MapTest {\n"); - sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); - sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); - sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); - sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append('\n'); + sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append('\n'); + sb.Append(" DirectMap: ").Append(DirectMap).Append('\n'); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -119,9 +117,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -129,7 +127,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as MapTest).AreEqual; } @@ -139,7 +137,7 @@ public override bool Equals(object input) /// /// Instance of MapTest to be compared /// Boolean - public bool Equals(MapTest input) + public bool Equals(MapTest? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index dc3d45a080a4..fafa4537259a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -17,9 +17,6 @@ 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; @@ -38,12 +35,12 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IEquatableuuid. /// dateTime. /// map. - public MixedPropertiesAndAdditionalPropertiesClass(Guid uuid = default(Guid), DateTime dateTime = default(DateTime), Dictionary map = default(Dictionary)) + public MixedPropertiesAndAdditionalPropertiesClass(Guid uuid, DateTime dateTime, Dictionary map) { - this.Uuid = uuid; - this.DateTime = dateTime; - this.Map = map; - this.AdditionalProperties = new Dictionary(); + Uuid = uuid; + DateTime = dateTime; + Map = map; + AdditionalProperties = new Dictionary(); } /// @@ -78,10 +75,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Map: ").Append(Map).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append('\n'); + sb.Append(" DateTime: ").Append(DateTime).Append('\n'); + sb.Append(" Map: ").Append(Map).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -90,9 +87,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -100,7 +97,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as MixedPropertiesAndAdditionalPropertiesClass).AreEqual; } @@ -110,7 +107,7 @@ public override bool Equals(object input) /// /// Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared /// Boolean - public bool Equals(MixedPropertiesAndAdditionalPropertiesClass input) + public bool Equals(MixedPropertiesAndAdditionalPropertiesClass? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Model200Response.cs index b1e76d250816..ad85c9fc3689 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Model200Response.cs @@ -17,9 +17,6 @@ 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; @@ -37,11 +34,11 @@ public partial class Model200Response : IEquatable, IValidatab /// /// name. /// _class. - public Model200Response(int name = default(int), string _class = default(string)) + public Model200Response(int name, string _class) { - this.Name = name; - this.Class = _class; - this.AdditionalProperties = new Dictionary(); + Name = name; + Class = _class; + AdditionalProperties = new Dictionary(); } /// @@ -70,9 +67,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Model200Response {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Class: ").Append(Class).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" Class: ").Append(Class).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +78,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +88,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Model200Response).AreEqual; } @@ -101,7 +98,7 @@ public override bool Equals(object input) /// /// Instance of Model200Response to be compared /// Boolean - public bool Equals(Model200Response input) + public bool Equals(Model200Response? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs index 16f1dc95bab9..164ccadec8d1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class ModelClient : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// _client. - public ModelClient(string _client = default(string)) + public ModelClient(string _client) { - this.__Client = _client; - this.AdditionalProperties = new Dictionary(); + __Client = _client; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" __Client: ").Append(__Client).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ModelClient).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of ModelClient to be compared /// Boolean - public bool Equals(ModelClient input) + public bool Equals(ModelClient? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Name.cs index a6a01dd4ed3e..d80698c27f44 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Name.cs @@ -17,9 +17,6 @@ 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; @@ -40,16 +37,18 @@ protected Name() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// name (required). /// property. - public Name(int name = default(int), string property = default(string)) + public Name(int name, string property) { - this._Name = name; - this.Property = property; - this.AdditionalProperties = new Dictionary(); + _Name = name; + + Property = property; + AdditionalProperties = new Dictionary(); } /// @@ -108,11 +107,11 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Name {\n"); - sb.Append(" _Name: ").Append(_Name).Append("\n"); - sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); - sb.Append(" Property: ").Append(Property).Append("\n"); - sb.Append(" _123Number: ").Append(_123Number).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" _Name: ").Append(_Name).Append('\n'); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append('\n'); + sb.Append(" Property: ").Append(Property).Append('\n'); + sb.Append(" _123Number: ").Append(_123Number).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -121,9 +120,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -131,7 +130,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; } @@ -141,7 +140,7 @@ public override bool Equals(object input) /// /// Instance of Name to be compared /// Boolean - public bool Equals(Name input) + public bool Equals(Name? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableClass.cs index 4ceaab61bc63..09516927bedf 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableClass.cs @@ -17,9 +17,6 @@ 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; @@ -47,20 +44,20 @@ public partial class NullableClass : Dictionary, IEquatableobjectNullableProp. /// objectAndItemsNullableProp. /// objectItemsNullable. - public NullableClass(int? integerProp = default(int?), decimal? numberProp = default(decimal?), bool? booleanProp = default(bool?), string stringProp = default(string), DateTime? dateProp = default(DateTime?), DateTime? datetimeProp = default(DateTime?), List arrayNullableProp = default(List), List arrayAndItemsNullableProp = default(List), List arrayItemsNullable = default(List), Dictionary objectNullableProp = default(Dictionary), Dictionary objectAndItemsNullableProp = default(Dictionary), Dictionary objectItemsNullable = default(Dictionary)) : base() + public NullableClass(int? integerProp, decimal? numberProp, bool? booleanProp, string stringProp, DateTime? dateProp, DateTime? datetimeProp, List arrayNullableProp, List arrayAndItemsNullableProp, List arrayItemsNullable, Dictionary objectNullableProp, Dictionary objectAndItemsNullableProp, Dictionary objectItemsNullable) : base() { - this.IntegerProp = integerProp; - this.NumberProp = numberProp; - this.BooleanProp = booleanProp; - this.StringProp = stringProp; - this.DateProp = dateProp; - this.DatetimeProp = datetimeProp; - this.ArrayNullableProp = arrayNullableProp; - this.ArrayAndItemsNullableProp = arrayAndItemsNullableProp; - this.ArrayItemsNullable = arrayItemsNullable; - this.ObjectNullableProp = objectNullableProp; - this.ObjectAndItemsNullableProp = objectAndItemsNullableProp; - this.ObjectItemsNullable = objectItemsNullable; + IntegerProp = integerProp; + NumberProp = numberProp; + BooleanProp = booleanProp; + StringProp = stringProp; + DateProp = dateProp; + DatetimeProp = datetimeProp; + ArrayNullableProp = arrayNullableProp; + ArrayAndItemsNullableProp = arrayAndItemsNullableProp; + ArrayItemsNullable = arrayItemsNullable; + ObjectNullableProp = objectNullableProp; + ObjectAndItemsNullableProp = objectAndItemsNullableProp; + ObjectItemsNullable = objectItemsNullable; } /// @@ -91,7 +88,7 @@ public partial class NullableClass : Dictionary, IEquatable [DataMember(Name = "date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] + [Newtonsoft.Json.JsonConverter(typeof(OpenAPIDateConverter))] public DateTime? DateProp { get; set; } /// @@ -144,19 +141,19 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class NullableClass {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); - sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); - sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); - sb.Append(" StringProp: ").Append(StringProp).Append("\n"); - sb.Append(" DateProp: ").Append(DateProp).Append("\n"); - sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append("\n"); - sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); - sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); - sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); - sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); - sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); - sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" IntegerProp: ").Append(IntegerProp).Append('\n'); + sb.Append(" NumberProp: ").Append(NumberProp).Append('\n'); + sb.Append(" BooleanProp: ").Append(BooleanProp).Append('\n'); + sb.Append(" StringProp: ").Append(StringProp).Append('\n'); + sb.Append(" DateProp: ").Append(DateProp).Append('\n'); + sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append('\n'); + sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append('\n'); + sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append('\n'); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append('\n'); + sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append('\n'); + sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append('\n'); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -165,9 +162,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public string ToJson() + public string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -175,7 +172,7 @@ public string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as NullableClass).AreEqual; } @@ -185,7 +182,7 @@ public override bool Equals(object input) /// /// Instance of NullableClass to be compared /// Boolean - public bool Equals(NullableClass input) + public bool Equals(NullableClass? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableShape.cs index ae8ae903e98e..7990fd0dc479 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NullableShape.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs index e9b006094cf6..8ab72763a878 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class NumberOnly : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// justNumber. - public NumberOnly(decimal justNumber = default(decimal)) + public NumberOnly(decimal justNumber) { - this.JustNumber = justNumber; - this.AdditionalProperties = new Dictionary(); + JustNumber = justNumber; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class NumberOnly {\n"); - sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" JustNumber: ").Append(JustNumber).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as NumberOnly).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of NumberOnly to be compared /// Boolean - public bool Equals(NumberOnly input) + public bool Equals(NumberOnly? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Order.cs index 975f3b711dd6..1715233b838a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Order.cs @@ -17,9 +17,6 @@ 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; @@ -36,7 +33,7 @@ public partial class Order : IEquatable, IValidatableObject /// Order Status /// /// Order Status - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum StatusEnum { /// @@ -65,6 +62,7 @@ public enum StatusEnum /// Order Status [DataMember(Name = "status", EmitDefaultValue = false)] public StatusEnum? Status { get; set; } + /// /// Initializes a new instance of the class. /// @@ -74,15 +72,15 @@ public enum StatusEnum /// shipDate. /// Order Status. /// complete (default to false). - public Order(long id = default(long), long petId = default(long), int quantity = default(int), DateTime shipDate = default(DateTime), StatusEnum? status = default(StatusEnum?), bool complete = false) + public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum? status, bool complete) { - this.Id = id; - this.PetId = petId; - this.Quantity = quantity; - this.ShipDate = shipDate; - this.Status = status; - this.Complete = complete; - this.AdditionalProperties = new Dictionary(); + Id = id; + PetId = petId; + Quantity = quantity; + ShipDate = shipDate; + Status = status; + Complete = complete; + AdditionalProperties = new Dictionary(); } /// @@ -129,13 +127,13 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Order {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" PetId: ").Append(PetId).Append("\n"); - sb.Append(" Quantity: ").Append(Quantity).Append("\n"); - sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Id: ").Append(Id).Append('\n'); + sb.Append(" PetId: ").Append(PetId).Append('\n'); + sb.Append(" Quantity: ").Append(Quantity).Append('\n'); + sb.Append(" ShipDate: ").Append(ShipDate).Append('\n'); + sb.Append(" Status: ").Append(Status).Append('\n'); + sb.Append(" Complete: ").Append(Complete).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -144,9 +142,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -154,7 +152,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Order).AreEqual; } @@ -164,7 +162,7 @@ public override bool Equals(object input) /// /// Instance of Order to be compared /// Boolean - public bool Equals(Order input) + public bool Equals(Order? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterComposite.cs index 61c4bca3e3c4..81e957f7f390 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -17,9 +17,6 @@ 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; @@ -38,12 +35,12 @@ public partial class OuterComposite : IEquatable, IValidatableOb /// myNumber. /// myString. /// myBoolean. - public OuterComposite(decimal myNumber = default(decimal), string myString = default(string), bool myBoolean = default(bool)) + public OuterComposite(decimal myNumber, string myString, bool myBoolean) { - this.MyNumber = myNumber; - this.MyString = myString; - this.MyBoolean = myBoolean; - this.AdditionalProperties = new Dictionary(); + MyNumber = myNumber; + MyString = myString; + MyBoolean = myBoolean; + AdditionalProperties = new Dictionary(); } /// @@ -78,10 +75,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class OuterComposite {\n"); - sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); - sb.Append(" MyString: ").Append(MyString).Append("\n"); - sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append('\n'); + sb.Append(" MyString: ").Append(MyString).Append('\n'); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -90,9 +87,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -100,7 +97,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as OuterComposite).AreEqual; } @@ -110,7 +107,7 @@ public override bool Equals(object input) /// /// Instance of OuterComposite to be compared /// Boolean - public bool Equals(OuterComposite input) + public bool Equals(OuterComposite? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnum.cs index 3b2dc2a110af..38cbd25448bb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 04d88ac8fecf..85bbbf10b337 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index da111ad9341d..f038c240def2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -17,9 +17,6 @@ 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; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index ff0d85056238..8507ea390c6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -17,9 +17,6 @@ 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; 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 a205b59b6d09..1ebd85f1d127 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 @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; @@ -31,7 +28,7 @@ namespace Org.OpenAPITools.Model /// ParentPet /// [DataContract(Name = "ParentPet")] - [JsonConverter(typeof(JsonSubtypes), "PetType")] + [Newtonsoft.Json.JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { @@ -43,13 +40,14 @@ protected ParentPet() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + public ParentPet(string petType) : base(petType) { - this.AdditionalProperties = new Dictionary(); + AdditionalProperties = new Dictionary(); } /// @@ -66,8 +64,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -76,9 +74,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public override string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -86,7 +84,7 @@ public override string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ParentPet).AreEqual; } @@ -96,7 +94,7 @@ public override bool Equals(object input) /// /// Instance of ParentPet to be compared /// Boolean - public bool Equals(ParentPet input) + public bool Equals(ParentPet? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pet.cs index 4f7057df98dc..6a5faf56cf2a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pet.cs @@ -17,9 +17,6 @@ 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; @@ -36,7 +33,7 @@ public partial class Pet : IEquatable, IValidatableObject /// pet status in the store /// /// pet status in the store - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum StatusEnum { /// @@ -65,6 +62,7 @@ public enum StatusEnum /// pet status in the store [DataMember(Name = "status", EmitDefaultValue = false)] public StatusEnum? Status { get; set; } + /// /// Initializes a new instance of the class. /// @@ -73,6 +71,7 @@ protected Pet() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// @@ -82,17 +81,19 @@ protected Pet() /// photoUrls (required). /// tags. /// pet status in the store. - public Pet(long id = default(long), Category category = default(Category), string name = default(string), List photoUrls = default(List), List tags = default(List), StatusEnum? status = default(StatusEnum?)) + public Pet(long id, Category category, string name, List photoUrls, List tags, StatusEnum? status) { // to ensure "name" is required (not null) - this.Name = name ?? throw new ArgumentNullException("name is a required property for Pet and cannot be null"); + Name = name ?? throw new ArgumentNullException("name is a required property for Pet and cannot be null"); + // to ensure "photoUrls" is required (not null) - this.PhotoUrls = photoUrls ?? throw new ArgumentNullException("photoUrls is a required property for Pet and cannot be null"); - this.Id = id; - this.Category = category; - this.Tags = tags; - this.Status = status; - this.AdditionalProperties = new Dictionary(); + PhotoUrls = photoUrls ?? throw new ArgumentNullException("photoUrls is a required property for Pet and cannot be null"); + + Id = id; + Category = category; + Tags = tags; + Status = status; + AdditionalProperties = new Dictionary(); } /// @@ -139,13 +140,13 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Id: ").Append(Id).Append('\n'); + sb.Append(" Category: ").Append(Category).Append('\n'); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append('\n'); + sb.Append(" Tags: ").Append(Tags).Append('\n'); + sb.Append(" Status: ").Append(Status).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -154,9 +155,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -164,7 +165,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Pet).AreEqual; } @@ -174,7 +175,7 @@ public override bool Equals(object input) /// /// Instance of Pet to be compared /// Boolean - public bool Equals(Pet input) + public bool Equals(Pet? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pig.cs index ffdc73846d65..21b2e0a762b4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Pig.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Quadrilateral.cs index 0a5cffe71db5..da86f463e0ea 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index e7727cf856c9..e6907c958bd4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -17,9 +17,6 @@ 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; @@ -40,15 +37,17 @@ protected QuadrilateralInterface() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// quadrilateralType (required). - public QuadrilateralInterface(string quadrilateralType = default(string)) + public QuadrilateralInterface(string quadrilateralType) { // to ensure "quadrilateralType" is required (not null) - this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for QuadrilateralInterface and cannot be null"); - this.AdditionalProperties = new Dictionary(); + QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for QuadrilateralInterface and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -71,8 +70,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class QuadrilateralInterface {\n"); - sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +80,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +90,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as QuadrilateralInterface).AreEqual; } @@ -101,7 +100,7 @@ public override bool Equals(object input) /// /// Instance of QuadrilateralInterface to be compared /// Boolean - public bool Equals(QuadrilateralInterface input) + public bool Equals(QuadrilateralInterface? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 4ab8f7d5c6a8..b5bb2ba49d04 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// Initializes a new instance of the class. /// /// baz. - public ReadOnlyFirst(string baz = default(string)) + public ReadOnlyFirst(string baz) { - this.Baz = baz; - this.AdditionalProperties = new Dictionary(); + Baz = baz; + AdditionalProperties = new Dictionary(); } /// @@ -77,9 +74,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ReadOnlyFirst {\n"); - sb.Append(" Bar: ").Append(Bar).Append("\n"); - sb.Append(" Baz: ").Append(Baz).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Bar: ").Append(Bar).Append('\n'); + sb.Append(" Baz: ").Append(Baz).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -88,9 +85,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -98,7 +95,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; } @@ -108,7 +105,7 @@ public override bool Equals(object input) /// /// Instance of ReadOnlyFirst to be compared /// Boolean - public bool Equals(ReadOnlyFirst input) + public bool Equals(ReadOnlyFirst? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Return.cs index 75e7f1f25305..17dde3fac7e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Return.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class Return : IEquatable, IValidatableObject /// Initializes a new instance of the class. /// /// _return. - public Return(int _return = default(int)) + public Return(int _return) { - this._Return = _return; - this.AdditionalProperties = new Dictionary(); + _Return = _return; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Return {\n"); - sb.Append(" _Return: ").Append(_Return).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" _Return: ").Append(_Return).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Return).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of Return to be compared /// Boolean - public bool Equals(Return input) + public bool Equals(Return? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index c539590907c7..62a466e26d72 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -17,9 +17,6 @@ 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; @@ -40,18 +37,21 @@ protected ScaleneTriangle() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// shapeType (required). /// triangleType (required). - public ScaleneTriangle(string shapeType = default(string), string triangleType = default(string)) + public ScaleneTriangle(string shapeType, string triangleType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); + // to ensure "triangleType" is required (not null) - this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); + TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -80,9 +80,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ScaleneTriangle {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" TriangleType: ").Append(TriangleType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -91,9 +91,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -101,7 +101,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ScaleneTriangle).AreEqual; } @@ -111,7 +111,7 @@ public override bool Equals(object input) /// /// Instance of ScaleneTriangle to be compared /// Boolean - public bool Equals(ScaleneTriangle input) + public bool Equals(ScaleneTriangle? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Shape.cs index 7db4ac390609..eb423409664a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Shape.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeInterface.cs index 051100b4e6c1..8dcdde81b869 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -17,9 +17,6 @@ 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; @@ -40,15 +37,17 @@ protected ShapeInterface() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// shapeType (required). - public ShapeInterface(string shapeType = default(string)) + public ShapeInterface(string shapeType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ShapeInterface and cannot be null"); - this.AdditionalProperties = new Dictionary(); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ShapeInterface and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -71,8 +70,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ShapeInterface {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +80,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +90,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as ShapeInterface).AreEqual; } @@ -101,7 +100,7 @@ public override bool Equals(object input) /// /// Instance of ShapeInterface to be compared /// Boolean - public bool Equals(ShapeInterface input) + public bool Equals(ShapeInterface? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 11456f9c653a..9f7b832d74a7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 5280a0c308a7..70d3116a3e18 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -17,9 +17,6 @@ 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; @@ -40,18 +37,21 @@ protected SimpleQuadrilateral() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// shapeType (required). /// quadrilateralType (required). - public SimpleQuadrilateral(string shapeType = default(string), string quadrilateralType = default(string)) + public SimpleQuadrilateral(string shapeType, string quadrilateralType) { // to ensure "shapeType" is required (not null) - this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); + ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); + // to ensure "quadrilateralType" is required (not null) - this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); + QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -80,9 +80,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class SimpleQuadrilateral {\n"); - sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); - sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append('\n'); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -91,9 +91,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -101,7 +101,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as SimpleQuadrilateral).AreEqual; } @@ -111,7 +111,7 @@ public override bool Equals(object input) /// /// Instance of SimpleQuadrilateral to be compared /// Boolean - public bool Equals(SimpleQuadrilateral input) + public bool Equals(SimpleQuadrilateral? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs index f7199da4c03c..eab25c66d0e5 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -17,9 +17,6 @@ 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; @@ -36,10 +33,10 @@ public partial class SpecialModelName : IEquatable, IValidatab /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + public SpecialModelName(long specialPropertyName) { - this.SpecialPropertyName = specialPropertyName; - this.AdditionalProperties = new Dictionary(); + SpecialPropertyName = specialPropertyName; + AdditionalProperties = new Dictionary(); } /// @@ -62,8 +59,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); - sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -72,9 +69,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -82,7 +79,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as SpecialModelName).AreEqual; } @@ -92,7 +89,7 @@ public override bool Equals(object input) /// /// Instance of SpecialModelName to be compared /// Boolean - public bool Equals(SpecialModelName input) + public bool Equals(SpecialModelName? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Tag.cs index aba43e338beb..ea7577d88f0d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Tag.cs @@ -17,9 +17,6 @@ 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; @@ -37,11 +34,11 @@ public partial class Tag : IEquatable, IValidatableObject /// /// id. /// name. - public Tag(long id = default(long), string name = default(string)) + public Tag(long id, string name) { - this.Id = id; - this.Name = name; - this.AdditionalProperties = new Dictionary(); + Id = id; + Name = name; + AdditionalProperties = new Dictionary(); } /// @@ -70,9 +67,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Tag {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Id: ").Append(Id).Append('\n'); + sb.Append(" Name: ").Append(Name).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +78,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +88,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Tag).AreEqual; } @@ -101,7 +98,7 @@ public override bool Equals(object input) /// /// Instance of Tag to be compared /// Boolean - public bool Equals(Tag input) + public bool Equals(Tag? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Triangle.cs index efe1b3483995..f29150228df5 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Triangle.cs @@ -17,9 +17,6 @@ using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; using JsonSubTypes; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4b7274465ce0..8ffa8fbf7b10 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -17,9 +17,6 @@ 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; @@ -40,15 +37,17 @@ protected TriangleInterface() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// triangleType (required). - public TriangleInterface(string triangleType = default(string)) + public TriangleInterface(string triangleType) { // to ensure "triangleType" is required (not null) - this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for TriangleInterface and cannot be null"); - this.AdditionalProperties = new Dictionary(); + TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for TriangleInterface and cannot be null"); + + AdditionalProperties = new Dictionary(); } /// @@ -71,8 +70,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class TriangleInterface {\n"); - sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -81,9 +80,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -91,7 +90,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as TriangleInterface).AreEqual; } @@ -101,7 +100,7 @@ public override bool Equals(object input) /// /// Instance of TriangleInterface to be compared /// Boolean - public bool Equals(TriangleInterface input) + public bool Equals(TriangleInterface? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/User.cs index ea24f093e147..a0f56c846f95 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/User.cs @@ -17,9 +17,6 @@ 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; @@ -47,21 +44,21 @@ public partial class User : IEquatable, IValidatableObject /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value.. /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389. /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values.. - public User(long id = default(long), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int userStatus = default(int), Object objectWithNoDeclaredProps = default(Object), Object objectWithNoDeclaredPropsNullable = default(Object), Object anyTypeProp = default(Object), Object anyTypePropNullable = default(Object)) + public User(long id, string username, string firstName, string lastName, string email, string password, string phone, int userStatus, Object objectWithNoDeclaredProps, Object objectWithNoDeclaredPropsNullable, Object anyTypeProp, Object anyTypePropNullable) { - this.Id = id; - this.Username = username; - this.FirstName = firstName; - this.LastName = lastName; - this.Email = email; - this.Password = password; - this.Phone = phone; - this.UserStatus = userStatus; - this.ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; - this.ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; - this.AnyTypeProp = anyTypeProp; - this.AnyTypePropNullable = anyTypePropNullable; - this.AdditionalProperties = new Dictionary(); + Id = id; + Username = username; + FirstName = firstName; + LastName = lastName; + Email = email; + Password = password; + Phone = phone; + UserStatus = userStatus; + ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + AnyTypeProp = anyTypeProp; + AnyTypePropNullable = anyTypePropNullable; + AdditionalProperties = new Dictionary(); } /// @@ -155,19 +152,19 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class User {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" FirstName: ").Append(FirstName).Append("\n"); - sb.Append(" LastName: ").Append(LastName).Append("\n"); - sb.Append(" Email: ").Append(Email).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); - sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); - sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); - sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); - sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); - sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" Id: ").Append(Id).Append('\n'); + sb.Append(" Username: ").Append(Username).Append('\n'); + sb.Append(" FirstName: ").Append(FirstName).Append('\n'); + sb.Append(" LastName: ").Append(LastName).Append('\n'); + sb.Append(" Email: ").Append(Email).Append('\n'); + sb.Append(" Password: ").Append(Password).Append('\n'); + sb.Append(" Phone: ").Append(Phone).Append('\n'); + sb.Append(" UserStatus: ").Append(UserStatus).Append('\n'); + sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append('\n'); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append('\n'); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append('\n'); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -176,9 +173,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -186,7 +183,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as User).AreEqual; } @@ -196,7 +193,7 @@ public override bool Equals(object input) /// /// Instance of User to be compared /// Boolean - public bool Equals(User input) + public bool Equals(User? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Whale.cs index fdecfefd6790..a717bc00acf2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Whale.cs @@ -17,9 +17,6 @@ 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; @@ -40,19 +37,21 @@ protected Whale() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// hasBaleen. /// hasTeeth. /// className (required). - public Whale(bool hasBaleen = default(bool), bool hasTeeth = default(bool), string className = default(string)) + public Whale(bool hasBaleen, bool hasTeeth, string className) { // to ensure "className" is required (not null) - this.ClassName = className ?? throw new ArgumentNullException("className is a required property for Whale and cannot be null"); - this.HasBaleen = hasBaleen; - this.HasTeeth = hasTeeth; - this.AdditionalProperties = new Dictionary(); + ClassName = className ?? throw new ArgumentNullException("className is a required property for Whale and cannot be null"); + + HasBaleen = hasBaleen; + HasTeeth = hasTeeth; + AdditionalProperties = new Dictionary(); } /// @@ -87,10 +86,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Whale {\n"); - sb.Append(" HasBaleen: ").Append(HasBaleen).Append("\n"); - sb.Append(" HasTeeth: ").Append(HasTeeth).Append("\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" HasBaleen: ").Append(HasBaleen).Append('\n'); + sb.Append(" HasTeeth: ").Append(HasTeeth).Append('\n'); + sb.Append(" ClassName: ").Append(ClassName).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -99,9 +98,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public virtual string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -109,7 +108,7 @@ public virtual string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Whale).AreEqual; } @@ -119,7 +118,7 @@ public override bool Equals(object input) /// /// Instance of Whale to be compared /// Boolean - public bool Equals(Whale input) + public bool Equals(Whale? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Zebra.cs index cd2f85fe1acd..cb25a58b8ab1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Zebra.cs @@ -17,9 +17,6 @@ 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; @@ -35,7 +32,7 @@ public partial class Zebra : Dictionary, IEquatable, IVal /// /// Defines Type /// - [JsonConverter(typeof(StringEnumConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum TypeEnum { /// @@ -63,6 +60,7 @@ public enum TypeEnum /// [DataMember(Name = "type", EmitDefaultValue = false)] public TypeEnum? Type { get; set; } + /// /// Initializes a new instance of the class. /// @@ -71,17 +69,19 @@ protected Zebra() { this.AdditionalProperties = new Dictionary(); } + /// /// Initializes a new instance of the class. /// /// type. /// className (required). - public Zebra(TypeEnum? type = default(TypeEnum?), string className = default(string)) : base() + public Zebra(TypeEnum? type, string className) : base() { // to ensure "className" is required (not null) - this.ClassName = className ?? throw new ArgumentNullException("className is a required property for Zebra and cannot be null"); - this.Type = type; - this.AdditionalProperties = new Dictionary(); + ClassName = className ?? throw new ArgumentNullException("className is a required property for Zebra and cannot be null"); + + Type = type; + AdditionalProperties = new Dictionary(); } /// @@ -104,10 +104,10 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Zebra {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append('\n'); + sb.Append(" Type: ").Append(Type).Append('\n'); + sb.Append(" ClassName: ").Append(ClassName).Append('\n'); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append('\n'); sb.Append("}\n"); return sb.ToString(); } @@ -116,9 +116,9 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public string ToJson() + public string ToJson(Newtonsoft.Json.JsonSerializerSettings? jsonSerializerSettings = null) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, jsonSerializerSettings ?? Org.OpenAPITools.Client.ClientUtils.JsonSerializerSettings); } /// @@ -126,7 +126,7 @@ public string ToJson() /// /// Object to be compared /// Boolean - public override bool Equals(object input) + public override bool Equals(object??? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input as Zebra).AreEqual; } @@ -136,7 +136,7 @@ public override bool Equals(object input) /// /// Instance of Zebra to be compared /// Boolean - public bool Equals(Zebra input) + public bool Equals(Zebra? input) { return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Org.OpenAPITools.csproj index ae0231709284..4a8f62cf5beb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -2,7 +2,7 @@ false - net5.0 + netstandard2.0 Org.OpenAPITools Org.OpenAPITools Library @@ -24,10 +24,8 @@ - - + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs index c168aa41d4ce..f03086f114ac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs index c168aa41d4ce..f03086f114ac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs index c168aa41d4ce..f03086f114ac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Reflection; namespace Org.OpenAPITools.Model { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/.openapi-generator/FILES b/samples/openapi3/client/petstore/typescript/builds/inversify/.openapi-generator/FILES index 29f9ff544d92..4f2382c7e38d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/.openapi-generator/FILES @@ -1,7 +1,10 @@ .gitignore README.md +apis/PetApi.service.ts apis/PetApi.ts +apis/StoreApi.service.ts apis/StoreApi.ts +apis/UserApi.service.ts apis/UserApi.ts apis/baseapi.ts apis/exception.ts @@ -23,6 +26,12 @@ models/all.ts package.json rxjsStub.ts servers.ts +services/ObjectParamAPI.ts +services/ObservableAPI.ts +services/PromiseAPI.ts +services/configuration.ts +services/http.ts +services/index.ts tsconfig.json types/ObjectParamAPI.ts types/ObservableAPI.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts index 7041341a7089..c97b44cf0893 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts @@ -6,6 +6,7 @@ import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; +import { injectable } from "inversify"; import { ApiResponse } from '../models/ApiResponse'; import { Pet } from '../models/Pet'; @@ -13,6 +14,7 @@ import { Pet } from '../models/Pet'; /** * no description */ +@injectable() export class PetApiRequestFactory extends BaseAPIRequestFactory { /** @@ -397,6 +399,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { +@injectable() export class PetApiResponseProcessor { /** diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts index 09400e99c083..ceef209c37db 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts @@ -6,12 +6,14 @@ import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; +import { injectable } from "inversify"; import { Order } from '../models/Order'; /** * no description */ +@injectable() export class StoreApiRequestFactory extends BaseAPIRequestFactory { /** @@ -166,6 +168,7 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory { +@injectable() export class StoreApiResponseProcessor { /** diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts index 1d43ec7a72b4..353bae433c58 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts @@ -6,12 +6,14 @@ import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; +import { injectable } from "inversify"; import { User } from '../models/User'; /** * no description */ +@injectable() export class UserApiRequestFactory extends BaseAPIRequestFactory { /** @@ -375,6 +377,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { +@injectable() export class UserApiResponseProcessor { /** diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/baseapi.ts index fe7ee3d15118..cf8fec079eb3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/baseapi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/baseapi.ts @@ -1,4 +1,6 @@ import { Configuration } from '../configuration' +import { injectable, inject } from "inversify"; +import { AbstractConfiguration } from "../services/configuration"; /** * @@ -17,9 +19,10 @@ export const COLLECTION_FORMATS = { * @export * @class BaseAPI */ +@injectable() export class BaseAPIRequestFactory { - constructor(protected configuration: Configuration) { + constructor(@inject(AbstractConfiguration) protected configuration: Configuration) { } }; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts index 9d59a0a25580..13e3b17fa825 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts @@ -2,6 +2,8 @@ //@ts-ignore import * as btoa from "btoa"; import { RequestContext } from "../http/http"; +import { injectable, inject, named } from "inversify"; +import { AbstractTokenProvider } from "../services/configuration"; /** * Interface authentication schemes. @@ -20,6 +22,10 @@ export interface SecurityAuthentication { applySecurityAuthentication(context: RequestContext): void | Promise; } +export const AuthApiKey = Symbol("auth.api_key"); +export const AuthUsername = Symbol("auth.username"); +export const AuthPassword = Symbol("auth.password"); + export interface TokenProvider { getToken(): Promise | string; } @@ -27,13 +33,14 @@ export interface TokenProvider { /** * Applies apiKey authentication to the request context. */ +@injectable() export class ApiKeyAuthentication implements SecurityAuthentication { /** * Configures this api key authentication with the necessary properties * * @param apiKey: The api key to be used for every request */ - public constructor(private apiKey: string) {} + public constructor(@inject(AuthApiKey) @named("api_key") private apiKey: string) {} public getName(): string { return "api_key"; @@ -47,6 +54,7 @@ export class ApiKeyAuthentication implements SecurityAuthentication { /** * Applies oauth2 authentication to the request context. */ +@injectable() export class PetstoreAuthAuthentication implements SecurityAuthentication { // TODO: How to handle oauth2 authentication! public constructor() {} @@ -66,6 +74,11 @@ export type AuthMethods = { "petstore_auth"?: SecurityAuthentication } +export const authMethodServices = { + "api_key": ApiKeyAuthentication, + "petstore_auth": PetstoreAuthAuthentication +} + export type ApiKeyConfiguration = string; export type HttpBasicConfiguration = { "username": string, "password": string }; export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts index de89bb05e702..4d48e5222adf 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts @@ -9,3 +9,5 @@ export * from "./servers"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; +export * from "./services/index"; +export { AbstractPromisePetApi as AbstractPetApi, AbstractPromiseStoreApi as AbstractStoreApi, AbstractPromiseUserApi as AbstractUserApi } from './services/PromiseAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index f26767636102..71908ad48cae 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -22,6 +22,7 @@ "@types/node": "*", "form-data": "^2.5.0", "btoa": "^1.2.1", + "inversify": "^5.0.1", "es6-promise": "^4.2.4", "url-parse": "^1.4.3" }, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json index a542d795677c..b53dce7b41b3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json @@ -18,6 +18,7 @@ "outDir": "./dist", "noLib": false, "lib": [ "es6" ], + "experimentalDecorators": true, }, "exclude": [ "dist", diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts index 6154d267ed3a..31ced8bbdca3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts @@ -3,6 +3,8 @@ import * as models from '../models/all'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; +import { injectable, inject, optional } from "inversify"; +import { AbstractConfiguration } from "../services/configuration"; import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; @@ -12,15 +14,18 @@ import { Tag } from '../models/Tag'; import { User } from '../models/User'; import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +import { AbstractPetApiRequestFactory, AbstractPetApiResponseProcessor } from "../apis/PetApi.service"; + +@injectable() export class ObservablePetApi { - private requestFactory: PetApiRequestFactory; - private responseProcessor: PetApiResponseProcessor; + private requestFactory: AbstractPetApiRequestFactory; + private responseProcessor: AbstractPetApiResponseProcessor; private configuration: Configuration; public constructor( - configuration: Configuration, - requestFactory?: PetApiRequestFactory, - responseProcessor?: PetApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractPetApiRequestFactory) @optional() requestFactory?: AbstractPetApiRequestFactory, + @inject(AbstractPetApiResponseProcessor) @optional() responseProcessor?: AbstractPetApiResponseProcessor ) { this.configuration = configuration; this.requestFactory = requestFactory || new PetApiRequestFactory(configuration); @@ -226,15 +231,18 @@ export class ObservablePetApi { import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +import { AbstractStoreApiRequestFactory, AbstractStoreApiResponseProcessor } from "../apis/StoreApi.service"; + +@injectable() export class ObservableStoreApi { - private requestFactory: StoreApiRequestFactory; - private responseProcessor: StoreApiResponseProcessor; + private requestFactory: AbstractStoreApiRequestFactory; + private responseProcessor: AbstractStoreApiResponseProcessor; private configuration: Configuration; public constructor( - configuration: Configuration, - requestFactory?: StoreApiRequestFactory, - responseProcessor?: StoreApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractStoreApiRequestFactory) @optional() requestFactory?: AbstractStoreApiRequestFactory, + @inject(AbstractStoreApiResponseProcessor) @optional() responseProcessor?: AbstractStoreApiResponseProcessor ) { this.configuration = configuration; this.requestFactory = requestFactory || new StoreApiRequestFactory(configuration); @@ -342,15 +350,18 @@ export class ObservableStoreApi { import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +import { AbstractUserApiRequestFactory, AbstractUserApiResponseProcessor } from "../apis/UserApi.service"; + +@injectable() export class ObservableUserApi { - private requestFactory: UserApiRequestFactory; - private responseProcessor: UserApiResponseProcessor; + private requestFactory: AbstractUserApiRequestFactory; + private responseProcessor: AbstractUserApiResponseProcessor; private configuration: Configuration; public constructor( - configuration: Configuration, - requestFactory?: UserApiRequestFactory, - responseProcessor?: UserApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractUserApiRequestFactory) @optional() requestFactory?: AbstractUserApiRequestFactory, + @inject(AbstractUserApiResponseProcessor) @optional() responseProcessor?: AbstractUserApiResponseProcessor ) { this.configuration = configuration; this.requestFactory = requestFactory || new UserApiRequestFactory(configuration); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts index 533095a405d6..6077fdac2d59 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts @@ -1,6 +1,8 @@ import { ResponseContext, RequestContext, HttpFile } from '../http/http'; import * as models from '../models/all'; import { Configuration} from '../configuration' +import { injectable, inject, optional } from "inversify"; +import { AbstractConfiguration } from "../services/configuration"; import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; @@ -12,13 +14,16 @@ import { ObservablePetApi } from './ObservableAPI'; import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +import { AbstractPetApiRequestFactory, AbstractPetApiResponseProcessor } from "../apis/PetApi.service"; + +@injectable() export class PromisePetApi { private api: ObservablePetApi public constructor( - configuration: Configuration, - requestFactory?: PetApiRequestFactory, - responseProcessor?: PetApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractPetApiRequestFactory) @optional() requestFactory?: AbstractPetApiRequestFactory, + @inject(AbstractPetApiResponseProcessor) @optional() responseProcessor?: AbstractPetApiResponseProcessor ) { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } @@ -112,13 +117,16 @@ import { ObservableStoreApi } from './ObservableAPI'; import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +import { AbstractStoreApiRequestFactory, AbstractStoreApiResponseProcessor } from "../apis/StoreApi.service"; + +@injectable() export class PromiseStoreApi { private api: ObservableStoreApi public constructor( - configuration: Configuration, - requestFactory?: StoreApiRequestFactory, - responseProcessor?: StoreApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractStoreApiRequestFactory) @optional() requestFactory?: AbstractStoreApiRequestFactory, + @inject(AbstractStoreApiResponseProcessor) @optional() responseProcessor?: AbstractStoreApiResponseProcessor ) { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } @@ -170,13 +178,16 @@ import { ObservableUserApi } from './ObservableAPI'; import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +import { AbstractUserApiRequestFactory, AbstractUserApiResponseProcessor } from "../apis/UserApi.service"; + +@injectable() export class PromiseUserApi { private api: ObservableUserApi public constructor( - configuration: Configuration, - requestFactory?: UserApiRequestFactory, - responseProcessor?: UserApiResponseProcessor + @inject(AbstractConfiguration) configuration: Configuration, + @inject(AbstractUserApiRequestFactory) @optional() requestFactory?: AbstractUserApiRequestFactory, + @inject(AbstractUserApiResponseProcessor) @optional() responseProcessor?: AbstractUserApiResponseProcessor ) { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt index 3ac3578638d5..1c2b5967d0f1 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt @@ -1,80 +1,80 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.server.apis - -import com.google.gson.Gson -import io.ktor.application.call -import io.ktor.auth.UserIdPrincipal -import io.ktor.auth.authentication -import io.ktor.auth.authenticate -import io.ktor.auth.OAuthAccessTokenResponse -import io.ktor.auth.OAuthServerSettings -import io.ktor.http.ContentType -import io.ktor.http.HttpStatusCode -import io.ktor.locations.KtorExperimentalLocationsAPI -import io.ktor.locations.delete -import io.ktor.locations.get -import io.ktor.response.respond -import io.ktor.response.respondText -import io.ktor.routing.Route -import io.ktor.routing.post -import io.ktor.routing.put -import io.ktor.routing.route - -import org.openapitools.server.Paths -import org.openapitools.server.infrastructure.ApiPrincipal - - -import org.openapitools.server.models.ApiResponse -import org.openapitools.server.models.Pet - -@KtorExperimentalLocationsAPI -fun Route.PetApi() { - val gson = Gson() - val empty = mutableMapOf() - - route("/pet") { - authenticate("petstore_auth") { - post { - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - call.respond(HttpStatusCode.NotImplemented) - } - } - } - } - - - delete { _: Paths.deletePet -> - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - call.respond(HttpStatusCode.NotImplemented) - } - } - - - get { _: Paths.findPetsByStatus -> - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - val exampleContentType = "application/json" +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.server.apis + +import com.google.gson.Gson +import io.ktor.application.call +import io.ktor.auth.UserIdPrincipal +import io.ktor.auth.authentication +import io.ktor.auth.authenticate +import io.ktor.auth.OAuthAccessTokenResponse +import io.ktor.auth.OAuthServerSettings +import io.ktor.http.ContentType +import io.ktor.http.HttpStatusCode +import io.ktor.locations.KtorExperimentalLocationsAPI +import io.ktor.locations.delete +import io.ktor.locations.get +import io.ktor.response.respond +import io.ktor.response.respondText +import io.ktor.routing.Route +import io.ktor.routing.post +import io.ktor.routing.put +import io.ktor.routing.route + +import org.openapitools.server.Paths +import org.openapitools.server.infrastructure.ApiPrincipal + + +import org.openapitools.server.models.ApiResponse +import org.openapitools.server.models.Pet + +@KtorExperimentalLocationsAPI +fun Route.PetApi() { + val gson = Gson() + val empty = mutableMapOf() + + route("/pet") { + authenticate("petstore_auth") { + post { + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + call.respond(HttpStatusCode.NotImplemented) + } + } + } + } + + + delete { _: Paths.deletePet -> + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + call.respond(HttpStatusCode.NotImplemented) + } + } + + + get { _: Paths.findPetsByStatus -> + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + val exampleContentType = "application/json" val exampleContentString = """{ "photoUrls" : [ "photoUrls", "photoUrls" ], "name" : "doggie", @@ -91,24 +91,24 @@ fun Route.PetApi() { "id" : 1 } ], "status" : "available" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - } - - - get { _: Paths.findPetsByTags -> - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - val exampleContentType = "application/json" + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + } + + + get { _: Paths.findPetsByTags -> + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + val exampleContentType = "application/json" val exampleContentString = """{ "photoUrls" : [ "photoUrls", "photoUrls" ], "name" : "doggie", @@ -125,24 +125,24 @@ fun Route.PetApi() { "id" : 1 } ], "status" : "available" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - } - - - get { _: Paths.getPetById -> - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - val exampleContentType = "application/json" + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + } + + + get { _: Paths.getPetById -> + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + val exampleContentType = "application/json" val exampleContentString = """{ "photoUrls" : [ "photoUrls", "photoUrls" ], "name" : "doggie", @@ -159,70 +159,70 @@ fun Route.PetApi() { "id" : 1 } ], "status" : "available" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - } - - - route("/pet") { - authenticate("petstore_auth") { - put { - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - call.respond(HttpStatusCode.NotImplemented) - } - } - } - } - - - route("/pet/{petId}") { - authenticate("petstore_auth") { - post { - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - call.respond(HttpStatusCode.NotImplemented) - } - } - } - } - - - route("/pet/{petId}/uploadImage") { - authenticate("petstore_auth") { - post { - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - val exampleContentType = "application/json" + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + } + + + route("/pet") { + authenticate("petstore_auth") { + put { + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + call.respond(HttpStatusCode.NotImplemented) + } + } + } + } + + + route("/pet/{petId}") { + authenticate("petstore_auth") { + post { + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + call.respond(HttpStatusCode.NotImplemented) + } + } + } + } + + + route("/pet/{petId}/uploadImage") { + authenticate("petstore_auth") { + post { + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + val exampleContentType = "application/json" val exampleContentString = """{ "code" : 0, "type" : "type", "message" : "message" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - } - } - } - -} + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + } + } + } + +} diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt index 17b2c526bd9c..121bf3357879 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt @@ -1,64 +1,64 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.server.apis - -import com.google.gson.Gson -import io.ktor.application.call -import io.ktor.auth.UserIdPrincipal -import io.ktor.auth.authentication -import io.ktor.auth.authenticate -import io.ktor.auth.OAuthAccessTokenResponse -import io.ktor.auth.OAuthServerSettings -import io.ktor.http.ContentType -import io.ktor.http.HttpStatusCode -import io.ktor.locations.KtorExperimentalLocationsAPI -import io.ktor.locations.delete -import io.ktor.locations.get -import io.ktor.response.respond -import io.ktor.response.respondText -import io.ktor.routing.Route -import io.ktor.routing.post -import io.ktor.routing.put -import io.ktor.routing.route - -import org.openapitools.server.Paths -import org.openapitools.server.infrastructure.ApiPrincipal - - -import org.openapitools.server.models.Order - -@KtorExperimentalLocationsAPI -fun Route.StoreApi() { - val gson = Gson() - val empty = mutableMapOf() - - delete { _: Paths.deleteOrder -> - call.respond(HttpStatusCode.NotImplemented) - } - - - get { _: Paths.getInventory -> - val principal = call.authentication.principal() - - if (principal == null) { - call.respond(HttpStatusCode.Unauthorized) - } else { - call.respond(HttpStatusCode.NotImplemented) - } - } - - - get { _: Paths.getOrderById -> - val exampleContentType = "application/json" +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.server.apis + +import com.google.gson.Gson +import io.ktor.application.call +import io.ktor.auth.UserIdPrincipal +import io.ktor.auth.authentication +import io.ktor.auth.authenticate +import io.ktor.auth.OAuthAccessTokenResponse +import io.ktor.auth.OAuthServerSettings +import io.ktor.http.ContentType +import io.ktor.http.HttpStatusCode +import io.ktor.locations.KtorExperimentalLocationsAPI +import io.ktor.locations.delete +import io.ktor.locations.get +import io.ktor.response.respond +import io.ktor.response.respondText +import io.ktor.routing.Route +import io.ktor.routing.post +import io.ktor.routing.put +import io.ktor.routing.route + +import org.openapitools.server.Paths +import org.openapitools.server.infrastructure.ApiPrincipal + + +import org.openapitools.server.models.Order + +@KtorExperimentalLocationsAPI +fun Route.StoreApi() { + val gson = Gson() + val empty = mutableMapOf() + + delete { _: Paths.deleteOrder -> + call.respond(HttpStatusCode.NotImplemented) + } + + + get { _: Paths.getInventory -> + val principal = call.authentication.principal() + + if (principal == null) { + call.respond(HttpStatusCode.Unauthorized) + } else { + call.respond(HttpStatusCode.NotImplemented) + } + } + + + get { _: Paths.getOrderById -> + val exampleContentType = "application/json" val exampleContentString = """{ "petId" : 6, "quantity" : 1, @@ -66,19 +66,19 @@ fun Route.StoreApi() { "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - - - route("/store/order") { - post { - val exampleContentType = "application/json" + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + + + route("/store/order") { + post { + val exampleContentType = "application/json" val exampleContentString = """{ "petId" : 6, "quantity" : 1, @@ -86,14 +86,14 @@ fun Route.StoreApi() { "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - } - -} + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + } + +} diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/UserApi.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/UserApi.kt index 7fc0b78fa995..91ef11638903 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/UserApi.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/UserApi.kt @@ -1,74 +1,74 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.server.apis - -import com.google.gson.Gson -import io.ktor.application.call -import io.ktor.auth.UserIdPrincipal -import io.ktor.auth.authentication -import io.ktor.auth.authenticate -import io.ktor.auth.OAuthAccessTokenResponse -import io.ktor.auth.OAuthServerSettings -import io.ktor.http.ContentType -import io.ktor.http.HttpStatusCode -import io.ktor.locations.KtorExperimentalLocationsAPI -import io.ktor.locations.delete -import io.ktor.locations.get -import io.ktor.response.respond -import io.ktor.response.respondText -import io.ktor.routing.Route -import io.ktor.routing.post -import io.ktor.routing.put -import io.ktor.routing.route - -import org.openapitools.server.Paths -import org.openapitools.server.infrastructure.ApiPrincipal - - -import org.openapitools.server.models.User - -@KtorExperimentalLocationsAPI -fun Route.UserApi() { - val gson = Gson() - val empty = mutableMapOf() - - route("/user") { - post { - call.respond(HttpStatusCode.NotImplemented) - } - } - - - route("/user/createWithArray") { - post { - call.respond(HttpStatusCode.NotImplemented) - } - } - - - route("/user/createWithList") { - post { - call.respond(HttpStatusCode.NotImplemented) - } - } - - - delete { _: Paths.deleteUser -> - call.respond(HttpStatusCode.NotImplemented) - } - - - get { _: Paths.getUserByName -> - val exampleContentType = "application/json" +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.server.apis + +import com.google.gson.Gson +import io.ktor.application.call +import io.ktor.auth.UserIdPrincipal +import io.ktor.auth.authentication +import io.ktor.auth.authenticate +import io.ktor.auth.OAuthAccessTokenResponse +import io.ktor.auth.OAuthServerSettings +import io.ktor.http.ContentType +import io.ktor.http.HttpStatusCode +import io.ktor.locations.KtorExperimentalLocationsAPI +import io.ktor.locations.delete +import io.ktor.locations.get +import io.ktor.response.respond +import io.ktor.response.respondText +import io.ktor.routing.Route +import io.ktor.routing.post +import io.ktor.routing.put +import io.ktor.routing.route + +import org.openapitools.server.Paths +import org.openapitools.server.infrastructure.ApiPrincipal + + +import org.openapitools.server.models.User + +@KtorExperimentalLocationsAPI +fun Route.UserApi() { + val gson = Gson() + val empty = mutableMapOf() + + route("/user") { + post { + call.respond(HttpStatusCode.NotImplemented) + } + } + + + route("/user/createWithArray") { + post { + call.respond(HttpStatusCode.NotImplemented) + } + } + + + route("/user/createWithList") { + post { + call.respond(HttpStatusCode.NotImplemented) + } + } + + + delete { _: Paths.deleteUser -> + call.respond(HttpStatusCode.NotImplemented) + } + + + get { _: Paths.getUserByName -> + val exampleContentType = "application/json" val exampleContentString = """{ "firstName" : "firstName", "lastName" : "lastName", @@ -78,30 +78,30 @@ fun Route.UserApi() { "id" : 0, "email" : "email", "username" : "username" - }""" - - when(exampleContentType) { - "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) - "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) - else -> call.respondText(exampleContentString) - } - } - - - get { _: Paths.loginUser -> - call.respond(HttpStatusCode.NotImplemented) - } - - - get { _: Paths.logoutUser -> - call.respond(HttpStatusCode.NotImplemented) - } - - - route("/user/{username}") { - put { - call.respond(HttpStatusCode.NotImplemented) - } - } - -} + }""" + + when(exampleContentType) { + "application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java)) + "application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml) + else -> call.respondText(exampleContentString) + } + } + + + get { _: Paths.loginUser -> + call.respond(HttpStatusCode.NotImplemented) + } + + + get { _: Paths.logoutUser -> + call.respond(HttpStatusCode.NotImplemented) + } + + + route("/user/{username}") { + put { + call.respond(HttpStatusCode.NotImplemented) + } + } + +}