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

Schema validation support #823

Closed
SlyckLizzie opened this issue Jul 2, 2023 · 10 comments
Closed

Schema validation support #823

SlyckLizzie opened this issue Jul 2, 2023 · 10 comments

Comments

@SlyckLizzie
Copy link

Are there any plans to support schema validation?

@EdwardCooke
Copy link
Collaborator

Can you describe your use case and what you would expect the library to do in terms of schema validation.

@SlyckLizzie
Copy link
Author

SlyckLizzie commented Jul 4, 2023

I was thinking of something along the lines of how JSON or XML schemas are validated. One would provide a YAML schema similar to the now archived one at stsci.edu and call a Validate method from the YamlDotNet tool. Validate would accept a YAML and a YAML schema and validate if the YAML matches the schema.

@EdwardCooke
Copy link
Collaborator

I know i personally don’t have the available time to work on something this large right now. If you wanted to work on this, we’re always open to pull requests. I’d want to follow the json schema spec as closely as possible and not deviate from it unless necessary. I’d probably do a different class/interface for the validator due to the complexity. They also serve two different purposes. Let me think about this a little more, but it would be something that I personally couldn’t do right now and would need to be built by the community.

@SlyckLizzie
Copy link
Author

SlyckLizzie commented Jul 5, 2023

Why would you want to follow the schema specification of a different language? In my opinion that is asking for trouble, Not only are you bound to the whims of that language changing, there is no guarantee that the json specification will be a semi-decent fit for YAML in the future

@EdwardCooke
Copy link
Collaborator

Because yaml and json are very similar and mostly cross compatible. It’s also an existing standard that is widely used and understood. I would rather not reinvent the wheel unless there is some reason to do so, and where there is an existing spec that we can use, not sure we want to do that.

FYI, the repo you linked used the json schema spec as the baseline for that particular project.

@SlyckLizzie
Copy link
Author

SlyckLizzie commented Jul 5, 2023

I, unfortunately, do not share the same viewpoint when it comes to re-using another language specification to validate YAML. It tightly couples the two together. STSCI has the correct idea, base it off of another language because it's similar but don't just steal it verbatim. So if I do decide to work on this then it will be using the STSCI format (or close to it). That way if there is ever a future deviation of the YAML language specification, this will already be setup. It's a shame, really, that no schema definition exists for a "markup" language that is 20+ years old.

@EdwardCooke
Copy link
Collaborator

I’m not saying steal it. Just use it as the basis and modify where necessary. Exactly what they did in that repo, though it didn’t look like it did any actual validation in there, just transformed the json schema spec file and made it a yaml file. I haven’t had much time to really dig into this due to other obligations and work. It’s just my initial thoughts.

@SlyckLizzie
Copy link
Author

I'll try and throw something together and see is anything comes of it.

@EdwardCooke
Copy link
Collaborator

Were you able to do anything with this request? Or can I close it?

@SlyckLizzie
Copy link
Author

SlyckLizzie commented Aug 10, 2023

apologies, I am not done with it. Feel free to close this out and I will submit a PR when I am further along :)

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