Skip to content

Commit

Permalink
fixed sorting (#18706)
Browse files Browse the repository at this point in the history
  • Loading branch information
devhl-labs authored May 26, 2024
1 parent af090fd commit ee3ff39
Show file tree
Hide file tree
Showing 75 changed files with 15,267 additions and 2,687 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
Expand Down Expand Up @@ -456,7 +453,7 @@ public CodegenModel fromModel(String name, Schema model) {
}

// avoid breaking changes
if (GENERICHOST.equals(getLibrary())) {
if (GENERICHOST.equals(getLibrary()) && codegenModel != null) {

Collections.sort(codegenModel.vars, propertyComparatorByName);
Collections.sort(codegenModel.allVars, propertyComparatorByName);
Expand Down Expand Up @@ -485,17 +482,8 @@ public int compare(CodegenProperty one, CodegenProperty another) {
}
};

public static Comparator<CodegenProperty> propertyComparatorByNotNullableRequiredNoDefault = new Comparator<CodegenProperty>() {
@Override
public int compare(CodegenProperty one, CodegenProperty another) {
if (one.isNullable == another.isNullable && one.required == another.required && (one.defaultValue == null) == (another.defaultValue == null))
return 0;
else if (!one.isNullable && one.required && one.defaultValue == null)
return -1;
else
return 1;
}
};
public static Comparator<CodegenProperty> propertyComparatorByNotNullableRequiredNoDefault =
Comparator.comparing(p -> p.isNullable || !p.required || p.defaultValue != null);

public static Comparator<CodegenParameter> parameterComparatorByDataType = new Comparator<CodegenParameter>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2752,4 +2752,106 @@ components:
a_objVariableobject:
type: array
items:
$ref: '#/components/schemas/Custom-Variableobject-Response'
$ref: '#/components/schemas/Custom-Variableobject-Response'
# this class ensures that the CodegenProperties are sorted correctly
# https://github.com/OpenAPITools/openapi-generator/issues/18607
MixLog:
type: object
properties:
id:
$ref: '#/components/schemas/uuid'
description:
type: string
mixDate:
type: string
format: date-time
shopId:
$ref: '#/components/schemas/uuid'
totalPrice:
type: number
format: float
nullable: true
totalRecalculations:
type: integer
format: int32
totalOverPoors:
type: integer
format: int32
totalSkips:
type: integer
format: int32
totalUnderPours:
type: integer
format: int32
formulaVersionDate:
type: string
format: date-time
someCode:
type: string
nullable: true
description: SomeCode is only required for color mixes
batchNumber:
type: string
brandCode:
type: string
description: BrandCode is only required for non-color mixes
brandId:
type: string
description: BrandId is only required for color mixes
brandName:
type: string
description: BrandName is only required for color mixes
categoryCode:
type: string
description: CategoryCode is not used anymore
color:
type: string
description: Color is only required for color mixes
colorDescription:
type: string
comment:
type: string
commercialProductCode:
type: string
productLineCode:
type: string
description: ProductLineCode is only required for color mixes
country:
type: string
createdBy:
type: string
createdByFirstName:
type: string
createdByLastName:
type: string
deltaECalculationRepaired:
type: string
deltaECalculationSprayout:
type: string
ownColorVariantNumber:
nullable: true
type: integer
format: int32
primerProductId:
type: string
productId:
type: string
description: ProductId is only required for color mixes
productName:
type: string
description: ProductName is only required for color mixes
selectedVersionIndex:
type: integer
format: int32
required:
- id
- description
- mixDate
- totalRecalculations
- totalOverPoors
- totalSkips
- totalUnderPours
- formulaVersionDate
uuid:
type: string
format: uuid
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ docs/models/LiteralStringClass.md
docs/models/Mammal.md
docs/models/MapTest.md
docs/models/MapTestMapOfEnumStringValue.md
docs/models/MixLog.md
docs/models/MixedPropertiesAndAdditionalPropertiesClass.md
docs/models/Model200Response.md
docs/models/ModelClient.md
Expand Down Expand Up @@ -215,6 +216,7 @@ src/Org.OpenAPITools/Model/LiteralStringClass.cs
src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs
src/Org.OpenAPITools/Model/MixLog.cs
src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Model200Response.cs
src/Org.OpenAPITools/Model/ModelClient.cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,108 @@ components:
- a_objVariableobject
- pkiNotificationtestID
type: object
MixLog:
properties:
id:
format: uuid
type: string
description:
type: string
mixDate:
format: date-time
type: string
shopId:
format: uuid
type: string
totalPrice:
format: float
nullable: true
type: number
totalRecalculations:
format: int32
type: integer
totalOverPoors:
format: int32
type: integer
totalSkips:
format: int32
type: integer
totalUnderPours:
format: int32
type: integer
formulaVersionDate:
format: date-time
type: string
someCode:
description: SomeCode is only required for color mixes
nullable: true
type: string
batchNumber:
type: string
brandCode:
description: BrandCode is only required for non-color mixes
type: string
brandId:
description: BrandId is only required for color mixes
type: string
brandName:
description: BrandName is only required for color mixes
type: string
categoryCode:
description: CategoryCode is not used anymore
type: string
color:
description: Color is only required for color mixes
type: string
colorDescription:
type: string
comment:
type: string
commercialProductCode:
type: string
productLineCode:
description: ProductLineCode is only required for color mixes
type: string
country:
type: string
createdBy:
type: string
createdByFirstName:
type: string
createdByLastName:
type: string
deltaECalculationRepaired:
type: string
deltaECalculationSprayout:
type: string
ownColorVariantNumber:
format: int32
nullable: true
type: integer
primerProductId:
type: string
productId:
description: ProductId is only required for color mixes
type: string
productName:
description: ProductName is only required for color mixes
type: string
selectedVersionIndex:
format: int32
type: integer
required:
- description
- formulaVersionDate
- id
- mixDate
- totalOverPoors
- totalRecalculations
- totalSkips
- totalUnderPours
type: object
uuid:
format: uuid
type: string
_foo_get_default_response:
example:
string:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Org.OpenAPITools.Model.MixLog

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Description** | **string** | |
**FormulaVersionDate** | **DateTime** | |
**Id** | **Guid** | |
**MixDate** | **DateTime** | |
**TotalOverPoors** | **int** | |
**TotalRecalculations** | **int** | |
**TotalSkips** | **int** | |
**TotalUnderPours** | **int** | |
**BatchNumber** | **string** | | [optional]
**BrandCode** | **string** | BrandCode is only required for non-color mixes | [optional]
**BrandId** | **string** | BrandId is only required for color mixes | [optional]
**BrandName** | **string** | BrandName is only required for color mixes | [optional]
**CategoryCode** | **string** | CategoryCode is not used anymore | [optional]
**Color** | **string** | Color is only required for color mixes | [optional]
**ColorDescription** | **string** | | [optional]
**Comment** | **string** | | [optional]
**CommercialProductCode** | **string** | | [optional]
**Country** | **string** | | [optional]
**CreatedBy** | **string** | | [optional]
**CreatedByFirstName** | **string** | | [optional]
**CreatedByLastName** | **string** | | [optional]
**DeltaECalculationRepaired** | **string** | | [optional]
**DeltaECalculationSprayout** | **string** | | [optional]
**OwnColorVariantNumber** | **int** | | [optional]
**PrimerProductId** | **string** | | [optional]
**ProductId** | **string** | ProductId is only required for color mixes | [optional]
**ProductLineCode** | **string** | ProductLineCode is only required for color mixes | [optional]
**ProductName** | **string** | ProductName is only required for color mixes | [optional]
**SelectedVersionIndex** | **int** | | [optional]
**ShopId** | **Guid** | | [optional]
**SomeCode** | **string** | SomeCode is only required for color mixes | [optional]
**TotalPrice** | **float** | | [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 @@ -15,17 +15,6 @@ Name | Type | Description | Notes
**RequiredNotnullableStringProp** | **string** | |
**RequiredNotnullableUuid** | **Guid** | |
**RequiredNotnullableintegerProp** | **int** | |
**RequiredNullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNullableBooleanProp** | **bool** | |
**RequiredNullableDateProp** | **DateOnly** | |
**RequiredNullableDatetimeProp** | **DateTime** | |
**RequiredNullableEnumInteger** | **RequiredClassRequiredNullableEnumInteger** | |
**RequiredNullableEnumIntegerOnly** | **RequiredClassRequiredNullableEnumIntegerOnly** | |
**RequiredNullableEnumString** | **RequiredClassRequiredNullableEnumString** | |
**RequiredNullableIntegerProp** | **int** | |
**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | |
**RequiredNullableStringProp** | **string** | |
**RequiredNullableUuid** | **Guid** | |
**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNotnullableintegerProp** | **int** | | [optional]
**NotRequiredNullableDateProp** | **DateOnly** | | [optional]
Expand All @@ -48,6 +37,17 @@ Name | Type | Description | Notes
**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional]
**NotrequiredNullableStringProp** | **string** | | [optional]
**NotrequiredNullableUuid** | **Guid** | | [optional]
**RequiredNullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNullableBooleanProp** | **bool** | |
**RequiredNullableDateProp** | **DateOnly** | |
**RequiredNullableDatetimeProp** | **DateTime** | |
**RequiredNullableEnumInteger** | **RequiredClassRequiredNullableEnumInteger** | |
**RequiredNullableEnumIntegerOnly** | **RequiredClassRequiredNullableEnumIntegerOnly** | |
**RequiredNullableEnumString** | **RequiredClassRequiredNullableEnumString** | |
**RequiredNullableIntegerProp** | **int** | |
**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | |
**RequiredNullableStringProp** | **string** | |
**RequiredNullableUuid** | **Guid** | |

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

Loading

0 comments on commit ee3ff39

Please sign in to comment.