If there's no schema specified what do we do? It seems this leaves the json open to be anything.
If there's no schema specified what do we do? It seems this leaves the json open to be anything. The best we can do is make it an Any type, but to stop things getting too far out of control we wrap it in a type so that we can maintain some control over the encoding/decodng (and allow for customization).
The package path to where this is type is defined.
The name of the wrapper class.
Main workhorse.
Main workhorse. Creates case-classes from given fields.
Creates a Class/Type definition (i.e.
Creates a Class/Type definition (i.e. creates a case class or type alias).
The name of the class/type to that is created
Makes a representation of an enumeration type.
Makes a representation of an enumeration type. We model this as a "sum type" in scala, where each enum is an object that inherits from the base trait. The base trait is sealed so that it can be used for pattern matching.
Name of the enum (becomes the name of the base trait)
List of all possible enum values (encoded as a string containing their json representation)
List[Tree] containing all the definitions
Make a type from a SimpleType, when st is a built in type (i.e.
Make a type from a SimpleType, when st is a built in type (i.e. Boolean, Int, Double, String, or Null)
Makes all definitions required to define the given schema
Makes all definitions required to define the given schema
The name of the root type that represents this schema
The schema to generate from.
A package path for where this is defined. Defaults to Nil.
A tuple containing the type of the root element that is generated, and all definitions required to support it
Extracts a type from the given Schema, using schema.typ or schema.$ref.
Extracts a type from the given Schema, using schema.typ or schema.$ref. Usually this means referencing an existing type, be it a $ref or an intrinsic type.
However since Schemas can contain nested anonymous types, sometimes as a side-effect we will also create new types (via mkDef()). In this case we name the anon type based on the given defaultName
A tuple containing the Ident of the type, and a Tree of any addition class definitions that needed to be generated.
Creates type alias definitions
Creates type alias definitions
A tuple containing the created type, and a type alias definition
Json allows type disjunctions, that is: parameters that can take on instances of A OR B.
Json allows type disjunctions, that is: parameters that can take on instances of A OR B. This is modelled in scala using "sum types". Sum types wrap the allowed types (e.g. TypA(a: A), TypB(b: B)), and a common sealed base trait (e.g. Typ) to represent the union.
The name of the Union wrapper
A list of allowed sub-types
A list of definitions created to support the union type.
Makes a value definition (e.g.
Makes a value definition (e.g. val i: Int). These are used for constructing parameter lists and declaring local objects
The reflection universe.
The reflection universe. Can support macro and runtime reflection
Helper to build the model class for a given schema.
wats dis? We need an explicit type to help the type checker see that our path-dependent type of Universe, is actually the same as the one used in the main macro class. ¯\_(ツ)_/¯. #loltypes