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

Confusing behavior when using older version of dandischema #134

Open
jjnesbitt opened this issue Apr 27, 2022 · 1 comment
Open

Confusing behavior when using older version of dandischema #134

jjnesbitt opened this issue Apr 27, 2022 · 1 comment

Comments

@jjnesbitt
Copy link
Member

When using a version of dandischema that's behind DANDI_SCHEMA_VERSION, the local schema is not used, but rather the schema is fetched from dandischema releases. The code shown below is where this occurs

if schema_version == DANDI_SCHEMA_VERSION:
klass = getattr(models, schema_key)
schema = klass.schema()
else:
if schema_key not in schema_map:
raise ValueError(
"Only dandisets and assets can be validated "
"using json schema for older versions"
)
schema_filename = schema_map[schema_key]
schema = requests.get(
f"https://raw.githubusercontent.com/dandi/schema/"
f"master/releases/{schema_version}/{schema_filename}"
).json()

This is rather confusing behavior if you're relying on modifications to the local schema, like using localhost urls, since the schema that is used for validation will be independent of any changes you have. Is there some way this can be improved?

@satra
Copy link
Member

satra commented Apr 27, 2022

@AlmightyYakob - if you are making changes to the schema, then the schema version has to be updated in consts.py. a prior schema version does not correspond to the current schema. the pydantic branch of the code only validates against the current schema.

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

2 participants