Skip to content

Commit

Permalink
changed default sorting of samples (#19335)
Browse files Browse the repository at this point in the history
  • Loading branch information
devhl-labs authored Aug 12, 2024
1 parent ad8a7d2 commit 5166765
Show file tree
Hide file tree
Showing 102 changed files with 4,425 additions and 4,392 deletions.
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.7-allOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.7-anyOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.7-anyOfNoCompare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net4.7-formModels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ additionalProperties:
targetFramework: net47
skipFormModel: false
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
inlineSchemaOptions:
RESOLVE_INLINE_ENUMS: true
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.7-oneOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ additionalProperties:
useDateTimeForDate: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net4.7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ additionalProperties:
equatable: true
targetFramework: net47
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.8-allOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.8-anyOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.8-anyOfNoCompare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net4.8-formModels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ additionalProperties:
targetFramework: net48
skipFormModel: false
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
inlineSchemaOptions:
RESOLVE_INLINE_ENUMS: true
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net4.8-oneOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: false
equatable: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ additionalProperties:
useDateTimeForDate: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net4.8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ additionalProperties:
equatable: true
targetFramework: net48
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net8-allOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: true
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net8-anyOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: true
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net8-anyOfNoCompare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: true
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net8-formModels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ additionalProperties:
targetFramework: net8.0
skipFormModel: false
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
inlineSchemaOptions:
RESOLVE_INLINE_ENUMS: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ additionalProperties:
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net8-nrt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ additionalProperties:
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
2 changes: 2 additions & 0 deletions bin/configs/csharp-generichost-net8-oneOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ additionalProperties:
nullableReferenceTypes: true
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ additionalProperties:
useDateTimeForDate: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-net8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ additionalProperties:
equatable: true
targetFramework: net8.0
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
1 change: 1 addition & 0 deletions bin/configs/csharp-generichost-netstandard2.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ additionalProperties:
targetFramework: netstandard2.0
equatable: true
modelPropertySorting: alphabetical
operationParameterSorting: alphabetical
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ A representation of an adult

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Type** | **string** | | [optional]
**LastName** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**LastName** | **string** | | [optional]
**Type** | **string** | | [optional]
**Children** | [**List<Child>**](Child.md) | | [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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ A representation of a child

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Type** | **string** | | [optional]
**LastName** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**BoosterSeat** | **bool** | | [optional]
**LastName** | **string** | | [optional]
**Type** | **string** | | [optional]
**Age** | **int** | | [optional]
**BoosterSeat** | **bool** | | [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)

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Type** | **string** | | [optional]
**LastName** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**LastName** | **string** | | [optional]
**Type** | **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)

Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@ public void ChildInstanceTest()
}

/// <summary>
/// Test the property 'BoosterSeat'
/// Test the property 'Age'
/// </summary>
[Fact]
public void BoosterSeatTest()
public void AgeTest()
{
// TODO unit test for the property 'BoosterSeat'
// TODO unit test for the property 'Age'
}

/// <summary>
/// Test the property 'Age'
/// Test the property 'BoosterSeat'
/// </summary>
[Fact]
public void AgeTest()
public void BoosterSeatTest()
{
// TODO unit test for the property 'Age'
// TODO unit test for the property 'BoosterSeat'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public void ChildDeserializeFromPersonTest()
}

/// <summary>
/// Test the property 'Type'
/// Test the property 'FirstName'
/// </summary>
[Fact]
public void TypeTest()
public void FirstNameTest()
{
// TODO unit test for the property 'Type'
// TODO unit test for the property 'FirstName'
}

/// <summary>
Expand All @@ -92,12 +92,12 @@ public void LastNameTest()
}

/// <summary>
/// Test the property 'FirstName'
/// Test the property 'Type'
/// </summary>
[Fact]
public void FirstNameTest()
public void TypeTest()
{
// TODO unit test for the property 'FirstName'
// TODO unit test for the property 'Type'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,18 @@ public partial class Adult : Person, IValidatableObject
/// <summary>
/// Initializes a new instance of the <see cref="Adult" /> class.
/// </summary>
/// <param name="lastName">lastName</param>
/// <param name="firstName">firstName</param>
/// <param name="children">children</param>
/// <param name="firstName">firstName</param>
/// <param name="lastName">lastName</param>
[JsonConstructor]
public Adult(Option<string> lastName = default, Option<string> firstName = default, Option<List<Child>> children = default) : base(lastName, firstName)
public Adult(Option<List<Child>> children = default, Option<string> firstName = default, Option<string> lastName = default) : base(firstName, lastName)
{
ChildrenOption = children;
OnCreated();
}

partial void OnCreated();

/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new string Type { get; } = "Adult";

/// <summary>
/// Used to track the state of Children
/// </summary>
Expand All @@ -64,6 +57,13 @@ public Adult(Option<string> lastName = default, Option<string> firstName = defau
[JsonPropertyName("children")]
public List<Child> Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new Option<List<Child>>(value); } }

/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new string Type { get; } = "Adult";

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -101,10 +101,10 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert

JsonTokenType startingTokenType = utf8JsonReader.TokenType;

Option<string> type = default;
Option<string> lastName = default;
Option<string> firstName = default;
Option<List<Child>> children = default;
Option<string> firstName = default;
Option<string> lastName = default;
Option<string> type = default;

while (utf8JsonReader.Read())
{
Expand All @@ -121,38 +121,38 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert

switch (localVarJsonPropertyName)
{
case "$_type":
type = new Option<string>(utf8JsonReader.GetString());
break;
case "lastName":
lastName = new Option<string>(utf8JsonReader.GetString());
case "children":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
children = new Option<List<Child>>(JsonSerializer.Deserialize<List<Child>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "firstName":
firstName = new Option<string>(utf8JsonReader.GetString());
break;
case "children":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
children = new Option<List<Child>>(JsonSerializer.Deserialize<List<Child>>(ref utf8JsonReader, jsonSerializerOptions));
case "lastName":
lastName = new Option<string>(utf8JsonReader.GetString());
break;
case "$_type":
type = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}

if (type.IsSet && type.Value == null)
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult.");

if (lastName.IsSet && lastName.Value == null)
throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult.");
if (children.IsSet && children.Value == null)
throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult.");

if (firstName.IsSet && firstName.Value == null)
throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Adult.");

if (children.IsSet && children.Value == null)
throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult.");
if (lastName.IsSet && lastName.Value == null)
throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult.");

if (type.IsSet && type.Value == null)
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult.");

return new Adult(lastName, firstName, children);
return new Adult(children, firstName, lastName);
}

/// <summary>
Expand All @@ -179,28 +179,27 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions)
{
if (adult.LastNameOption.IsSet && adult.LastName == null)
throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult.");

if (adult.FirstNameOption.IsSet && adult.FirstName == null)
throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult.");

if (adult.ChildrenOption.IsSet && adult.Children == null)
throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult.");

writer.WriteString("$_type", adult.Type);

if (adult.LastNameOption.IsSet)
writer.WriteString("lastName", adult.LastName);
if (adult.FirstNameOption.IsSet && adult.FirstName == null)
throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult.");

if (adult.FirstNameOption.IsSet)
writer.WriteString("firstName", adult.FirstName);
if (adult.LastNameOption.IsSet && adult.LastName == null)
throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult.");

if (adult.ChildrenOption.IsSet)
{
writer.WritePropertyName("children");
JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions);
}
if (adult.FirstNameOption.IsSet)
writer.WriteString("firstName", adult.FirstName);

if (adult.LastNameOption.IsSet)
writer.WriteString("lastName", adult.LastName);

writer.WriteString("$_type", adult.Type);
}
}
}
Loading

0 comments on commit 5166765

Please sign in to comment.