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

asdf validation error #297

Closed
wants to merge 2 commits into from
Closed

Conversation

nden
Copy link
Contributor

@nden nden commented Aug 6, 2017

The purpose of this PR is to illustrate a failing example. The schema is included here although for the example to work it should be placed under asdf-standard/schema/.../transform. The error I get is

ValidationError: mismatched tags, wanted 'tag:stsci.edu:jwst_pipeline/test_fail-1.1.0', got 'tag:stsci.edu:asdf/transform/test_fail-1.1.0'

The example to trigger the error:

from astropy.modeling import models as astmodels
from asdf import AsdfFile
from asdf.tags.transform import test_fail
fa=AsdfFile()
m=test_fail.TestFail(astmodels.Shift(1))
fa.tree['model']=m
 fa.write_to('test_fail.asdf')

If I don't specify version='1.1.0' in TestFailType, it defaults to version 1.0.0 and the error is

ValidationError: mismatched tags, wanted 'tag:stsci.edu:jwst_pipeline/test_fail-1.1.0', got 'tag:stsci.edu:asdf/transform/test_fail-1.0.0'

This only happens when a specific transform is defined in the schema, like shift-1.1.0 here. If instead the schema requires transform-1.1.0, it works. Since all schemas we have in JWST sofar need a general transform and not a specific one this error just surfaced now.

This is a simplified version of the real use case. @drdavella Do you see anything wrong with the example? If not, is this sufficient information to debug it?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 94.27% when pulling 350b49a on nden:issue-versioning into 6956b2b on spacetelescope:master.

@drdavella
Copy link
Contributor

drdavella commented Aug 7, 2017

@nden, I think the problem is that by default the standard field for a class that inherits AsdfType is asdf unless it is redefined in the child class. In this case, I believe that if you add standard = 'jwst_pipeline' to the definition of TestFailType, it should work.


class TestFailType(TransformType):
name = "transform/test_fail"
types = [TestFail]
Copy link
Contributor

Choose a reason for hiding this comment

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

Try adding standard = 'jwst_pipeline' here

@nden
Copy link
Contributor Author

nden commented Aug 7, 2017

@drdavella I was trying to make a simple example showing the problem and forgot to change the standard. However, the example here is supposed to run/work within asdf and changing the standard in the schema definition to asdf does not help. I updated the schema to use standard=asdf. It only fails if a specific model is defined in the schema (in this example shift). If I specify transform instead it works. Any other concrete transform fails.

@drdavella
Copy link
Contributor

drdavella commented Aug 7, 2017

@nden, sorry I guess I skimmed the description of your issue a little too quickly. Is the error you get still the same? The error you pasted above seems to be related to the difference in values for standard, so I'm not sure if that was the original issue or just a side effect.

The current version of the code fails because the tag is under asdf/test_fail-1.1.0 but the relative schema path is to ../asdf/transform/shift-1.1.0. which doesn't make sense. Is the tag supposed to be asdf/transform/test_fail-1.1.0?

If I change the tag, then I get a different failure which is maybe what is actually wrong.

@drdavella
Copy link
Contributor

@nden I think I might actually know what the problem is. The version field of TransformType was never bumped to 1.1.0 when the associated schemas were updated. Since ShiftType inherits from TransformType, it is also pegged at the older version 1.0.0, so the library can't find the right version of the schema.

This has been fixed on #294 and can be merged. That PR is based on #284 though, and that will need to be merged as well. I'm not sure if you want to review them quickly or whether I should just go ahead and pull them in.

@nden
Copy link
Contributor Author

nden commented Aug 7, 2017

@drdavella You are right. Bumping the version field of TransformType fixed it. I'll take a look at the PRs now.

@drdavella
Copy link
Contributor

@nden if it's easier we can just do a quick patch for the version now. I would like to get those PRs merged at some point though.

@nden nden closed this Aug 7, 2017
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.

3 participants