Skip to main content

Module naming

Module naming 

Source
Expand description

Method-name -> Rust-identifier derivation, ported from build_combined_schema.py. Naming here must exactly match what typify names the corresponding generated Rust types/enum variants - this was empirically cross-validated against real typify output when this crate was first built, so keep it in lock-step with the Python original rather than “simplifying”.

Constants§

KNOWN_VOID_RESPONSE_METHODS 🔒
Methods confirmed (by hand, against the schema) to genuinely have no response payload / no params - NOT “our heuristic failed to find one.” Anything else the heuristics can’t resolve is a hard build-time error, so a future codex schema change that introduces a new shape breaks the build loudly instead of silently generating wrong code (dropped params, dropped response data). See README.md “Regenerating the schema”.
RESPONSE_OVERRIDES
Known irregular method -> response-type-name mappings the naming convention can’t derive (see crates/shared/codex-app-server-client/README.md for how these were discovered).

Functions§

camel_token_regex 🔒
camel_tokens
Splits a single camelCase/PascalCase word into lowercase tokens, treating runs of consecutive capitals as an acronym token of their own (e.g. "HTTPServer" -> ["http", "server"]). Exact regex ported from build_combined_schema.py: [A-Z]?[a-z0-9]+|[A-Z]+(?=[A-Z]|$).
fuzzy_response_match
Finds a *Response definition whose name’s tokens are a superset of the method’s tokens, preferring the shortest match. Bails if two or more candidates tie for shortest - an unresolvable ambiguity, not something to silently guess at (a future codex schema change that introduces a second plausible *Response name for some method should break the build, not silently wire that method to whichever candidate happened to sort first). A single strictly-shortest candidate is treated as an unambiguous match even when longer candidates also exist.
method_to_pascal
PascalCase derived from a /- and _-delimited method name, e.g. "thread/start" -> "ThreadStart". Only the first character of each segment is uppercased; the rest of the segment is left untouched (so already-camelCase segments like "mcpServer" become "McpServer", not "MCPSERVER" or "Mcpserver").
method_to_snake_fn
snake_case function name derived from a method name, e.g. "item/tool/requestUserInput" -> "item_tool_request_user_input".
resolve_response
Resolves a method’s response type name: RESPONSE_OVERRIDES, then the {PascalMethod}Response naming convention, then a fuzzy token-subset match, then KNOWN_VOID_RESPONSE_METHODS. Hard-fails (matching the Python original’s resolve_response) if none of those resolve it, so a future codex schema change with a genuinely new naming shape breaks the build loudly instead of silently generating wrong code.
response_override 🔒