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

custom ASDF validators #40

Closed
CagtayFabry opened this issue Jun 5, 2020 · 1 comment
Closed

custom ASDF validators #40

CagtayFabry opened this issue Jun 5, 2020 · 1 comment
Labels
ASDF everything ASDF related (python + schemas) discussion

Comments

@CagtayFabry
Copy link
Member

CagtayFabry commented Jun 5, 2020

some thoughts and ideas regarding implementations of custom ASDF validators

handling $ref

any validation keywords that are on the level of a $ref: statement seem to be dropped (validation does not get triggerd)
example:

properties:
  length_prop:
    $ref: tag:stsci.edu:asdf/unit/quantity-1.1.0
    wx_unit: "s" # this does not trigger a validator on wx_unit
wx_unit:
  length_prop: "m" # this works as expected

See asdf-format/asdf#814 for details and workaround using tag validator

type: object
properties:
  quantity_prop:
    description: |
      a simple quantity with custom validator
    tag: tag:stsci.edu:asdf/unit/quantity-1.1.0
    wx_unit: "s"

registering validators

apparently registering a validator for one class might enable the validator on a global extension level. This might be useful but we should check "overriding" validator keywords with different functions for seperate classes.

See asdf-format/asdf#815 (comment) for explanation of current implementation

handling anyOf / oneOf

UPDATE: this was fixed by defining better (tighter) restrictions on anyOf subtypes (i.e. well defined required with additionalProperties: false)
Use of oneOf is encouraged once asdf-format/asdf#811 is available (see asdf-format/asdf#809)

@CagtayFabry CagtayFabry added discussion ASDF everything ASDF related (python + schemas) labels Jun 5, 2020
@CagtayFabry
Copy link
Member Author

Closing for now since most of the issues have been solved or implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASDF everything ASDF related (python + schemas) discussion
Projects
None yet
Development

No branches or pull requests

1 participant