Skip to content

schemas.jsonschema.codegen #

fn param_to_schema #

fn param_to_schema(param Param) SchemaRef

fn ref_to_field #

fn ref_to_field(schema_ref SchemaRef, name string) StructField

fn ref_to_symbol #

fn ref_to_symbol(reference Reference) string

fn ref_to_type_from_reference #

fn ref_to_type_from_reference(reference Reference) Type

fn schema_to_code #

fn schema_to_code(schema Schema) CodeItem

fn schema_to_struct #

fn schema_to_struct(schema Schema) Struct

fn schema_to_structs #

fn schema_to_structs(schema Schema) []string

schema_to_structs encodes a schema into V structs. if a schema has nested object type schemas or defines object type schemas, recursively encodes object type schemas and pushes to the array of structs. returns an array of schemas that have been encoded into V structs.

fn schema_to_type #

fn schema_to_type(schema Schema) Type

schema_to_type generates a typesymbol for the schema

fn schema_to_v #

fn schema_to_v(schema Schema) string

fn schemaref_to_type #

fn schemaref_to_type(schema_ref SchemaRef) Type

fn struct_to_schema #

fn struct_to_schema(struct_ Struct) SchemaRef

struct_to_schema generates a json schema or reference from a struct model

fn sumtype_to_schema #

fn sumtype_to_schema(sumtype code.Sumtype) SchemaRef

struct_to_schema generates a json schema or reference from a struct model

fn type_to_schema #

fn type_to_schema(typ Type) SchemaRef

fn typesymbol_to_schema #

fn typesymbol_to_schema(symbol_ string) SchemaRef

typesymbol_to_schema receives a typesymbol, if the typesymbol belongs to a user defined struct it returns a reference to the schema, else it returns a schema for the typesymbol