Skip to content

Commit

Permalink
Change class naming convention to avoid classes collisions on collidi…
Browse files Browse the repository at this point in the history
…ng properties (objects, list). This change will result in: "spec.foo.bar":

- current: classes ["Spec", "Foo", "Bar"]
- change: classes ["Spec", "SpecFoo", "SpecFooBar"

This change is suggested by https://github.com/Avarei in apple#40 (comment)
  • Loading branch information
ichekrygin committed Oct 7, 2024
1 parent dbd5de2 commit ab5758e
Show file tree
Hide file tree
Showing 2 changed files with 410 additions and 410 deletions.
2 changes: 1 addition & 1 deletion packages/k8s.contrib.crd/internal/ModuleGenerator.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ local classSchemas: Type.TypeNames =
.fold(Map(), (accumulator: Type.TypeNames, pair) ->
let (path = pair.first)
let (schema = pair.second)
let (typeName = determineTypeName(path, path.lastOrNull?.capitalize() ?? "Item", accumulator.values.toSet(), 0))
let (typeName = determineTypeName(path, path.fold(List(), (res: List<String>, el: String) -> res.add(el.capitalize())).join(""), accumulator.values.toSet(), 0))
accumulator.put(schema, typeName)
)

Expand Down
Loading

0 comments on commit ab5758e

Please sign in to comment.