YAML.jl
YAML.jl copied to clipboard
The design of the implementation of schemata
YAML.jl implements its default schema by constructor and resolver. In order to allow users to select a schema when parsing, a struct representing the schema is necessary. Such struct will be a struct holding a constructor and a resolver:
struct Schema
constructor::Constructor
resolver::Resolver
end
Such schema should be able to be defined by users. We export the main three schemata (failsafe, JSON, Core) and the YAML.jl v0.4.10 schema, then users select when parsing:
YAML.parse(x, schema=FailsafeSchema)
YAML.parse(x) # pass YAML.jl v0.4.10 schema as a default for a while
Currently (v0.4.10), users can only select constructors in keyword arguments.
We will soon need a breaking change to allow passing a schema to load instead of a constructor because the concept schema includes constructor.