-
Notifications
You must be signed in to change notification settings - Fork 0
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
[discussion]: Brainstorming for the different check functions to create #834
Comments
|
|
Against
Against data:
|
Miscellaneous questions:
|
|
|
So JSON Schema is a specification for checking the structure and content of JSON objects, defining expected properties, data types, constraints (like minimum values or string patterns), and formats. Here’s a draft of how it would look like: from pathlib import Path
from jsonschema import Draft7Validator, FormatChecker, ValidationError
from seedcase_sprout.core.read_json import read_json
resource_properties = {
"name": "my-resource",
"title": "My Resource",
"path": "data.csv",
}
package_properties = {
"name": "my-package",
"title": "My Package",
"resources": [resource_properties],
"created": "2024-05-14T05:00:01+00:00",
}
dp_schema = read_json(Path("schema.json"))
validator = Draft7Validator(dp_schema, format_checker=FormatChecker())
try:
validator.validate(package_properties)
except ValidationError as e:
print(
f"Error at `{e.json_path}` caused by validator `{e.validator}`: {e.message}.",
f"\nFurther context: {e.context}.",
) The error object is pretty big, but here is what a bad date would print:
( |
What would you like to discuss?
As per #826, since we won't rely on
frictionless-py
'svalidate()
function, we'll need to set up our own. As with good design, keeping the functions small and targeted is a good aim, so here's some ideas for checks to have. Add more if you think of any.This includes both verifying and validating checks. But doesn't mean we will implement them right away.
Against data package itself
Against data resources
The text was updated successfully, but these errors were encountered: