oaspec/openapi/dedup
Values
pub fn dedup(spec: spec.OpenApiSpec) -> spec.OpenApiSpec
Deduplicate names in the spec to avoid collisions in generated code. This is a pre-processing pass that runs after hoisting and before validation. It handles:
- Duplicate operationIds across operations
- Function/type name collisions after case conversion of operationIds Property name and enum variant deduplication is done at codegen time via dedup_property_names/1 and dedup_enum_variants/1 to preserve JSON wire names.
pub fn dedup_enum_variants(
enum_values: List(String),
) -> List(String)
Given a list of original enum values (JSON wire values), return a list of deduped PascalCase Gleam variant suffixes. The returned list is parallel to the input.
pub fn dedup_property_names(
prop_names: List(String),
) -> List(String)
Given a list of original property names (JSON wire names), return a list of deduped snake_case Gleam field names. The returned list is parallel to the input: result[i] is the Gleam name for input[i].