oaspec/util/naming

Values

pub fn capitalize(input: String) -> String

Capitalize the first letter of a string.

pub fn deduplicate_names(names: List(String)) -> List(String)

Deduplicate a list of names by appending _2, _3, etc. to duplicates. Preserves order. First occurrence keeps original name.

pub fn operation_to_function_name(operation_id: String) -> String

Convert an OpenAPI operation ID to a valid Gleam function name.

pub fn schema_to_type_name(schema_name: String) -> String

Convert an OpenAPI schema name to a valid Gleam type name.

pub fn to_module_name(name: String) -> String

Convert an OpenAPI schema name to a valid Gleam module name.

pub fn to_pascal_case(input: String) -> String

Convert a string to PascalCase for Gleam type names. Examples: “pet_store” -> “PetStore”, “get-user” -> “GetUser”

pub fn to_snake_case(input: String) -> String

Convert a string to snake_case for Gleam function/variable names. Examples: “PetStore” -> “pet_store”, “getUserById” -> “get_user_by_id” Gleam keywords are suffixed with _ to avoid syntax errors.

Search Document