Expand description
Keyword-safe, validated construction of Rust identifiers from OpenAPI names.
OpenAPI operationIds and parameter names are free-form strings, but they
are used to name generated Rust methods, struct fields, and types. Feeding an
arbitrary string into format_ident! (i.e.
proc_macro2::Ident::new) panics when the string is not a legal
identifier — for example an op named type/async (a keyword) or one
starting with a digit. These helpers turn that panic into either a raw
identifier (type → r#type) or a clear diagnostic the caller can route
through super::operations::Diagnostics.
Functions§
- field_
ident - Keyword-safe struct-field identifier for a parameter name (snake-cased).
- keyword_
safe_ ident - Infallible keyword-safe identifier for contexts without a diagnostics channel (schema property field names).
- method_
ident - Keyword-safe method identifier for an
operationId(snake-cased). - safe_
ident - Turn an already case-converted name into a keyword-safe
Ident. - type_
ident - Validate an already-assembled type name (e.g. a synthesized query-param enum
like
ListPetsStatusQuery) and turn it into anIdent. - validate_
type_ base - Validate that an
operationIdyields a usablePascalCasebase for generated type names ({Base}Request,{Base}Response,{Base}Auth, …).