-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update validation to check that file name matches id #43
Comments
should this be true for all classes or only for some specific ones, e.g. |
activity, protocol, and item are the ones that use id dereferencing on github and locally, hence those. |
I had this code snipper lying around on one of my repos if that helps. import json
import os
tested = 0
for root, _, files in os.walk("schemas", topdown=True):
for name in files:
filename = os.path.join(root, name)
with open(filename) as fp:
try:
tested += 1
data = json.load(fp)
if data["@id"] and data["@id"] != name:
raise ValueError(f"{root}/{name} does not have matching @id")
except json.decoder.JSONDecodeError:
print(f"{root}/{name} could not be loaded")
raise
if tested == 0:
raise ValueError("Zero files tested") |
@djarecka did our new reproschema model solve this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From @satra @djarecka :
"@id needs to match the filename"
"if validation is passing with this, please ask dorota to add that to the validator"
The text was updated successfully, but these errors were encountered: