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

fits-schema metaschema only checks top level fits_hdu and fits_keyword #261

Open
braingram opened this issue Feb 8, 2024 · 0 comments
Open

Comments

@braingram
Copy link
Collaborator

braingram commented Feb 8, 2024

The fits-schema metaschema used for several (but not all) of the datamodel schemas does not check fits_hdu or fits_keyword if they are present in the top-most portion of the schema.

For example, the following schema will correctly fail a call to check_schema:

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/test.schema"
type: object
fits_hdu:
  - "invalid list"
fits_keyword:
  - "invalid keyword"
>>> asdf.schema.check_schema(schema)
ValidationError: ['invalid keyword'] is not of type 'string'

Failed validating 'type' in schema['allOf'][1]['properties']['fits_keyword']:
    {'type': 'string'}

On instance['fits_keyword']:
    ['invalid keyword']

However if the fits_hdu (or fits_keyword) is nested in the schema the check_schema will incorrectly pass:

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/test.schema"
type: object
properties:
  area_table:
    fits_hdu:
      - "invalid list"
    fits_keyword:
      - "invalid keyword"
>>> asdf.schema.check_schema(schema)  # passes with no ValidationError

All uses of fits_hdu and fits_keyword that I'm able to find in stdatamodels is of the second type (so the metaschema provides no validation for any of these parts of the schemas). Note that the fits_hdu and fits_keyword handling by stdatamodels (mapping model properties and fits data) is unaffected by this metaschema issue.

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

1 participant