Skip to content

Commit

Permalink
fix(crd-generator): Sort required properties to ensure deterministic …
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
baloo42 authored Apr 25, 2024
1 parent f6c56d5 commit 8a19f1f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Fix #5878: (java-generator) Update documentation to include dependencies
* Fix #5867: (crd-generator) Imply schemaFrom via JsonFormat shape (SchemaFrom takes precedence)
* Fix #5867: (java-generator) Add JsonFormat shape to date-time
* Fix #5954: (crd-generator) Sort required properties to ensure deterministic output

#### Dependency Upgrade

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ private T internalFromImpl(TypeDef definition, LinkedHashMap<String, String> vis
.collect(Collectors.toList());

swaps.throwIfUnmatchedSwaps();
return build(builder, required, validationRules, preserveUnknownFields);

List<String> sortedRequiredProperties = required.stream().sorted()
.collect(Collectors.toList());

return build(builder, sortedRequiredProperties, validationRules, preserveUnknownFields);
}

private Map<String, Method> indexPotentialAccessors(TypeDef definition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ spec:
x-kubernetes-validations:
- rule: self.startsWith('simple-')
required:
- minReplicas
- onAttributeAndGetter
- replicas
- deepLevel1
- onAttributeAndClass
- simple
- maxReplicas
- minReplicas
- multiple
- namePrefix
- onAbstractClass
- onAttributeAndClass
- onAttributeAndGetter
- onGetter
- maxReplicas
- priority
- namePrefix
- replicas
- simple
type: object
x-kubernetes-validations:
- fieldPath: .replicas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ spec:
x-kubernetes-validations:
- rule: self.startsWith('simple-')
required:
- minReplicas
- onAttributeAndGetter
- replicas
- deepLevel1
- onAttributeAndClass
- simple
- maxReplicas
- minReplicas
- multiple
- namePrefix
- onAbstractClass
- onAttributeAndClass
- onAttributeAndGetter
- onGetter
- maxReplicas
- priority
- namePrefix
- replicas
- simple
type: object
x-kubernetes-validations:
- fieldPath: .replicas
Expand Down

0 comments on commit 8a19f1f

Please sign in to comment.