use model class for request body with additionalProperties (#16613)

* try out simple fix

* add test case

* generate samples
This commit is contained in:
martin-mfg
2023-09-23 07:07:53 +02:00
committed by GitHub
parent f99002a974
commit 2ca99bdf8e
415 changed files with 20517 additions and 1 deletions

View File

@@ -90,6 +90,7 @@ docs/StoreApi.md
docs/Tag.md
docs/TestCollectionEndingWithWordList.md
docs/TestCollectionEndingWithWordListObject.md
docs/TestInlineFreeformAdditionalPropertiesRequest.md
docs/Triangle.md
docs/TriangleInterface.md
docs/User.md
@@ -209,6 +210,7 @@ src/Org.OpenAPITools/Model/SpecialModelName.cs
src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@@ -122,6 +122,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**TestInlineFreeformAdditionalProperties**](docs/FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties
*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**TestQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters |
*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
@@ -232,6 +233,7 @@ Class | Method | HTTP request | Description
- [Model.Tag](docs/Tag.md)
- [Model.TestCollectionEndingWithWordList](docs/TestCollectionEndingWithWordList.md)
- [Model.TestCollectionEndingWithWordListObject](docs/TestCollectionEndingWithWordListObject.md)
- [Model.TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
- [Model.Triangle](docs/Triangle.md)
- [Model.TriangleInterface](docs/TriangleInterface.md)
- [Model.User](docs/User.md)

View File

@@ -943,6 +943,23 @@ paths:
summary: test inline additionalProperties
tags:
- fake
/fake/inline-freeform-additionalProperties:
post:
description: ""
operationId: testInlineFreeformAdditionalProperties
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request'
description: request body
required: true
responses:
"200":
description: successful operation
summary: test inline free-form additionalProperties
tags:
- fake
/fake/body-with-query-params:
put:
operationId: testBodyWithQueryParams
@@ -2488,6 +2505,12 @@ components:
- param
- param2
type: object
testInlineFreeformAdditionalProperties_request:
additionalProperties: true
properties:
someProperty:
type: string
type: object
uploadFileWithRequiredFile_request:
properties:
additionalMetadata:

View File

@@ -17,6 +17,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters |
| [**TestGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) |
| [**TestInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties |
| [**TestInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties |
| [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data |
| [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | |
@@ -1205,6 +1206,91 @@ No authorization required
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
[[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)
<a id="testinlinefreeformadditionalproperties"></a>
# **TestInlineFreeformAdditionalProperties**
> void TestInlineFreeformAdditionalProperties (TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest)
test inline free-form additionalProperties
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class TestInlineFreeformAdditionalPropertiesExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(config);
var testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body
try
{
// test inline free-form additionalProperties
apiInstance.TestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalProperties: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the TestInlineFreeformAdditionalPropertiesWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// test inline free-form additionalProperties
apiInstance.TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalPropertiesWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md) | request body | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|

View File

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.TestInlineFreeformAdditionalPropertiesRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SomeProperty** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,66 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestInlineFreeformAdditionalPropertiesRequest
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
public class TestInlineFreeformAdditionalPropertiesRequestTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestInlineFreeformAdditionalPropertiesRequest
//private TestInlineFreeformAdditionalPropertiesRequest instance;
public TestInlineFreeformAdditionalPropertiesRequestTests()
{
// TODO uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest
//instance = new TestInlineFreeformAdditionalPropertiesRequest();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestInlineFreeformAdditionalPropertiesRequest
/// </summary>
[Fact]
public void TestInlineFreeformAdditionalPropertiesRequestInstanceTest()
{
// TODO uncomment below to test "IsType" TestInlineFreeformAdditionalPropertiesRequest
//Assert.IsType<TestInlineFreeformAdditionalPropertiesRequest>(instance);
}
/// <summary>
/// Test the property 'SomeProperty'
/// </summary>
[Fact]
public void SomePropertyTest()
{
// TODO unit test for the property 'SomeProperty'
}
}
}

View File

@@ -365,6 +365,26 @@ namespace Org.OpenAPITools.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo(Dictionary<string, string> requestBody, int operationIndex = 0);
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0);
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0);
/// <summary>
/// test json serialization of form data
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -810,6 +830,31 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary<string, string> requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</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 TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</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>> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// test json serialization of form data
/// </summary>
/// <remarks>
@@ -3093,6 +3138,148 @@ namespace Org.OpenAPITools.Api
return localVarResponse;
}
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
public void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0)
{
TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest);
}
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Object(void)</returns>
public Org.OpenAPITools.Client.ApiResponse<Object> TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0)
{
// verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set
if (testInlineFreeformAdditionalPropertiesRequest == null)
{
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties");
}
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest;
localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = this.Client.Post<Object>("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</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 TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
await TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(testInlineFreeformAdditionalPropertiesRequest, operationIndex, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// test inline free-form additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="testInlineFreeformAdditionalPropertiesRequest">request body</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>> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set
if (testInlineFreeformAdditionalPropertiesRequest == null)
{
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties");
}
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest;
localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.PostAsync<Object>("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// test json serialization of form data
/// </summary>

View File

@@ -0,0 +1,165 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// TestInlineFreeformAdditionalPropertiesRequest
/// </summary>
[DataContract(Name = "testInlineFreeformAdditionalProperties_request")]
public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary<String, Object>, IEquatable<TestInlineFreeformAdditionalPropertiesRequest>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestInlineFreeformAdditionalPropertiesRequest" /> class.
/// </summary>
/// <param name="someProperty">someProperty.</param>
public TestInlineFreeformAdditionalPropertiesRequest(string someProperty = default(string)) : base()
{
this._SomeProperty = someProperty;
if (this.SomeProperty != null)
{
this._flagSomeProperty = true;
}
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets SomeProperty
/// </summary>
[DataMember(Name = "someProperty", EmitDefaultValue = false)]
public string SomeProperty
{
get{ return _SomeProperty;}
set
{
_SomeProperty = value;
_flagSomeProperty = true;
}
}
private string _SomeProperty;
private bool _flagSomeProperty;
/// <summary>
/// Returns false as SomeProperty should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeSomeProperty()
{
return _flagSomeProperty;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class TestInlineFreeformAdditionalPropertiesRequest {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append(" SomeProperty: ").Append(SomeProperty).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as TestInlineFreeformAdditionalPropertiesRequest).AreEqual;
}
/// <summary>
/// Returns true if TestInlineFreeformAdditionalPropertiesRequest instances are equal
/// </summary>
/// <param name="input">Instance of TestInlineFreeformAdditionalPropertiesRequest to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(TestInlineFreeformAdditionalPropertiesRequest input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
if (this.SomeProperty != null)
{
hashCode = (hashCode * 59) + this.SomeProperty.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
yield break;
}
}
}