oaspec/codegen/types
Types
Result of merging allOf sub-schemas.
pub type MergedAllOf {
MergedAllOf(
properties: dict.Dict(String, schema.SchemaRef),
required: List(String),
additional_properties: option.Option(schema.SchemaRef),
additional_properties_untyped: Bool,
)
}
Constructors
-
MergedAllOf( properties: dict.Dict(String, schema.SchemaRef), required: List(String), additional_properties: option.Option(schema.SchemaRef), additional_properties_untyped: Bool, )
Values
pub fn collect_operations(
ctx: context.Context,
) -> List(
#(
String,
spec.Operation(spec.SpecStage),
String,
spec.HttpMethod,
),
)
Collect all operations from the spec with their IDs, paths, and methods.
pub fn filter_read_only_properties(
schema_obj: schema.SchemaObject,
ctx: context.Context,
) -> schema.SchemaObject
Filter readOnly properties from an ObjectSchema for request body context. Returns a new schema with readOnly properties removed.
pub fn filter_write_only_properties(
schema_obj: schema.SchemaObject,
ctx: context.Context,
) -> schema.SchemaObject
Filter writeOnly properties from an ObjectSchema for response body context. Returns a new schema with writeOnly properties removed.
pub fn generate(
ctx: context.Context,
) -> List(context.GeneratedFile)
Generate type definitions from OpenAPI schemas.
pub fn merge_allof_schemas(
schemas: List(schema.SchemaRef),
ctx: context.Context,
) -> MergedAllOf
Merge allOf sub-schemas: properties, required, and additionalProperties. Non-object sub-schemas (primitives, arrays) are included as a synthetic “value” property to preserve their constraints.
pub fn schema_has_additional_properties(
schema_ref: schema.SchemaRef,
ctx: context.Context,
) -> Bool
Check if a schema has typed or untyped additionalProperties that would need Dict.
pub fn schema_has_optional_fields(
schema_ref: schema.SchemaRef,
ctx: context.Context,
) -> Bool
Check if a schema has any optional or nullable fields that would need Option.
pub fn schema_has_untyped_additional_properties(
schema_ref: schema.SchemaRef,
ctx: context.Context,
) -> Bool
Check if a schema has untyped additionalProperties (needs Dynamic import).
pub fn schema_ref_is_read_only(
ref: schema.SchemaRef,
ctx: context.Context,
) -> Bool
Check if a SchemaRef has readOnly metadata, resolving $ref if needed.
pub fn schema_ref_is_write_only(
ref: schema.SchemaRef,
ctx: context.Context,
) -> Bool
Check if a SchemaRef has writeOnly metadata, resolving $ref if needed.
pub fn schema_ref_to_type(
ref: schema.SchemaRef,
ctx: context.Context,
) -> String
Convert a SchemaRef to a Gleam type string.
pub fn schema_to_gleam_type(
schema: schema.SchemaObject,
ctx: context.Context,
) -> String
Convert a schema object to a Gleam type string. Delegates to schema_dispatch for the centralized type mapping.