Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The design of the implementation of schemata #170

Open
Paalon opened this issue Jun 12, 2024 · 1 comment
Open

The design of the implementation of schemata #170

Paalon opened this issue Jun 12, 2024 · 1 comment

Comments

@Paalon
Copy link
Contributor

Paalon commented Jun 12, 2024

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
Copy link
Contributor Author

Paalon commented Jun 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants