YAML.jl icon indicating copy to clipboard operation
YAML.jl copied to clipboard

The design of the implementation of schemata

Open Paalon opened this issue 1 year ago • 1 comments

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.

Paalon avatar Jun 12 '24 13:06 Paalon

We will soon need a breaking change to allow passing a schema to load instead of a constructor because the concept schema includes constructor.

Paalon avatar Jun 16 '24 13:06 Paalon