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

[ feature request ] schema #60

Open
yonas opened this issue Jul 21, 2024 · 2 comments
Open

[ feature request ] schema #60

yonas opened this issue Jul 21, 2024 · 2 comments

Comments

@yonas
Copy link

yonas commented Jul 21, 2024

RCL is awesome. I'd like to be able to specify a schema to validate an RCL file.

I could output to JSON and write a separate JSON Schema. If RCL supported JSON Schema, I would be saved from using another tool.

If RCL has it's own schema language, that would work too.

@denfren
Copy link
Contributor

denfren commented Jul 22, 2024

Sounds the like planned record types feature will help with that.

Once you have that type you could do

let out: TYPE_HERE = { ... };
out

@ruuda
Copy link
Owner

ruuda commented Jul 24, 2024

Yep, this is exactly the idea behind the type system! It will not map 1:1 to JSON Schema, but you will be able to enforce similar things with it. The way I imagine it’s most useful is not just to validate that a value matches a schema all the way at the top level, but also to annotate intermediate values to catch errors early.

This will take some more work, I’ll keep this issue open until record types are implemented.

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

No branches or pull requests

3 participants