[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

@@ -1301,7 +1301,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)
@@ -1329,10 +1329,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)
{
@@ -1351,7 +1355,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)
{
@@ -1370,6 +1374,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

@@ -398,9 +398,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="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0);
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?), int operationIndex = 0);
/// <summary>
///
@@ -414,9 +418,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="operationIndex">Index associated with the operation.</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, int operationIndex = 0);
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?), int operationIndex = 0);
#endregion Synchronous Operations
}
@@ -840,10 +848,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>
/// <param name="operationIndex">Index associated with the operation.</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, int operationIndex = 0, 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?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
///
@@ -857,10 +869,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>
/// <param name="operationIndex">Index associated with the operation.</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, int operationIndex = 0, 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?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
#endregion Asynchronous Operations
}
@@ -3246,11 +3262,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="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
public void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0)
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?), int operationIndex = 0)
{
TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
/// <summary>
@@ -3262,9 +3282,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="operationIndex">Index associated with the operation.</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, int operationIndex = 0)
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?), int operationIndex = 0)
{
// verify the required parameter 'pipe' is set
if (pipe == null)
@@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api
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[] {
@@ -3322,6 +3358,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));
}
localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat";
localVarRequestOptions.OperationIndex = operationIndex;
@@ -3350,12 +3396,16 @@ 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="operationIndex">Index associated with the operation.</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, int operationIndex = 0, 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?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false);
await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false);
}
/// <summary>
@@ -3367,10 +3417,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>
/// <param name="operationIndex">Index associated with the operation.</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, int operationIndex = 0, 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?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'pipe' is set
if (pipe == null)
@@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api
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();
@@ -3429,6 +3495,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));
}
localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat";
localVarRequestOptions.OperationIndex = operationIndex;