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, #(Schema(Int), Bool))),
  additional: Option(Schema(Int)),
  required: List(String),
  module: Module,
) -> CustomType

Generate a custom type from an object type. TODO make private

pub fn encode_fn(name: String) -> String
pub fn fields_to_encode_body(
  properties: List(#(String, #(Schema(Int), Bool))),
  required: List(String),
  additional: Option(Schema(Int)),
  module: Module,
) -> Expression
pub fn gen_top_decoder_needs_name(
  name: String,
  top: Schema(Fields),
  module: Module,
) -> List(Statement)
pub fn generate(
  schemas: Dict(String, Schema),
) -> #(List(CustomType), List(TypeAlias), List(Function))

From a dictionary of schemas generate all custom types, type aliases, encoders and decoders.

pub fn to_decode_fn(
  entry: #(String, Schema(Fields)),
  module: Module,
) -> Function
pub fn to_decoder(
  lifted: Schema(Int),
  module: Module,
) -> Expression
pub fn to_encode_fn(
  entry: #(String, Schema(Fields)),
  module: Module,
) -> Function

This handles top to encoder TODO make this private

pub fn to_encoder(
  lifted: Schema(Int),
  module: Module,
) -> Expression

This handles a lifted encoder

Search Document