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

allow extra keywords in structured datatype validation #1901

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

braingram
Copy link
Contributor

@braingram braingram commented Feb 7, 2025

Description

The ndarray schema doesn't prevent additional keywords in datatype definitions for structured datatypes.
https://github.com/asdf-format/asdf-standard/blob/c17c3ecabcad7b65e41e0fb79054988b37f45a38/resources/schemas/stsci.edu/asdf/core/ndarray-1.1.0.yaml#L214

For example, adding a description to a sub-datatype doesn't violate the schema:

       datatype:
         - name: a
           description: a description
           datatype: int8

However it fails the custom datatype validation in asdf.

This PR updates the custom datatype validator to only compare a selection of datatype keys {"name", "datatype", "byteorder", "shape"}. This allows adding descriptions to sub-datatypes.

Fixes #1900

Tasks

  • run pre-commit on your machine
  • run pytest on your machine
  • Does this PR add new features and / or change user-facing code / API? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • update relevant docstrings and / or docs/ page
    • for any new features, add unit tests
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: bug fix
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change

@braingram braingram marked this pull request as ready for review February 7, 2025 21:17
@braingram braingram requested a review from a team as a code owner February 7, 2025 21:17
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.

datatype validator is overly strict and doesn't allow extra schema items
1 participant