nori/codegen/ir_builder
Transforms an OpenAPI Document into a language-agnostic CodegenIR.
This is the bridge between the parsed OpenAPI spec and code generators.
Types
Choices that change the shape of the generated types. The defaults keep the output of earlier releases, so turning one on is a change a consumer opts in to.
pub type BuildOptions {
BuildOptions(inline_enums: Bool, single_option: Bool)
}
Constructors
-
BuildOptions(inline_enums: Bool, single_option: Bool)Arguments
- inline_enums
-
Give an inline
enumon a property (or an array’s items) a named enum type, instead ofString. - single_option
-
A property that is optional and also nullable becomes one
Optioninstead ofOption(Option(_)). Absent andnullboth decode toNone, so the type no longer tells them apart.
Values
pub fn build(doc: document.Document) -> ir.CodegenIR
Builds a CodegenIR from a parsed OpenAPI Document.
pub fn build_with(
doc: document.Document,
options: BuildOptions,
) -> ir.CodegenIR
Builds a CodegenIR with the given options.
pub fn default_options() -> BuildOptions
pub fn schema_to_typedef(
name: String,
s: schema.Schema,
) -> ir.TypeDef
Without the document’s components, an allOf member that is a $ref
cannot be resolved and contributes no fields. Use the IR builder on a whole
document when a schema extends another one.
pub fn schema_type_to_typeref(s: schema.Schema) -> ir.TypeRef