Utils
Shared utility helpers for the OpenAPI generator.
This module centralizes the small transformations used while rendering generated TypeScript, including operation-name normalization, optional description handling, safe JSDoc comment emission, and direct array merging for code-generation accumulators.
Converting
Signature
declare function camelize(self: string): string;identifier
Converts an OpenAPI operation id into the exported operation identifier used by generated TypeScript modules.
Signature
declare function identifier(operationId: string): Capitalize<string>;Renders an optional description as a JSDoc block for generated TypeScript.
Details
Returns an empty string when the description is absent and escapes any closing comment marker so generated source remains syntactically valid.
Signature
declare const toComment: (self: string | undefined) => string;Filtering
nonEmptyString
Extracts a trimmed, non-empty string from an unknown value.
Details
Returns undefined for non-string values and for strings containing only whitespace.
Signature
declare function nonEmptyString(a: unknown): string | undefined;Mutations
spreadElementsInto
Appends every element from source into destination in order.
Details
This mutates destination directly, which avoids allocating an intermediate array when generator code needs to merge collections.
Signature
declare function spreadElementsInto<A>(source: Array<A>, destination: Array<A>): void;
Converts an OpenAPI name into the generator's camel-case form.
Details
Separators are removed, leading digits are ignored, and letters following a separator or digit are upper-cased without otherwise changing letter casing.