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 bf77ff2ef25..53665ab2750 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 @@ -997,6 +997,26 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen { case "511": postProcessResponseCode(response, "NetworkAuthenticationRequired", httpStatusesWithReturn); break; + case "1xx": + response.vendorExtensions.put("x-http-status-range", 1); + postProcessResponseCode(response, "HttpStatusCode1XX", httpStatusesWithReturn); + break; + case "2xx": + response.vendorExtensions.put("x-http-status-range", 2); + postProcessResponseCode(response, "HttpStatusCode2XX", httpStatusesWithReturn); + break; + case "3xx": + response.vendorExtensions.put("x-http-status-range", 3); + postProcessResponseCode(response, "HttpStatusCode3XX", httpStatusesWithReturn); + break; + case "4xx": + response.vendorExtensions.put("x-http-status-range", 4); + postProcessResponseCode(response, "HttpStatusCode4XX", httpStatusesWithReturn); + break; + case "5xx": + response.vendorExtensions.put("x-http-status-range", 5); + postProcessResponseCode(response, "HttpStatusCode5XX", httpStatusesWithReturn); + break; default: postProcessResponseCode(response, "CustomHttpStatusCode" + code, httpStatusesWithReturn); } 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 eccb02d5318..eff9ec9313f 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 @@ -725,7 +725,19 @@ namespace {{packageName}}.{{apiPackage}} /// Returns true if the response is {{code}} {{vendorExtensions.x-http-status}} /// /// + {{#vendorExtensions.x-http-status-range}} + public bool Is{{vendorExtensions.x-http-status}} + { + get + { + int statusCode = (int)StatusCode; + return {{vendorExtensions.x-http-status-range}}00 >= statusCode && {{vendorExtensions.x-http-status-range}}99 <= statusCode; + } + } + {{/vendorExtensions.x-http-status-range}} + {{^vendorExtensions.x-http-status-range}} public bool Is{{vendorExtensions.x-http-status}} => {{code}} == (int)StatusCode; + {{/vendorExtensions.x-http-status-range}} {{/vendorExtensions.x-http-status-is-default}} {{#dataType}} @@ -756,7 +768,7 @@ namespace {{packageName}}.{{apiPackage}} result = {{vendorExtensions.x-http-status}}(); } catch (Exception e) { - OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode){{code}}); + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode){{#vendorExtensions.x-http-status-range}}{{.}}{{/vendorExtensions.x-http-status-range}}{{^vendorExtensions.x-http-status-range}}{{code}}{{/vendorExtensions.x-http-status-range}}); } return result != null; 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 6809791b5e4..985ef28a398 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 @@ -120,6 +120,8 @@ paths: - sold default: available responses: + '2XX': + description: Anything within 200-299 '200': description: successful operation content: @@ -135,6 +137,8 @@ paths: $ref: '#/components/schemas/Pet' '400': description: Invalid status value + '4XX': + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml index c64890a0634..0143839cb66 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml @@ -133,6 +133,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -148,6 +150,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md index 862c66f0bee..4c79f5e6317 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index d97995fd5ff..9c9d5d755db 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1308,6 +1320,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 9693c8ffacd..9b9404dd768 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1308,6 +1320,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml index c64890a0634..0143839cb66 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml @@ -133,6 +133,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -148,6 +150,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md index 862c66f0bee..4c79f5e6317 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index d97995fd5ff..9c9d5d755db 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1308,6 +1320,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 9693c8ffacd..9b9404dd768 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1308,6 +1320,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml index c64890a0634..0143839cb66 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml @@ -133,6 +133,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -148,6 +150,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md index 862c66f0bee..4c79f5e6317 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index c75d22024d3..06c69dbf14b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1310,6 +1322,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index 21ed363826b..ec790d1b0d1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -299,6 +299,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1312,6 +1324,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 1b402e88658..8dbe0fbf7a8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -297,6 +297,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1310,6 +1322,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index 21ed363826b..ec790d1b0d1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -299,6 +299,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1312,6 +1324,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md index 407fb30dccb..1b3bb464956 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 88051a3d005..3081ea1aba0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -296,6 +296,18 @@ namespace Org.OpenAPITools.Api /// /// bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } } /// @@ -1307,6 +1319,32 @@ namespace Org.OpenAPITools.Api /// public bool IsBadRequest => 400 == (int)StatusCode; + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) { bool suppressDefaultLog = false; diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md index fbe6c1f5aa6..7e996cb99b9 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md @@ -296,6 +296,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/restsharp/net7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net7/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md index 417e0ab8020..249bc72ed0f 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md index 220b1ae3010..00a45b118d4 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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/unityWebRequest/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml index f772773afef..95cd969e02c 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml @@ -138,6 +138,8 @@ paths: type: array style: form responses: + "2XX": + description: Anything within 200-299 "200": content: application/xml: @@ -153,6 +155,8 @@ paths: description: successful operation "400": description: Invalid status value + "4XX": + description: Anything within 400-499 security: - http_signature_test: [] - petstore_auth: diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md index 220b1ae3010..00a45b118d4 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md @@ -284,6 +284,8 @@ catch (ApiException e) |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | [[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)