oas/generator/schema
This module builds ASTs from schemas. It does not do any file generation
Values
pub fn custom_type(
name: String,
properties: List(
#(String, #(lift.Schema(lift.ContentId), Bool)),
),
additional: option.Option(lift.Schema(lift.ContentId)),
required: List(String),
) -> lookup.Lookup(glance.CustomType)
Generate a custom type from an object type. TODO make private
pub fn do_to_encode_fn(
name: String,
type_: String,
top: lift.Schema(lift.Fields),
) -> lookup.Lookup(glance.Function)
pub fn fields_to_encode_body(
properties: List(
#(String, #(lift.Schema(lift.ContentId), Bool)),
),
required: List(String),
additional: option.Option(lift.Schema(lift.ContentId)),
) -> lookup.Lookup(glance.Expression)
pub fn gen_top_decoder_needs_name(
name: String,
top: lift.Schema(lift.Fields),
) -> lookup.Lookup(List(glance.Statement))
pub fn generate(
schemas: dict.Dict(String, json_schema.Schema),
) -> lookup.Lookup(
#(
List(glance.CustomType),
List(glance.TypeAlias),
List(glance.Function),
),
)
From a dictionary of schemas generate all custom types, type aliases, encoders and decoders.
pub fn to_decode_fn(
entry: #(String, lift.Schema(lift.Fields)),
) -> lookup.Lookup(glance.Function)
pub fn to_decoder(
lifted: lift.Schema(lift.ContentId),
) -> lookup.Lookup(glance.Expression)
pub fn to_encode_fn(
entry: #(String, lift.Schema(lift.Fields)),
) -> lookup.Lookup(glance.Function)
This handles top to encoder TODO make this private
pub fn to_encoder(
lifted: lift.Schema(lift.ContentId),
) -> lookup.Lookup(glance.Expression)
This handles a lifted encoder