Skip to content

Commit 3c575e4

Browse files
committed
replaced inherited property
1 parent 3ee7886 commit 3c575e4

File tree

244 files changed

+16477
-0
lines changed

Some content is hidden

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

244 files changed

+16477
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,12 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
679679
for (CodegenProperty property : model.nonNullableVars) {
680680
patchProperty(enumRefs, model, property);
681681
}
682+
683+
List<CodegenProperty> overriddenProperties = model.vars.stream().filter(v -> model.allVars.stream().anyMatch(a -> a.baseName.equals(v.baseName) && a.dataType != v.dataType)).collect(Collectors.toList());
684+
for (CodegenProperty overridden : overriddenProperties) {
685+
// if the current model overrides an allOf property, use the overridden property
686+
model.allVars.set(model.allVars.indexOf(model.allVars.stream().filter(a -> a.baseName.equals(overridden.baseName)).findFirst().get()), overridden);
687+
}
682688
}
683689
return processed;
684690
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
{{/isNew}}
205205
{{/isInherited}}
206206
{{^isInherited}}
207+
{{! {{^vendorExtensions.x-composed-override}}
207208
{{^required}}
208209
/// <summary>
209210
/// Used to track the state of {{{name}}}
@@ -226,6 +227,7 @@
226227
{{/deprecated}}
227228
public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
228229

230+
{{! {{/vendorExtensions.x-composed-override }}
229231
{{/isInherited}}
230232
{{/isEnum}}
231233
{{/isDiscriminator}}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,3 +2861,30 @@ components:
28612861
propertyName: $schema
28622862
mapping:
28632863
ScopeActivity: '#/components/schemas/CopyActivity'
2864+
Result:
2865+
type: object
2866+
properties:
2867+
code:
2868+
type: string
2869+
description: Result code
2870+
uuid:
2871+
type: string
2872+
description: Result unique identifier
2873+
data:
2874+
type: object
2875+
description: list of named parameters for current message
2876+
additionalProperties:
2877+
type: string
2878+
TestResult:
2879+
type: object
2880+
allOf:
2881+
- $ref: '#/components/schemas/Result'
2882+
properties:
2883+
code:
2884+
$ref: "#/components/schemas/TestResultCode"
2885+
TestResultCode:
2886+
type: string
2887+
description: Result code
2888+
enum:
2889+
- APPROVED
2890+
- MANUAL_APPROVAL_REQUIRED

samples/client/petstore/csharp/generichost/net4.7/FormModels/.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ docs/models/RequiredClassRequiredNotnullableEnumString.md
103103
docs/models/RequiredClassRequiredNullableEnumInteger.md
104104
docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md
105105
docs/models/RequiredClassRequiredNullableEnumString.md
106+
docs/models/Result.md
106107
docs/models/Return.md
107108
docs/models/RolesReportsHash.md
108109
docs/models/RolesReportsHashRole.md
@@ -121,6 +122,8 @@ docs/models/TestEnumParametersEnumQueryIntegerParameter.md
121122
docs/models/TestEnumParametersRequestEnumFormString.md
122123
docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md
123124
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
125+
docs/models/TestResult.md
126+
docs/models/TestResultCode.md
124127
docs/models/Triangle.md
125128
docs/models/TriangleInterface.md
126129
docs/models/User.md
@@ -261,6 +264,7 @@ src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs
261264
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs
262265
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs
263266
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs
267+
src/Org.OpenAPITools/Model/Result.cs
264268
src/Org.OpenAPITools/Model/Return.cs
265269
src/Org.OpenAPITools/Model/RolesReportsHash.cs
266270
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@@ -279,6 +283,8 @@ src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
279283
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs
280284
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs
281285
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
286+
src/Org.OpenAPITools/Model/TestResult.cs
287+
src/Org.OpenAPITools/Model/TestResultCode.cs
282288
src/Org.OpenAPITools/Model/Triangle.cs
283289
src/Org.OpenAPITools/Model/TriangleInterface.cs
284290
src/Org.OpenAPITools/Model/User.cs

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,33 @@ components:
26172617
required:
26182618
- $schema
26192619
type: object
2620+
Result:
2621+
properties:
2622+
code:
2623+
description: Result code
2624+
type: string
2625+
uuid:
2626+
description: Result unique identifier
2627+
type: string
2628+
data:
2629+
additionalProperties:
2630+
type: string
2631+
description: list of named parameters for current message
2632+
type: object
2633+
type: object
2634+
TestResult:
2635+
allOf:
2636+
- $ref: '#/components/schemas/Result'
2637+
properties:
2638+
code:
2639+
$ref: '#/components/schemas/TestResultCode'
2640+
type: object
2641+
TestResultCode:
2642+
description: Result code
2643+
enum:
2644+
- APPROVED
2645+
- MANUAL_APPROVAL_REQUIRED
2646+
type: string
26202647
_foo_get_default_response:
26212648
example:
26222649
string:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Org.OpenAPITools.Model.Result
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Code** | **string** | Result code | [optional]
8+
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
9+
**Uuid** | **string** | Result unique identifier | [optional]
10+
11+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Org.OpenAPITools.Model.TestResult
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Code** | **TestResultCode** | | [optional]
8+
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
9+
**Uuid** | **string** | Result unique identifier | [optional]
10+
11+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
12+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Org.OpenAPITools.Model.TestResultCode
2+
Result code
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
9+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
10+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* OpenAPI Petstore
3+
*
4+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Generated by: https://github.com/openapitools/openapi-generator.git
8+
*/
9+
10+
11+
using Xunit;
12+
13+
using System;
14+
using System.Linq;
15+
using System.IO;
16+
using System.Collections.Generic;
17+
using Org.OpenAPITools.Model;
18+
using Org.OpenAPITools.Client;
19+
using System.Reflection;
20+
21+
namespace Org.OpenAPITools.Test.Model
22+
{
23+
/// <summary>
24+
/// Class for testing Result
25+
/// </summary>
26+
/// <remarks>
27+
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
28+
/// Please update the test case below to test the model.
29+
/// </remarks>
30+
public class ResultTests : IDisposable
31+
{
32+
// TODO uncomment below to declare an instance variable for Result
33+
//private Result instance;
34+
35+
public ResultTests()
36+
{
37+
// TODO uncomment below to create an instance of Result
38+
//instance = new Result();
39+
}
40+
41+
public void Dispose()
42+
{
43+
// Cleanup when everything is done.
44+
}
45+
46+
/// <summary>
47+
/// Test an instance of Result
48+
/// </summary>
49+
[Fact]
50+
public void ResultInstanceTest()
51+
{
52+
// TODO uncomment below to test "IsType" Result
53+
//Assert.IsType<Result>(instance);
54+
}
55+
56+
/// <summary>
57+
/// Test the property 'Code'
58+
/// </summary>
59+
[Fact]
60+
public void CodeTest()
61+
{
62+
// TODO unit test for the property 'Code'
63+
}
64+
65+
/// <summary>
66+
/// Test the property 'Data'
67+
/// </summary>
68+
[Fact]
69+
public void DataTest()
70+
{
71+
// TODO unit test for the property 'Data'
72+
}
73+
74+
/// <summary>
75+
/// Test the property 'Uuid'
76+
/// </summary>
77+
[Fact]
78+
public void UuidTest()
79+
{
80+
// TODO unit test for the property 'Uuid'
81+
}
82+
}
83+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* OpenAPI Petstore
3+
*
4+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Generated by: https://github.com/openapitools/openapi-generator.git
8+
*/
9+
10+
11+
using Xunit;
12+
13+
using System;
14+
using System.Linq;
15+
using System.IO;
16+
using System.Collections.Generic;
17+
using Org.OpenAPITools.Model;
18+
using Org.OpenAPITools.Client;
19+
using System.Reflection;
20+
21+
namespace Org.OpenAPITools.Test.Model
22+
{
23+
/// <summary>
24+
/// Class for testing TestResultCode
25+
/// </summary>
26+
/// <remarks>
27+
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
28+
/// Please update the test case below to test the model.
29+
/// </remarks>
30+
public class TestResultCodeTests : IDisposable
31+
{
32+
// TODO uncomment below to declare an instance variable for TestResultCode
33+
//private TestResultCode instance;
34+
35+
public TestResultCodeTests()
36+
{
37+
// TODO uncomment below to create an instance of TestResultCode
38+
//instance = new TestResultCode();
39+
}
40+
41+
public void Dispose()
42+
{
43+
// Cleanup when everything is done.
44+
}
45+
46+
/// <summary>
47+
/// Test an instance of TestResultCode
48+
/// </summary>
49+
[Fact]
50+
public void TestResultCodeInstanceTest()
51+
{
52+
// TODO uncomment below to test "IsType" TestResultCode
53+
//Assert.IsType<TestResultCode>(instance);
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)