Skip to main content

Module pascal_case

Module pascal_case 

Expand description

Canonical PascalCase derivation for a schema-declared identifier (currently: procedure names, which are declared camelCase in .cstack source but need a PascalCase spelling wherever a generator emits a top-level symbol derived from one — e.g. a procedure’s generated argument-wrapper class).

Mirrors the cratestack#345 precedent in crate::route_naming: before this, cratestack-client-dart::idents::to_pascal_case and cratestack-client-typescript::naming::to_pascal_case each carried their own split_words-based implementation. Those two happened to agree, but nothing enforced that, and cratestack-parser needed the exact same transform to reserve the Dart-side generated name a builder_collisions check has to predict before codegen runs — three independent copies of the same algorithm is exactly the shape that drifted apart for to_snake_case. One canonical implementation here, reused by every consumer, closes that off structurally instead of trusting three copies to stay byte-for-byte identical by hand.

Do not reimplement this. Any code deriving a PascalCase symbol name from a schema-declared identifier must call to_pascal_case from here.

Functions§

to_pascal_case
Splits value into words on _/-/ boundaries and ASCII uppercase transitions (so echoName -> ["echo", "Name"] and already_snake -> ["already", "snake"]), then re-joins with each word’s first character uppercased and the rest lowercased.