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

Add json schema for combined pp yaml #19

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

singhd789
Copy link
Contributor

  • the combined post-processing yaml needs to be validated with a json schema
  • schema was added to the FRE folder

"pp_components": {"type":"string"}
"history_segment": {
"description": "Amount of time covered by a single history file (ISO8601 datetime)",
"type":"string"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dana, this looks great. Is it possible to define a custom "type" for the schema, do you know? That would be the best case scenario, if it were possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm not sure. What would you want the type to be? Or do you mean custom as in it could be multiple types?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ISO8601 dates and durations would be great to validate, but seem hard to validate beyond "string". An enumerated list wouldn't quite work, since there are so many possibilities.

The way we "validate" the dates and durations now is attempt to parse it with metomi.isodatetime.parsers and check if it succeeds or fails.

It would be great to catch typos like "P1M"/"PM1" during validation, but it may not be possible.

Copy link
Contributor Author

@singhd789 singhd789 Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. It does look like you can specify specific values: https://www.tutorialspoint.com/yaml/yaml_json_schema.htm

we can have a list of values that would work maybe

@J-Lentz might know more on this too!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regular expression matching would be really nice.. let's keep an eye out for that.

Copy link
Contributor Author

@singhd789 singhd789 Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha!! Uriel coming in clutch in a previous commit he's done:
646e68c

https://json-schema.org/understanding-json-schema/reference/regular_expressions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic. Enumerations and regular expressions are about all what we had for the XML schema, I think.

@ceblanton
Copy link
Contributor

Looks great so far, and pretty legible too. I'll add the analysis schema here.

what about required or not? Is that a notion in json/yaml schemas?

@singhd789
Copy link
Contributor Author

Looks great so far, and pretty legible too. I'll add the analysis schema here.

what about required or not? Is that a notion in json/yaml schemas?

Yes! Here's an example in an FMS schema:

"required": ["next_file_name", "prev_file_name"],

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

Successfully merging this pull request may close these issues.

2 participants