Skip to content

Commit fb5e69f

Browse files
authored
[csharp][generichost] Fix invalid key name (#19633)
* fix invalid key name * fix comment
1 parent 0b32c50 commit fb5e69f

File tree

93 files changed

+209
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+209
-156
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
450450
.put("uniqueLines", new UniqueLambda("\n", false))
451451
.put("unique", new UniqueLambda("\n", true))
452452
.put("camel_case", new CamelCaseLambda())
453-
.put("escape_reserved_word", new EscapeKeywordLambda(this::escapeKeyword));
453+
.put("escape_reserved_word", new EscapeKeywordLambda(this::escapeKeyword))
454+
.put("alphabet_or_underscore", new ReplaceAllLambda("[^A-Za-z]", "_"));
454455
}
455456

456457
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.openapitools.codegen.templating.mustache;
18+
19+
import com.samskivert.mustache.Mustache;
20+
import com.samskivert.mustache.Template;
21+
22+
import java.io.IOException;
23+
import java.io.Writer;
24+
25+
/**
26+
* Replaces all regex captures with the provided string.
27+
*
28+
* Register:
29+
* <pre>
30+
* additionalProperties.put("regex", new ReplaceAllLambda());
31+
* </pre>
32+
*
33+
* Use:
34+
* <pre>
35+
* {{#regex}}{{summary}}{{/regex}}
36+
* </pre>
37+
*/
38+
public class ReplaceAllLambda implements Mustache.Lambda {
39+
private String regex;
40+
private String replacement;
41+
42+
public ReplaceAllLambda(String regex, String replacement) {
43+
this.regex = regex;
44+
this.replacement = replacement;
45+
}
46+
47+
@Override
48+
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
49+
writer.write(fragment.execute()
50+
.replaceAll(regex, replacement));
51+
}
52+
}

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
3131
{{#lambda.trimTrailingWithNewLine}}
3232
{{#apiKeyMethods}}
3333
string apiKeyTokenValue{{-index}} = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
34-
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue{{-index}}, ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
34+
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue{{-index}}, ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
3535
options.AddTokens(apiKeyToken{{-index}});
3636

3737
{{/apiKeyMethods}}

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ using System.Runtime.CompilerServices;
6060
/// <summary>
6161
/// The {{keyParamName}} header
6262
/// </summary>
63-
{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}{{^-last}},{{/-last}}
63+
{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}{{^-last}},{{/-last}}
6464
{{/apiKeyMethods}}
6565
}
6666

@@ -76,7 +76,7 @@ using System.Runtime.CompilerServices;
7676
return value switch
7777
{
7878
{{#apiKeyMethods}}
79-
ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}} => "{{keyParamName}}",
79+
ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}} => "{{keyParamName}}",
8080
{{/apiKeyMethods}}
8181
_ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)),
8282
};
@@ -85,7 +85,7 @@ using System.Runtime.CompilerServices;
8585
switch(value)
8686
{
8787
{{#apiKeyMethods}}
88-
case ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}:
88+
case ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}:
8989
return "{{keyParamName}}";
9090
{{/apiKeyMethods}}
9191
default:

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
2121
{
2222
{{#lambda.trimTrailingWithNewLine}}
2323
{{#apiKeyMethods}}
24-
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
24+
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
2525
options.AddTokens(apiKeyToken{{-index}});
2626

2727
{{/apiKeyMethods}}
@@ -55,7 +55,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
5555
{
5656
{{#lambda.trimTrailingWithNewLine}}
5757
{{#apiKeyMethods}}
58-
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
58+
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
5959
options.AddTokens(apiKeyToken{{-index}});
6060

6161
{{/apiKeyMethods}}
@@ -92,7 +92,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
9292
{
9393
{{#lambda.trimTrailingWithNewLine}}
9494
{{#apiKeyMethods}}
95-
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
95+
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
9696
options.AddTokens(apiKeyToken{{-index}});
9797

9898
{{/apiKeyMethods}}
@@ -129,7 +129,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
129129
{
130130
{{#lambda.trimTrailingWithNewLine}}
131131
{{#apiKeyMethods}}
132-
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
132+
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{#lambda.alphabet_or_underscore}}{{keyParamName}}{{/lambda.alphabet_or_underscore}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
133133
options.AddTokens(apiKeyToken{{-index}});
134134

135135
{{/apiKeyMethods}}

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ components:
13791379
'read:pets': read your pets
13801380
api_key:
13811381
type: apiKey
1382-
name: api_key
1382+
name: api-key
13831383
in: header
13841384
api_key_query:
13851385
type: apiKey

samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ components:
30453045
type: oauth2
30463046
api_key:
30473047
in: header
3048-
name: api_key
3048+
name: api-key
30493049
type: apiKey
30503050
api_key_query:
30513051
in: query

samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ namespace Example
409409
Configuration config = new Configuration();
410410
config.BasePath = "http://petstore.swagger.io:80/v2";
411411
// Configure API key authorization: api_key
412-
config.AddApiKey("api_key", "YOUR_API_KEY");
412+
config.AddApiKey("api-key", "YOUR_API_KEY");
413413
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
414-
// config.AddApiKeyPrefix("api_key", "Bearer");
414+
// config.AddApiKeyPrefix("api-key", "Bearer");
415415
// Configure API key authorization: api_key_query
416416
config.AddApiKey("api_key_query", "YOUR_API_KEY");
417417
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/StoreApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ namespace Example
122122
Configuration config = new Configuration();
123123
config.BasePath = "http://petstore.swagger.io:80/v2";
124124
// Configure API key authorization: api_key
125-
config.AddApiKey("api_key", "YOUR_API_KEY");
125+
config.AddApiKey("api-key", "YOUR_API_KEY");
126126
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
127-
// config.AddApiKeyPrefix("api_key", "Bearer");
127+
// config.AddApiKeyPrefix("api-key", "Bearer");
128128
129129
var apiInstance = new StoreApi(config);
130130

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ public async Task<IGetPetByIdApiResponse> GetPetByIdAsync(long petId, System.Thr
16991699
System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty);
17001700

17011701
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
1702-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
1702+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
17031703
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
17041704
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
17051705

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ public async Task<IGetInventoryApiResponse> GetInventoryAsync(System.Threading.C
618618
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory";
619619

620620
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
621-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
621+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
622622
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
623623
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
624624

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static ClientUtils()
5858
public enum ApiKeyHeader
5959
{
6060
/// <summary>
61-
/// The api_key header
61+
/// The api-key header
6262
/// </summary>
6363
Api_key,
6464
/// <summary>
@@ -78,7 +78,7 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value)
7878
switch(value)
7979
{
8080
case ApiKeyHeader.Api_key:
81-
return "api_key";
81+
return "api-key";
8282
case ApiKeyHeader.Api_key_query:
8383
return "api_key_query";
8484
default:

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Authentication schemes defined for the API:
134134
### api_key
135135

136136
- **Type**: API key
137-
- **API key parameter name**: api_key
137+
- **API key parameter name**: api-key
138138
- **Location**: HTTP header
139139

140140
<a id="api_key_query"></a>

samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3069,7 +3069,7 @@ components:
30693069
type: oauth2
30703070
api_key:
30713071
in: header
3072-
name: api_key
3072+
name: api-key
30733073
type: apiKey
30743074
api_key_query:
30753075
in: query

samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ namespace Example
409409
Configuration config = new Configuration();
410410
config.BasePath = "http://petstore.swagger.io:80/v2";
411411
// Configure API key authorization: api_key
412-
config.AddApiKey("api_key", "YOUR_API_KEY");
412+
config.AddApiKey("api-key", "YOUR_API_KEY");
413413
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
414-
// config.AddApiKeyPrefix("api_key", "Bearer");
414+
// config.AddApiKeyPrefix("api-key", "Bearer");
415415
// Configure API key authorization: api_key_query
416416
config.AddApiKey("api_key_query", "YOUR_API_KEY");
417417
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/StoreApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ namespace Example
122122
Configuration config = new Configuration();
123123
config.BasePath = "http://petstore.swagger.io:80/v2";
124124
// Configure API key authorization: api_key
125-
config.AddApiKey("api_key", "YOUR_API_KEY");
125+
config.AddApiKey("api-key", "YOUR_API_KEY");
126126
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
127-
// config.AddApiKeyPrefix("api_key", "Bearer");
127+
// config.AddApiKeyPrefix("api-key", "Bearer");
128128
129129
var apiInstance = new StoreApi(config);
130130

samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ public async Task<IGetPetByIdApiResponse> GetPetByIdAsync(long petId, System.Thr
16991699
System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty);
17001700

17011701
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
1702-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
1702+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
17031703
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
17041704
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
17051705

samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ public async Task<IGetInventoryApiResponse> GetInventoryAsync(System.Threading.C
618618
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory";
619619

620620
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
621-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
621+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
622622
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
623623
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
624624

samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static ClientUtils()
5858
public enum ApiKeyHeader
5959
{
6060
/// <summary>
61-
/// The api_key header
61+
/// The api-key header
6262
/// </summary>
6363
Api_key,
6464
/// <summary>
@@ -78,7 +78,7 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value)
7878
switch(value)
7979
{
8080
case ApiKeyHeader.Api_key:
81-
return "api_key";
81+
return "api-key";
8282
case ApiKeyHeader.Api_key_query:
8383
return "api_key_query";
8484
default:

samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Authentication schemes defined for the API:
134134
### api_key
135135

136136
- **Type**: API key
137-
- **API key parameter name**: api_key
137+
- **API key parameter name**: api-key
138138
- **Location**: HTTP header
139139

140140
<a id="api_key_query"></a>

samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ components:
30453045
type: oauth2
30463046
api_key:
30473047
in: header
3048-
name: api_key
3048+
name: api-key
30493049
type: apiKey
30503050
api_key_query:
30513051
in: query

samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ namespace Example
409409
Configuration config = new Configuration();
410410
config.BasePath = "http://petstore.swagger.io:80/v2";
411411
// Configure API key authorization: api_key
412-
config.AddApiKey("api_key", "YOUR_API_KEY");
412+
config.AddApiKey("api-key", "YOUR_API_KEY");
413413
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
414-
// config.AddApiKeyPrefix("api_key", "Bearer");
414+
// config.AddApiKeyPrefix("api-key", "Bearer");
415415
// Configure API key authorization: api_key_query
416416
config.AddApiKey("api_key_query", "YOUR_API_KEY");
417417
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/StoreApi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ namespace Example
122122
Configuration config = new Configuration();
123123
config.BasePath = "http://petstore.swagger.io:80/v2";
124124
// Configure API key authorization: api_key
125-
config.AddApiKey("api_key", "YOUR_API_KEY");
125+
config.AddApiKey("api-key", "YOUR_API_KEY");
126126
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
127-
// config.AddApiKeyPrefix("api_key", "Bearer");
127+
// config.AddApiKeyPrefix("api-key", "Bearer");
128128
129129
var apiInstance = new StoreApi(config);
130130

samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ public async Task<IGetPetByIdApiResponse> GetPetByIdAsync(long petId, System.Thr
16991699
System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty);
17001700

17011701
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
1702-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
1702+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
17031703
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
17041704
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
17051705

samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ public async Task<IGetInventoryApiResponse> GetInventoryAsync(System.Threading.C
618618
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory";
619619

620620
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
621-
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key", cancellationToken).ConfigureAwait(false);
621+
ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false);
622622
tokenBaseLocalVars.Add(apiKeyTokenLocalVar1);
623623
apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar);
624624

samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static ClientUtils()
5858
public enum ApiKeyHeader
5959
{
6060
/// <summary>
61-
/// The api_key header
61+
/// The api-key header
6262
/// </summary>
6363
Api_key,
6464
/// <summary>
@@ -78,7 +78,7 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value)
7878
switch(value)
7979
{
8080
case ApiKeyHeader.Api_key:
81-
return "api_key";
81+
return "api-key";
8282
case ApiKeyHeader.Api_key_query:
8383
return "api_key_query";
8484
default:

samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Authentication schemes defined for the API:
134134
### api_key
135135

136136
- **Type**: API key
137-
- **API key parameter name**: api_key
137+
- **API key parameter name**: api-key
138138
- **Location**: HTTP header
139139

140140
<a id="api_key_query"></a>

samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3069,7 +3069,7 @@ components:
30693069
type: oauth2
30703070
api_key:
30713071
in: header
3072-
name: api_key
3072+
name: api-key
30733073
type: apiKey
30743074
api_key_query:
30753075
in: query

0 commit comments

Comments
 (0)