-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[csharp] Support arrays of arrays for properties and models (#7400)
* [csharp] Support composition on toJson Previous implementation assumed specification only supports polymorphic associations (via discrimator), although the code didn't seem to be setup correctly for that in the first place. That is, the parent object must define the discriminator (see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support), so NOT HAS parent AND HAS discriminator doesn't make sense. From a C# perspective, base classes should have the method marked virtual and derived classes should override the method. This supports both composition and polymorphic definitions. * [csharp] this.Configuration in api template Unprefixed Configuration property access leads to ambiguous references when spec defines a Configuration model. * [csharp] Models/properties support nested arrays Previous implementation didn't support multiple levels of array with array items as OpenAPI spec supports. This means an object defined as type: array with items = type: array|items=double (which is common in GIS) would not be possible. This implementation assumes generics in the nested type definitions, so the above would generate List<List<double?>> for model parent types as well as property type declarations. * [csharp] Regenerate integration test sample * [csharp] Set "Client" case sensitive as reserved * [csharp] Regenerate security sample * [csharp] Regenerate samples
- Loading branch information
1 parent
1c4e6b7
commit 8724719
Showing
68 changed files
with
1,781 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
samples/client/petstore-security-test/csharp/SwaggerClient/docs/Return.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# IO.Swagger.Model.Return | ||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**_Return** | **int?** | property description *_/ ' \" =end - - \\r\\n \\n \\r | [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) | ||
|
80 changes: 80 additions & 0 deletions
80
...ient/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReturnTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r | ||
* | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - - | ||
* | ||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =end - - \\r\\n \\n \\r | ||
* Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
|
||
using NUnit.Framework; | ||
|
||
using System; | ||
using System.Linq; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using IO.Swagger.Api; | ||
using IO.Swagger.Model; | ||
using IO.Swagger.Client; | ||
using System.Reflection; | ||
using Newtonsoft.Json; | ||
|
||
namespace IO.Swagger.Test | ||
{ | ||
/// <summary> | ||
/// Class for testing Return | ||
/// </summary> | ||
/// <remarks> | ||
/// This file is automatically generated by Swagger Codegen. | ||
/// Please update the test case below to test the model. | ||
/// </remarks> | ||
[TestFixture] | ||
public class ReturnTests | ||
{ | ||
// TODO uncomment below to declare an instance variable for Return | ||
//private Return instance; | ||
|
||
/// <summary> | ||
/// Setup before each test | ||
/// </summary> | ||
[SetUp] | ||
public void Init() | ||
{ | ||
// TODO uncomment below to create an instance of Return | ||
//instance = new Return(); | ||
} | ||
|
||
/// <summary> | ||
/// Clean up after each test | ||
/// </summary> | ||
[TearDown] | ||
public void Cleanup() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Test an instance of Return | ||
/// </summary> | ||
[Test] | ||
public void ReturnInstanceTest() | ||
{ | ||
// TODO uncomment below to test "IsInstanceOfType" Return | ||
//Assert.IsInstanceOfType<Return> (instance, "variable 'instance' is a Return"); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Test the property '_Return' | ||
/// </summary> | ||
[Test] | ||
public void _ReturnTest() | ||
{ | ||
// TODO unit test for the property '_Return' | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.