diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 4d646a944d7..8b27014d485 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -444,7 +444,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co .put("copy", copyLambda) .put("paste", new PasteLambda(copyLambda, true, true, true, false)) .put("pasteOnce", new PasteLambda(copyLambda, true, true, true, true)) - .put("pasteLine", new PasteLambda(copyLambda, true, true, false, false)); + .put("pasteLine", new PasteLambda(copyLambda, true, true, false, false)) + .put("uniqueLines", new UniqueLambda("\n", false)) + .put("unique", new UniqueLambda("\n", true)); } @Override @@ -791,6 +793,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co response.vendorExtensions.put("x-is-reference-type", !isValueType); } + if (response.headers != null && response.headers.stream().anyMatch(h -> h.baseName.equals("Set-Cookie"))) { + response.vendorExtensions.put("x-set-cookie", true); + operation.vendorExtensions.put("x-set-cookie", true); + } + String code = response.code.toLowerCase(Locale.ROOT); switch(code) { case "default": diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/UniqueLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/UniqueLambda.java index 469c7075a22..287e4ea9650 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/UniqueLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/UniqueLambda.java @@ -51,7 +51,7 @@ public class UniqueLambda implements Mustache.Lambda { @Override public void execute(Template.Fragment fragment, Writer writer) throws IOException { - String[] parts = fragment.execute().split(this.delimiter); + String[] parts = fragment.execute().split(this.delimiter, -1); List uniqueLines = Arrays.stream(parts).distinct().collect(Collectors.toList()); diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache index b78be97e725..88151035e79 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache @@ -29,36 +29,36 @@ namespace {{packageName}}.Test.{{apiPackage}} .Configure{{apiName}}((context, services, options) => { {{#lambda.trimTrailingWithNewLine}} - {{#hasApiKeyMethods}} - string apiKeyTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); + {{#apiKeyMethods}} + string apiKeyTokenValue{{-index}} = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue{{-index}}, "{{name}}", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken{{-index}}); - {{/hasApiKeyMethods}} - {{#hasHttpBearerMethods}} - string bearerTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - BearerToken bearerToken = new{{^net70OrLater}} BearerToken{{/net70OrLater}}(bearerTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); + {{/apiKeyMethods}} + {{#httpBearerMethods}} + string bearerTokenValue{{-index}} = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken{{-index}} = new{{^net70OrLater}} BearerToken{{/net70OrLater}}(bearerTokenValue{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken{{-index}}); - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} - string basicTokenUsername = context.Configuration[""] ?? throw new Exception("Username not found."); - string basicTokenPassword = context.Configuration[""] ?? throw new Exception("Password not found."); - BasicToken basicToken = new{{^net70OrLater}} BasicToken{{/net70OrLater}}(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); + {{/httpBearerMethods}} + {{#httpBasicMethods}} + string basicTokenUsername{{-index}} = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword{{-index}} = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken{{-index}} = new{{^net70OrLater}} BasicToken{{/net70OrLater}}(basicTokenUsername{{-index}}, basicTokenPassword{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken{{-index}}); - {{/hasHttpBasicMethods}} - {{#hasHttpSignatureMethods}} - HttpSigningConfiguration config = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); + {{/httpBasicMethods}} + {{#httpSignatureMethods}} + HttpSigningConfiguration config{{-index}} = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken{{-index}} = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken{{-index}}); - {{/hasHttpSignatureMethods}} - {{#hasOAuthMethods}} - string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); - {{/hasOAuthMethods}} + {{/httpSignatureMethods}} + {{#oauthMethods}} + string oauthTokenValue{{-index}} = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}(oauthTokenValue{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken{{-index}}); + {{/oauthMethods}} {{/lambda.trimTrailingWithNewLine}} }); } diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache index bdee56df281..c8fa0b88119 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache @@ -16,93 +16,145 @@ namespace {{packageName}}.Test.{{apiPackage}} /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).Configure{{apiName}}((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder({{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}Array.Empty(){{/net80OrLater}}).Configure{{apiName}}((context, services, options) => { - {{#hasApiKeyMethods}}ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - {{/hasApiKeyMethods}}{{#hasHttpBearerMethods}} - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - {{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}} - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - {{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}} - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - {{/hasHttpSignatureMethods}}{{#hasOAuthMethods}} - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken);{{/hasOAuthMethods}} + {{#lambda.trimTrailingWithNewLine}} + {{#apiKeyMethods}} + ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}($"", "{{name}}", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken{{-index}}); + + {{/apiKeyMethods}} + {{#httpBearerMethods}} + BearerToken bearerToken{{-index}} = new{{^net70OrLater}} BearerToken{{/net70OrLater}}($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken{{-index}}); + + {{/httpBearerMethods}} + {{#httpBasicMethods}} + BasicToken basicToken{{-index}} = new{{^net70OrLater}} BasicToken{{/net70OrLater}}("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken{{-index}}); + + {{/httpBasicMethods}} + {{#httpSignatureMethods}} + HttpSigningConfiguration config{{-index}} = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, {{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}new List(){{/net80OrLater}}, HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken{{-index}} = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken{{-index}}); + + {{/httpSignatureMethods}} + {{#oauthMethods}} + OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken{{-index}}); + + {{/oauthMethods}} + {{/lambda.trimTrailingWithNewLine}} }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).Configure{{apiName}}((context, services, options) => + Host.CreateDefaultBuilder({{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}Array.Empty(){{/net80OrLater}}).Configure{{apiName}}((context, services, options) => { - {{#hasApiKeyMethods}}ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - {{/hasApiKeyMethods}}{{#hasHttpBearerMethods}} - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - {{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}} - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - {{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}} - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - {{/hasHttpSignatureMethods}}{{#hasOAuthMethods}} - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken);{{/hasOAuthMethods}} + {{#lambda.trimTrailingWithNewLine}} + {{#apiKeyMethods}} + ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}($"", "{{name}}", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken{{-index}}); + + {{/apiKeyMethods}} + {{#httpBearerMethods}} + BearerToken bearerToken{{-index}} = new{{^net70OrLater}} BearerToken{{/net70OrLater}}($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken{{-index}}); + + {{/httpBearerMethods}} + {{#httpBasicMethods}} + BasicToken basicToken{{-index}} = new{{^net70OrLater}} BasicToken{{/net70OrLater}}("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken{{-index}}); + + {{/httpBasicMethods}} + {{#httpSignatureMethods}} + HttpSigningConfiguration config{{-index}} = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, {{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}new List(){{/net80OrLater}}, HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken{{-index}} = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken{{-index}}); + + {{/httpSignatureMethods}} + {{#oauthMethods}} + OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken); + + {{/oauthMethods}} + {{/lambda.trimTrailingWithNewLine}} options.Add{{apiName}}HttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder({{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}Array.Empty(){{/net80OrLater}}).ConfigureServices((host, services) => { services.Add{{apiName}}(options => { - {{#hasApiKeyMethods}}ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - {{/hasApiKeyMethods}}{{#hasHttpBearerMethods}} - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - {{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}} - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - {{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}} - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - {{/hasHttpSignatureMethods}}{{#hasOAuthMethods}} - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken);{{/hasOAuthMethods}} + {{#lambda.trimTrailingWithNewLine}} + {{#apiKeyMethods}} + ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}($"", "{{name}}", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken{{-index}}); + + {{/apiKeyMethods}} + {{#httpBearerMethods}} + BearerToken bearerToken{{-index}} = new{{^net70OrLater}} BearerToken{{/net70OrLater}}($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken{{-index}}); + + {{/httpBearerMethods}} + {{#httpBasicMethods}} + BasicToken basicToken{{-index}} = new{{^net70OrLater}} BasicToken{{/net70OrLater}}("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken{{-index}}); + + {{/httpBasicMethods}} + {{#httpSignatureMethods}} + HttpSigningConfiguration config{{-index}} = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, {{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}new List(){{/net80OrLater}}, HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken{{-index}} = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken{{-index}}); + + {{/httpSignatureMethods}} + {{#oauthMethods}} + OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken{{-index}}); + + {{/oauthMethods}} + {{/lambda.trimTrailingWithNewLine}} }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder({{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}Array.Empty(){{/net80OrLater}}).ConfigureServices((host, services) => { services.Add{{apiName}}(options => { - {{#hasApiKeyMethods}}ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - {{/hasApiKeyMethods}}{{#hasHttpBearerMethods}} - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - {{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}} - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - {{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}} - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - {{/hasHttpSignatureMethods}}{{#hasOAuthMethods}} - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken);{{/hasOAuthMethods}} + {{#lambda.trimTrailingWithNewLine}} + {{#apiKeyMethods}} + ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}($"", "{{name}}", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken{{-index}}); + + {{/apiKeyMethods}} + {{#httpBearerMethods}} + BearerToken bearerToken{{-index}} = new{{^net70OrLater}} BearerToken{{/net70OrLater}}($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken{{-index}}); + + {{/httpBearerMethods}} + {{#httpBasicMethods}} + BasicToken basicToken{{-index}} = new{{^net70OrLater}} BasicToken{{/net70OrLater}}("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken{{-index}}); + + {{/httpBasicMethods}} + {{#httpSignatureMethods}} + HttpSigningConfiguration config{{-index}} = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("", "", null, {{#net80OrLater}}[]{{/net80OrLater}}{{^net80OrLater}}new List(){{/net80OrLater}}, HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken{{-index}} = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config{{-index}}, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken{{-index}}); + + {{/httpSignatureMethods}} + {{#oauthMethods}} + OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken{{-index}}); + + {{/oauthMethods}} + {{/lambda.trimTrailingWithNewLine}} options.Add{{apiName}}HttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) @@ -116,7 +168,7 @@ namespace {{packageName}}.Test.{{apiPackage}} { {{#apiInfo}}{{#apis}}var {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}} = _hostUsingConfigureWithAClient.Services.GetRequiredService<{{interfacePrefix}}{{classname}}>(); Assert.True({{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.HttpClient.BaseAddress != null);{{^-last}} - + {{/-last}}{{/apis}}{{/apiInfo}} } @@ -128,7 +180,7 @@ namespace {{packageName}}.Test.{{apiPackage}} { {{#apiInfo}}{{#apis}}var {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}} = _hostUsingConfigureWithoutAClient.Services.GetRequiredService<{{interfacePrefix}}{{classname}}>(); Assert.True({{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.HttpClient.BaseAddress != null);{{^-last}} - + {{/-last}}{{/apis}}{{/apiInfo}} } @@ -152,7 +204,7 @@ namespace {{packageName}}.Test.{{apiPackage}} { {{#apiInfo}}{{#apis}}var {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}} = _hostUsingAddWithoutAClient.Services.GetRequiredService<{{interfacePrefix}}{{classname}}>(); Assert.True({{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.HttpClient.BaseAddress != null);{{^-last}} - + {{/-last}}{{/apis}}{{/apiInfo}} } } diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache index eaaf5dc05e4..6be1cb371db 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache @@ -7,6 +7,17 @@ {{/nrt}} using System; using System.Collections.Generic; +{{#net80OrLater}} +{{#lambda.uniqueLines}} +{{#operations}} +{{#operation}} +{{#vendorExtensions.x-set-cookie}} +using System.Linq; +{{/vendorExtensions.x-set-cookie}} +{{/operation}} +{{/operations}} +{{/lambda.uniqueLines}} +{{/net80OrLater}} using System.Net; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -183,6 +194,19 @@ namespace {{packageName}}.{{apiPackage}} /// public TokenProvider OauthTokenProvider { get; }{{/hasOAuthMethods}} + {{#net80OrLater}} + {{#lambda.unique}} + {{#operation}} + {{#vendorExtensions.x-set-cookie}} + /// + /// The token cookie container + /// + public {{packageName}}.{{clientPackage}}.CookieContainer CookieContainer { get; } + + {{/vendorExtensions.x-set-cookie}} + {{/operation}} + {{/lambda.unique}} + {{/net80OrLater}} /// /// Initializes a new instance of the class. /// @@ -192,7 +216,8 @@ namespace {{packageName}}.{{apiPackage}} TokenProvider bearerTokenProvider{{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}}, TokenProvider basicTokenProvider{{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}}, TokenProvider httpSignatureTokenProvider{{/hasHttpSignatureMethods}}{{#hasOAuthMethods}}, - TokenProvider oauthTokenProvider{{/hasOAuthMethods}}) + TokenProvider oauthTokenProvider{{/hasOAuthMethods}}{{#net80OrLater}}{{#operation}}{{#lambda.uniqueLines}}{{#vendorExtensions.x-set-cookie}}, + {{packageName}}.{{clientPackage}}.CookieContainer cookieContainer{{/vendorExtensions.x-set-cookie}}{{/lambda.uniqueLines}}{{/operation}}{{/net80OrLater}}) { _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; LoggerFactory = loggerFactory; @@ -203,7 +228,8 @@ namespace {{packageName}}.{{apiPackage}} BearerTokenProvider = bearerTokenProvider;{{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}} BasicTokenProvider = basicTokenProvider;{{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}} HttpSignatureTokenProvider = httpSignatureTokenProvider;{{/hasHttpSignatureMethods}}{{#hasOAuthMethods}} - OauthTokenProvider = oauthTokenProvider;{{/hasOAuthMethods}} + OauthTokenProvider = oauthTokenProvider;{{/hasOAuthMethods}}{{#net80OrLater}}{{#operation}}{{#lambda.uniqueLines}}{{#vendorExtensions.x-set-cookie}} + CookieContainer = cookieContainer;{{/vendorExtensions.x-set-cookie}}{{/lambda.uniqueLines}}{{/operation}}{{/net80OrLater}} } {{#operation}} @@ -470,11 +496,14 @@ namespace {{packageName}}.{{apiPackage}} List tokenBaseLocalVars = new List(); {{/-first}} {{#isApiKey}} + {{^isKeyInCookie}} ApiKeyToken apiKeyTokenLocalVar{{-index}} = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(apiKeyTokenLocalVar{{-index}});{{#isKeyInHeader}} + tokenBaseLocalVars.Add(apiKeyTokenLocalVar{{-index}}); + {{#isKeyInHeader}} apiKeyTokenLocalVar{{-index}}.UseInHeader(httpRequestMessageLocalVar, "{{keyParamName}}"); {{/isKeyInHeader}} + {{/isKeyInCookie}} {{#isKeyInQuery}} apiKeyTokenLocalVar{{-index}}.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "{{keyParamName}}"); @@ -593,6 +622,39 @@ namespace {{packageName}}.{{apiPackage}} {{/-first}} {{/authMethods}} + {{#net80OrLater}} + {{#responses}} + {{#vendorExtensions.x-set-cookie}} + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) {{code}} && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + + {{/vendorExtensions.x-set-cookie}} + {{/responses}} + {{/net80OrLater}} return apiResponseLocalVar; } } diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache index 052879cf5ec..8c62658d794 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache @@ -40,6 +40,9 @@ {{#supportsRetry}} {{/supportsRetry}} + {{#net80OrLater}} + + {{/net80OrLater}} {{/useGenericHost}} {{^useGenericHost}} {{#supportsRetry}} diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index ed92eccfe08..52ec152f86c 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -475,6 +475,13 @@ paths: '200': description: successful operation headers: + Set-Cookie: + description: >- + Cookie authentication key for use with the `api_key` + apiKey authentication. + schema: + type: string + example: AUTH_KEY=abcde12345; Path=/; HttpOnly X-Rate-Limit: description: calls per hour allowed by the user schema: diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/UserApi.md index b9a2ee71fe6..dc39af019c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/ApiTestsBase.cs index db85f0288e9..8e7ad81dada 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/ApiTestsBase.cs @@ -52,26 +52,30 @@ namespace UseSourceGeneration.Test.Api public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureApi((context, services, options) => { - string apiKeyTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken = new(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); - string bearerTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - BearerToken bearerToken = new(bearerTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); - string basicTokenUsername = context.Configuration[""] ?? throw new Exception("Username not found."); - string basicTokenPassword = context.Configuration[""] ?? throw new Exception("Password not found."); - BasicToken basicToken = new(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); - HttpSigningConfiguration config = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); - string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - OAuthToken oauthToken = new(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/DependencyInjectionTests.cs index 6ddf22ddedd..f3fdf161930 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/DependencyInjectionTests.cs @@ -24,93 +24,105 @@ namespace UseSourceGeneration.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) @@ -124,22 +136,22 @@ namespace UseSourceGeneration.Test.Api { var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -152,22 +164,22 @@ namespace UseSourceGeneration.Test.Api { var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -208,22 +220,22 @@ namespace UseSourceGeneration.Test.Api { var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs index e36737349b7..aff5eb0b28d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ namespace UseSourceGeneration.Test.Api await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/AdditionalPropertiesClassTests.cs index e8f1ddf5e8c..a4118c3dd5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/AdditionalPropertiesClassTests.cs @@ -53,6 +53,15 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + /// /// Test the property 'EmptyMap' /// @@ -115,14 +124,5 @@ namespace UseSourceGeneration.Test.Model { // TODO unit test for the property 'MapWithUndeclaredPropertiesString' } - - /// - /// Test the property 'Anytype1' - /// - [Fact] - public void Anytype1Test() - { - // TODO unit test for the property 'Anytype1' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/DrawingTests.cs index cb15054ec7d..4e060e7fe15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/DrawingTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/DrawingTests.cs @@ -62,15 +62,6 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'MainShape' } - /// - /// Test the property 'Shapes' - /// - [Fact] - public void ShapesTest() - { - // TODO unit test for the property 'Shapes' - } - /// /// Test the property 'NullableShape' /// @@ -88,5 +79,14 @@ namespace UseSourceGeneration.Test.Model { // TODO unit test for the property 'ShapeOrNull' } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs index 4935820c78d..7afbb7d9710 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -90,12 +99,12 @@ namespace UseSourceGeneration.Test.Model } /// - /// Test the property 'EnumStringRequired' + /// Test the property 'OuterEnum' /// [Fact] - public void EnumStringRequiredTest() + public void OuterEnumTest() { - // TODO unit test for the property 'EnumStringRequired' + // TODO unit test for the property 'OuterEnum' } /// @@ -124,14 +133,5 @@ namespace UseSourceGeneration.Test.Model { // TODO unit test for the property 'OuterEnumIntegerDefaultValue' } - - /// - /// Test the property 'OuterEnum' - /// - [Fact] - public void OuterEnumTest() - { - // TODO unit test for the property 'OuterEnum' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs index 3c21562aaf1..dda0523439c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/NullableClassTests.cs index 54ae0050d22..506c034789b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/NullableClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/NullableClassTests.cs @@ -53,24 +53,6 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'ArrayItemsNullable' - /// - [Fact] - public void ArrayItemsNullableTest() - { - // TODO unit test for the property 'ArrayItemsNullable' - } - - /// - /// Test the property 'ObjectItemsNullable' - /// - [Fact] - public void ObjectItemsNullableTest() - { - // TODO unit test for the property 'ObjectItemsNullable' - } - /// /// Test the property 'ArrayAndItemsNullableProp' /// @@ -80,6 +62,15 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'ArrayAndItemsNullableProp' } + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + /// /// Test the property 'ArrayNullableProp' /// @@ -143,6 +134,15 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'ObjectAndItemsNullableProp' } + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + /// /// Test the property 'ObjectNullableProp' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/OrderTests.cs index cab96781726..f2de35feaff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/OrderTests.cs @@ -53,6 +53,15 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + /// /// Test the property 'Id' /// @@ -97,14 +106,5 @@ namespace UseSourceGeneration.Test.Model { // TODO unit test for the property 'Status' } - - /// - /// Test the property 'Complete' - /// - [Fact] - public void CompleteTest() - { - // TODO unit test for the property 'Complete' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs index 750f806d61d..24f0472ce35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs @@ -53,24 +53,6 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Category' - /// - [Fact] - public void CategoryTest() - { - // TODO unit test for the property 'Category' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - /// /// Test the property 'Name' /// @@ -89,6 +71,24 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'PhotoUrls' } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// /// Test the property 'Status' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs index 535d720a770..92025e7499c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs @@ -152,105 +152,6 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'RequiredNotnullableintegerProp' } - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - /// /// Test the property 'RequiredNullableArrayOfString' /// @@ -350,6 +251,24 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'RequiredNullableUuid' } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// /// Test the property 'NotRequiredNullableDateProp' /// @@ -368,6 +287,87 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'NotRequiredNullableIntegerProp' } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// /// Test the property 'NotrequiredNullableArrayOfString' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/UserTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/UserTests.cs index d2e4d27334d..eb551ea71c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/UserTests.cs @@ -53,6 +53,24 @@ namespace UseSourceGeneration.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + /// /// Test the property 'Email' /// @@ -98,6 +116,15 @@ namespace UseSourceGeneration.Test.Model // TODO unit test for the property 'ObjectWithNoDeclaredProps' } + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + /// /// Test the property 'Password' /// @@ -133,32 +160,5 @@ namespace UseSourceGeneration.Test.Model { // TODO unit test for the property 'Username' } - - /// - /// Test the property 'AnyTypeProp' - /// - [Fact] - public void AnyTypePropTest() - { - // TODO unit test for the property 'AnyTypeProp' - } - - /// - /// Test the property 'AnyTypePropNullable' - /// - [Fact] - public void AnyTypePropNullableTest() - { - // TODO unit test for the property 'AnyTypePropNullable' - } - - /// - /// Test the property 'ObjectWithNoDeclaredPropsNullable' - /// - [Fact] - public void ObjectWithNoDeclaredPropsNullableTest() - { - // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeClassnameTags123Api.cs index d009a97cbfa..c2ee3960273 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeClassnameTags123Api.cs @@ -282,6 +282,7 @@ namespace UseSourceGeneration.Api List tokenBaseLocalVars = new List(); ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/PetApi.cs index 3cbb5acf871..79986501793 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/PetApi.cs @@ -1674,6 +1674,7 @@ namespace UseSourceGeneration.Api ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/UserApi.cs index 533178b7147..c27618591e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/UserApi.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -566,6 +567,11 @@ namespace UseSourceGeneration.Api /// public TokenProvider OauthTokenProvider { get; } + /// + /// The token cookie container + /// + public UseSourceGeneration.Client.CookieContainer CookieContainer { get; } + /// /// Initializes a new instance of the class. /// @@ -575,7 +581,8 @@ namespace UseSourceGeneration.Api TokenProvider bearerTokenProvider, TokenProvider basicTokenProvider, TokenProvider httpSignatureTokenProvider, - TokenProvider oauthTokenProvider) + TokenProvider oauthTokenProvider, + UseSourceGeneration.Client.CookieContainer cookieContainer) { _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; LoggerFactory = loggerFactory; @@ -587,6 +594,7 @@ namespace UseSourceGeneration.Api BasicTokenProvider = basicTokenProvider; HttpSignatureTokenProvider = httpSignatureTokenProvider; OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; } partial void FormatCreateUser(User user); @@ -1716,6 +1724,33 @@ namespace UseSourceGeneration.Api Events.ExecuteOnLoginUser(apiResponseLocalVar); + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + return apiResponseLocalVar; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/UseSourceGeneration.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/UseSourceGeneration.csproj index 61d9add574f..29de00f0098 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/UseSourceGeneration.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/UseSourceGeneration.csproj @@ -25,6 +25,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/UserApi.md index 56c1acb7928..b0b47b9f22d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 09680ae4ced..e43fb2f369b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -52,26 +52,30 @@ namespace Org.OpenAPITools.Test.Api public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureApi((context, services, options) => { - string apiKeyTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken = new(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); - string bearerTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - BearerToken bearerToken = new(bearerTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); - string basicTokenUsername = context.Configuration[""] ?? throw new Exception("Username not found."); - string basicTokenPassword = context.Configuration[""] ?? throw new Exception("Password not found."); - BasicToken basicToken = new(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); - HttpSigningConfiguration config = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); - string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - OAuthToken oauthToken = new(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 5ad1cd420f9..098236c1e4a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,93 +24,105 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) @@ -124,22 +136,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -152,22 +164,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -208,22 +220,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 758fb96ce8b..feaae2e6718 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ namespace Org.OpenAPITools.Test.Api await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs index b6bff036a46..e157b477193 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + /// /// Test the property 'EmptyMap' /// @@ -115,14 +124,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'MapWithUndeclaredPropertiesString' } - - /// - /// Test the property 'Anytype1' - /// - [Fact] - public void Anytype1Test() - { - // TODO unit test for the property 'Anytype1' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/DrawingTests.cs index 0ed2f54aab5..a2de4a1b97b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/DrawingTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -62,15 +62,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'MainShape' } - /// - /// Test the property 'Shapes' - /// - [Fact] - public void ShapesTest() - { - // TODO unit test for the property 'Shapes' - } - /// /// Test the property 'NullableShape' /// @@ -88,5 +79,14 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'ShapeOrNull' } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f42866..3781eebbfcf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -90,12 +99,12 @@ namespace Org.OpenAPITools.Test.Model } /// - /// Test the property 'EnumStringRequired' + /// Test the property 'OuterEnum' /// [Fact] - public void EnumStringRequiredTest() + public void OuterEnumTest() { - // TODO unit test for the property 'EnumStringRequired' + // TODO unit test for the property 'OuterEnum' } /// @@ -124,14 +133,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'OuterEnumIntegerDefaultValue' } - - /// - /// Test the property 'OuterEnum' - /// - [Fact] - public void OuterEnumTest() - { - // TODO unit test for the property 'OuterEnum' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af7..164baa8862b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs index 47901aeb2f4..1e19aa6b823 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'ArrayItemsNullable' - /// - [Fact] - public void ArrayItemsNullableTest() - { - // TODO unit test for the property 'ArrayItemsNullable' - } - - /// - /// Test the property 'ObjectItemsNullable' - /// - [Fact] - public void ObjectItemsNullableTest() - { - // TODO unit test for the property 'ObjectItemsNullable' - } - /// /// Test the property 'ArrayAndItemsNullableProp' /// @@ -80,6 +62,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ArrayAndItemsNullableProp' } + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + /// /// Test the property 'ArrayNullableProp' /// @@ -143,6 +134,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectAndItemsNullableProp' } + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + /// /// Test the property 'ObjectNullableProp' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/OrderTests.cs index afab7d23a20..e7187bbdc92 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + /// /// Test the property 'Id' /// @@ -97,14 +106,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Status' } - - /// - /// Test the property 'Complete' - /// - [Fact] - public void CompleteTest() - { - // TODO unit test for the property 'Complete' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faa..8485d1213ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Category' - /// - [Fact] - public void CategoryTest() - { - // TODO unit test for the property 'Category' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - /// /// Test the property 'Name' /// @@ -89,6 +71,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'PhotoUrls' } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// /// Test the property 'Status' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs index 6e8958b1b74..e5186391592 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -152,105 +152,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNotnullableintegerProp' } - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - /// /// Test the property 'RequiredNullableArrayOfString' /// @@ -350,6 +251,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNullableUuid' } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// /// Test the property 'NotRequiredNullableDateProp' /// @@ -368,6 +287,87 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'NotRequiredNullableIntegerProp' } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// /// Test the property 'NotrequiredNullableArrayOfString' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/UserTests.cs index cc4d133818a..6415f8561f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -53,6 +53,24 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + /// /// Test the property 'Email' /// @@ -98,6 +116,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectWithNoDeclaredProps' } + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + /// /// Test the property 'Password' /// @@ -133,32 +160,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Username' } - - /// - /// Test the property 'AnyTypeProp' - /// - [Fact] - public void AnyTypePropTest() - { - // TODO unit test for the property 'AnyTypeProp' - } - - /// - /// Test the property 'AnyTypePropNullable' - /// - [Fact] - public void AnyTypePropNullableTest() - { - // TODO unit test for the property 'AnyTypePropNullable' - } - - /// - /// Test the property 'ObjectWithNoDeclaredPropsNullable' - /// - [Fact] - public void ObjectWithNoDeclaredPropsNullableTest() - { - // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 40fe43be9a5..6105d991283 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -282,6 +282,7 @@ namespace Org.OpenAPITools.Api List tokenBaseLocalVars = new List(); ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index 6ffcc89986b..746440b6106 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -1674,6 +1674,7 @@ namespace Org.OpenAPITools.Api ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs index 2f06f13a9f6..9e665bf2895 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -566,6 +567,11 @@ namespace Org.OpenAPITools.Api /// public TokenProvider OauthTokenProvider { get; } + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + /// /// Initializes a new instance of the class. /// @@ -575,7 +581,8 @@ namespace Org.OpenAPITools.Api TokenProvider bearerTokenProvider, TokenProvider basicTokenProvider, TokenProvider httpSignatureTokenProvider, - TokenProvider oauthTokenProvider) + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) { _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; LoggerFactory = loggerFactory; @@ -587,6 +594,7 @@ namespace Org.OpenAPITools.Api BasicTokenProvider = basicTokenProvider; HttpSignatureTokenProvider = httpSignatureTokenProvider; OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; } partial void FormatCreateUser(User user); @@ -1716,6 +1724,33 @@ namespace Org.OpenAPITools.Api Events.ExecuteOnLoginUser(apiResponseLocalVar); + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + return apiResponseLocalVar; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Org.OpenAPITools.csproj index cee8b7854c7..f32136bde7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -25,6 +25,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/UserApi.md index 56c1acb7928..b0b47b9f22d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 09680ae4ced..e43fb2f369b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -52,26 +52,30 @@ namespace Org.OpenAPITools.Test.Api public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureApi((context, services, options) => { - string apiKeyTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken = new(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); - string bearerTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - BearerToken bearerToken = new(bearerTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); - string basicTokenUsername = context.Configuration[""] ?? throw new Exception("Username not found."); - string basicTokenPassword = context.Configuration[""] ?? throw new Exception("Password not found."); - BasicToken basicToken = new(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); - HttpSigningConfiguration config = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); - string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - OAuthToken oauthToken = new(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 5ad1cd420f9..098236c1e4a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,93 +24,105 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) @@ -124,22 +136,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -152,22 +164,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -208,22 +220,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 6c82be59af8..62a5cdba43b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ namespace Org.OpenAPITools.Test.Api await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs index b6bff036a46..e157b477193 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + /// /// Test the property 'EmptyMap' /// @@ -115,14 +124,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'MapWithUndeclaredPropertiesString' } - - /// - /// Test the property 'Anytype1' - /// - [Fact] - public void Anytype1Test() - { - // TODO unit test for the property 'Anytype1' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs index 0ed2f54aab5..a2de4a1b97b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -62,15 +62,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'MainShape' } - /// - /// Test the property 'Shapes' - /// - [Fact] - public void ShapesTest() - { - // TODO unit test for the property 'Shapes' - } - /// /// Test the property 'NullableShape' /// @@ -88,5 +79,14 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'ShapeOrNull' } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f42866..3781eebbfcf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -90,12 +99,12 @@ namespace Org.OpenAPITools.Test.Model } /// - /// Test the property 'EnumStringRequired' + /// Test the property 'OuterEnum' /// [Fact] - public void EnumStringRequiredTest() + public void OuterEnumTest() { - // TODO unit test for the property 'EnumStringRequired' + // TODO unit test for the property 'OuterEnum' } /// @@ -124,14 +133,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'OuterEnumIntegerDefaultValue' } - - /// - /// Test the property 'OuterEnum' - /// - [Fact] - public void OuterEnumTest() - { - // TODO unit test for the property 'OuterEnum' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af7..164baa8862b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs index 47901aeb2f4..1e19aa6b823 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'ArrayItemsNullable' - /// - [Fact] - public void ArrayItemsNullableTest() - { - // TODO unit test for the property 'ArrayItemsNullable' - } - - /// - /// Test the property 'ObjectItemsNullable' - /// - [Fact] - public void ObjectItemsNullableTest() - { - // TODO unit test for the property 'ObjectItemsNullable' - } - /// /// Test the property 'ArrayAndItemsNullableProp' /// @@ -80,6 +62,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ArrayAndItemsNullableProp' } + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + /// /// Test the property 'ArrayNullableProp' /// @@ -143,6 +134,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectAndItemsNullableProp' } + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + /// /// Test the property 'ObjectNullableProp' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs index afab7d23a20..e7187bbdc92 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + /// /// Test the property 'Id' /// @@ -97,14 +106,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Status' } - - /// - /// Test the property 'Complete' - /// - [Fact] - public void CompleteTest() - { - // TODO unit test for the property 'Complete' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faa..8485d1213ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Category' - /// - [Fact] - public void CategoryTest() - { - // TODO unit test for the property 'Category' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - /// /// Test the property 'Name' /// @@ -89,6 +71,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'PhotoUrls' } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// /// Test the property 'Status' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs index 6e8958b1b74..e5186391592 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -152,105 +152,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNotnullableintegerProp' } - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - /// /// Test the property 'RequiredNullableArrayOfString' /// @@ -350,6 +251,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNullableUuid' } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// /// Test the property 'NotRequiredNullableDateProp' /// @@ -368,6 +287,87 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'NotRequiredNullableIntegerProp' } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// /// Test the property 'NotrequiredNullableArrayOfString' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/UserTests.cs index cc4d133818a..6415f8561f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -53,6 +53,24 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + /// /// Test the property 'Email' /// @@ -98,6 +116,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectWithNoDeclaredProps' } + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + /// /// Test the property 'Password' /// @@ -133,32 +160,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Username' } - - /// - /// Test the property 'AnyTypeProp' - /// - [Fact] - public void AnyTypePropTest() - { - // TODO unit test for the property 'AnyTypeProp' - } - - /// - /// Test the property 'AnyTypePropNullable' - /// - [Fact] - public void AnyTypePropNullableTest() - { - // TODO unit test for the property 'AnyTypePropNullable' - } - - /// - /// Test the property 'ObjectWithNoDeclaredPropsNullable' - /// - [Fact] - public void ObjectWithNoDeclaredPropsNullableTest() - { - // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index fd792fa85d9..e38e144de69 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -280,6 +280,7 @@ namespace Org.OpenAPITools.Api List tokenBaseLocalVars = new List(); ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index ec7893baae1..4d540b4c2ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1672,6 +1672,7 @@ namespace Org.OpenAPITools.Api ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs index d8bba20a4d7..c060ca1c0f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -564,6 +565,11 @@ namespace Org.OpenAPITools.Api /// public TokenProvider OauthTokenProvider { get; } + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + /// /// Initializes a new instance of the class. /// @@ -573,7 +579,8 @@ namespace Org.OpenAPITools.Api TokenProvider bearerTokenProvider, TokenProvider basicTokenProvider, TokenProvider httpSignatureTokenProvider, - TokenProvider oauthTokenProvider) + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) { _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; LoggerFactory = loggerFactory; @@ -585,6 +592,7 @@ namespace Org.OpenAPITools.Api BasicTokenProvider = basicTokenProvider; HttpSignatureTokenProvider = httpSignatureTokenProvider; OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; } partial void FormatCreateUser(User user); @@ -1714,6 +1722,33 @@ namespace Org.OpenAPITools.Api Events.ExecuteOnLoginUser(apiResponseLocalVar); + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + return apiResponseLocalVar; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj index d49f3a81795..1cb54dc2bc1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -24,6 +24,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index ee4506c19b2..f408496be45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,37 +24,37 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index cee8b7854c7..f32136bde7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -25,6 +25,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 49e4c513024..4006d2fc6ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,37 +24,37 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index cee8b7854c7..f32136bde7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -25,6 +25,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 49e4c513024..4006d2fc6ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,37 +24,37 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + }); }) .Build(); private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder(Array.Empty()).ConfigureServices((host, services) => + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => { services.AddApi(options => { - + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index cee8b7854c7..f32136bde7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -25,6 +25,7 @@ + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/UserApi.md index 56c1acb7928..b0b47b9f22d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index b44e3191e8d..53544a09034 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -52,26 +52,30 @@ namespace Org.OpenAPITools.Test.Api public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureApi((context, services, options) => { - string apiKeyTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken = new ApiKeyToken(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new ApiKeyToken(apiKeyTokenValue1, "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); - string bearerTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - BearerToken bearerToken = new BearerToken(bearerTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new ApiKeyToken(apiKeyTokenValue2, "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); - string basicTokenUsername = context.Configuration[""] ?? throw new Exception("Username not found."); - string basicTokenPassword = context.Configuration[""] ?? throw new Exception("Password not found."); - BasicToken basicToken = new BasicToken(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new BearerToken(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new BasicToken(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); - string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); - OAuthToken oauthToken = new OAuthToken(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + HttpSigningConfiguration config1 = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 5ad1cd420f9..73a2cae6f5c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -24,43 +24,49 @@ namespace Org.OpenAPITools.Test.Api /// public class DependencyInjectionTest { - private readonly IHost _hostUsingConfigureWithoutAClient = + private readonly IHost _hostUsingConfigureWithoutAClient = Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new ApiKeyToken($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new ApiKeyToken($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }) .Build(); private readonly IHost _hostUsingConfigureWithAClient = Host.CreateDefaultBuilder(Array.Empty()).ConfigureApi((context, services, options) => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - + ApiKeyToken apiKeyToken1 = new ApiKeyToken($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new ApiKeyToken($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); @@ -72,21 +78,24 @@ namespace Org.OpenAPITools.Test.Api { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new ApiKeyToken($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new ApiKeyToken($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); }); }) .Build(); @@ -96,21 +105,24 @@ namespace Org.OpenAPITools.Test.Api { services.AddApi(options => { - ApiKeyToken apiKeyToken = new ApiKeyToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken); - - BearerToken bearerToken = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(bearerToken); - - BasicToken basicToken = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(basicToken); - - HttpSigningConfiguration config = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); - HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(httpSignatureToken); - - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + ApiKeyToken apiKeyToken1 = new ApiKeyToken($"", "api_key", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new ApiKeyToken($"", "api_key_query", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new BearerToken($"", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new BasicToken("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new HttpSigningConfiguration("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) @@ -124,22 +136,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -152,22 +164,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } @@ -208,22 +220,22 @@ namespace Org.OpenAPITools.Test.Api { var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); - + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(defaultApi.HttpClient.BaseAddress != null); - + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeApi.HttpClient.BaseAddress != null); - + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); - + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(petApi.HttpClient.BaseAddress != null); - + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(storeApi.HttpClient.BaseAddress != null); - + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); Assert.True(userApi.HttpClient.BaseAddress != null); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 6c82be59af8..62a5cdba43b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ namespace Org.OpenAPITools.Test.Api await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs index b6bff036a46..e157b477193 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + /// /// Test the property 'EmptyMap' /// @@ -115,14 +124,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'MapWithUndeclaredPropertiesString' } - - /// - /// Test the property 'Anytype1' - /// - [Fact] - public void Anytype1Test() - { - // TODO unit test for the property 'Anytype1' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs index 0ed2f54aab5..a2de4a1b97b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -62,15 +62,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'MainShape' } - /// - /// Test the property 'Shapes' - /// - [Fact] - public void ShapesTest() - { - // TODO unit test for the property 'Shapes' - } - /// /// Test the property 'NullableShape' /// @@ -88,5 +79,14 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'ShapeOrNull' } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f42866..3781eebbfcf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -90,12 +99,12 @@ namespace Org.OpenAPITools.Test.Model } /// - /// Test the property 'EnumStringRequired' + /// Test the property 'OuterEnum' /// [Fact] - public void EnumStringRequiredTest() + public void OuterEnumTest() { - // TODO unit test for the property 'EnumStringRequired' + // TODO unit test for the property 'OuterEnum' } /// @@ -124,14 +133,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'OuterEnumIntegerDefaultValue' } - - /// - /// Test the property 'OuterEnum' - /// - [Fact] - public void OuterEnumTest() - { - // TODO unit test for the property 'OuterEnum' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af7..164baa8862b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs index 47901aeb2f4..1e19aa6b823 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'ArrayItemsNullable' - /// - [Fact] - public void ArrayItemsNullableTest() - { - // TODO unit test for the property 'ArrayItemsNullable' - } - - /// - /// Test the property 'ObjectItemsNullable' - /// - [Fact] - public void ObjectItemsNullableTest() - { - // TODO unit test for the property 'ObjectItemsNullable' - } - /// /// Test the property 'ArrayAndItemsNullableProp' /// @@ -80,6 +62,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ArrayAndItemsNullableProp' } + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + /// /// Test the property 'ArrayNullableProp' /// @@ -143,6 +134,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectAndItemsNullableProp' } + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + /// /// Test the property 'ObjectNullableProp' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs index afab7d23a20..e7187bbdc92 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -53,6 +53,15 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + /// /// Test the property 'Id' /// @@ -97,14 +106,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Status' } - - /// - /// Test the property 'Complete' - /// - [Fact] - public void CompleteTest() - { - // TODO unit test for the property 'Complete' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faa..8485d1213ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -53,24 +53,6 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } - /// - /// Test the property 'Category' - /// - [Fact] - public void CategoryTest() - { - // TODO unit test for the property 'Category' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - /// /// Test the property 'Name' /// @@ -89,6 +71,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'PhotoUrls' } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// /// Test the property 'Status' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs index 6e8958b1b74..e5186391592 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -152,105 +152,6 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNotnullableintegerProp' } - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - /// /// Test the property 'RequiredNullableArrayOfString' /// @@ -350,6 +251,24 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'RequiredNullableUuid' } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// /// Test the property 'NotRequiredNullableDateProp' /// @@ -368,6 +287,87 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'NotRequiredNullableIntegerProp' } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// /// Test the property 'NotrequiredNullableArrayOfString' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/UserTests.cs index cc4d133818a..6415f8561f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -53,6 +53,24 @@ namespace Org.OpenAPITools.Test.Model //Assert.IsType(instance); } + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + /// /// Test the property 'Email' /// @@ -98,6 +116,15 @@ namespace Org.OpenAPITools.Test.Model // TODO unit test for the property 'ObjectWithNoDeclaredProps' } + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + /// /// Test the property 'Password' /// @@ -133,32 +160,5 @@ namespace Org.OpenAPITools.Test.Model { // TODO unit test for the property 'Username' } - - /// - /// Test the property 'AnyTypeProp' - /// - [Fact] - public void AnyTypePropTest() - { - // TODO unit test for the property 'AnyTypeProp' - } - - /// - /// Test the property 'AnyTypePropNullable' - /// - [Fact] - public void AnyTypePropNullableTest() - { - // TODO unit test for the property 'AnyTypePropNullable' - } - - /// - /// Test the property 'ObjectWithNoDeclaredPropsNullable' - /// - [Fact] - public void ObjectWithNoDeclaredPropsNullableTest() - { - // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index ec9178ce4d1..970c301061e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -279,6 +279,7 @@ namespace Org.OpenAPITools.Api List tokenBaseLocalVars = new List(); ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index 7cad24ab8f4..5b7c22813d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1668,6 +1668,7 @@ namespace Org.OpenAPITools.Api ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar, "api_key_query"); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/UserApi.md index a7cf3372a3a..0269d095a85 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/UserApi.md @@ -560,7 +560,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index e7d1366f01b..10eccdd96be 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -500,6 +500,14 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user explode: false diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/UserApi.md index adb1d8d3fec..59bda0028d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/docs/UserApi.md @@ -536,7 +536,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)