[csharp][generichost] Add Option struct to enable better validation (#15977)

* add Option struct to enable better validation

* use kebab case
This commit is contained in:
devhl-labs
2023-07-03 02:40:24 -04:00
committed by GitHub
parent e2f5997592
commit 00fcaa15c0
119 changed files with 2845 additions and 2262 deletions

View File

@@ -1036,6 +1036,38 @@ paths:
type: string
type: array
style: form
- explode: true
in: query
name: requiredNotNullable
required: true
schema:
nullable: false
type: string
style: form
- explode: true
in: query
name: requiredNullable
required: true
schema:
nullable: true
type: string
style: form
- explode: true
in: query
name: notRequiredNotNullable
required: false
schema:
nullable: false
type: string
style: form
- explode: true
in: query
name: notRequiredNullable
required: false
schema:
nullable: true
type: string
style: form
responses:
"200":
description: Success

View File

@@ -1357,7 +1357,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@@ -1389,10 +1389,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
var requiredNotNullable = "requiredNotNullable_example"; // string |
var requiredNullable = "requiredNullable_example"; // string |
var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional)
var notRequiredNullable = "notRequiredNullable_example"; // string | (optional)
try
{
apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
catch (ApiException e)
{
@@ -1411,7 +1415,7 @@ This returns an ApiResponse object which contains the response data, status code
```csharp
try
{
apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
catch (ApiException e)
{
@@ -1430,6 +1434,10 @@ catch (ApiException e)
| **http** | [**List&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

View File

@@ -370,8 +370,12 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <returns></returns>
void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string));
/// <summary>
///
@@ -385,8 +389,12 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string));
#endregion Synchronous Operations
}
@@ -782,9 +790,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
///
@@ -798,9 +810,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
#endregion Asynchronous Operations
}
@@ -2893,10 +2909,14 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <returns></returns>
public void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
public void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string))
{
TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
/// <summary>
@@ -2908,8 +2928,12 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <returns>ApiResponse of Object(void)</returns>
public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string))
{
// verify the required parameter 'pipe' is set
if (pipe == null)
@@ -2931,6 +2955,14 @@ namespace Org.OpenAPITools.Api
if (context == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'requiredNotNullable' is set
if (requiredNotNullable == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'requiredNullable' is set
if (requiredNullable == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat");
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
@@ -2951,6 +2983,16 @@ namespace Org.OpenAPITools.Api
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable));
if (notRequiredNotNullable != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable));
}
if (notRequiredNullable != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable));
}
// make the HTTP request
@@ -2974,11 +3016,15 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, cancellationToken).ConfigureAwait(false);
await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken).ConfigureAwait(false);
}
/// <summary>
@@ -2990,9 +3036,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'pipe' is set
if (pipe == null)
@@ -3014,6 +3064,14 @@ namespace Org.OpenAPITools.Api
if (context == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'requiredNotNullable' is set
if (requiredNotNullable == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'requiredNullable' is set
if (requiredNullable == null)
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat");
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
@@ -3036,6 +3094,16 @@ namespace Org.OpenAPITools.Api
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable));
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable));
if (notRequiredNotNullable != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable));
}
if (notRequiredNullable != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable));
}
// make the HTTP request