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

adding custom validators using new extension API #1012

Closed
CagtayFabry opened this issue Aug 5, 2021 · 5 comments
Closed

adding custom validators using new extension API #1012

CagtayFabry opened this issue Aug 5, 2021 · 5 comments

Comments

@CagtayFabry
Copy link
Contributor

What is the correct way to register custom validators now with the new extension API?

The documentation only mentions this in the deprecated old API section.
https://asdf.readthedocs.io/en/latest/asdf/extending/legacy.html#adding-custom-validators

@perrygreenfield
Copy link
Contributor

perrygreenfield commented Aug 5, 2021

Does the material under Extending ASDF answer your question, particularly in the subsections Resources and resource mappings, Converters, Extensions, and Extension manifests?

I didn't read carefully enough. Ed is on vacation until the end of next week, but I'll see if I can find a specific answer.

@CagtayFabry
Copy link
Contributor Author

We are looking into the steps necessary to move everything over to the new API so I looked through the new material (which is great btw.)

The validators do not get mentioned from what I see and from a few short looks over the new code I could not see where the validator hooks would be now.
We are just testing a few things so no hurry, but if there is a way would be great to transfer that over too.

@eslavich
Copy link
Contributor

This feature hasn't been implemented in the new API yet, but it's something we'll need to support. There's been some discussion of how we might implement it: #815 (comment)

We need to put some thought into how we can restrict the scope of custom validators (maybe based on the schema's metaschema id) to avoid conflicts.

@CagtayFabry
Copy link
Contributor Author

thanks for looking into that (and digging out some of the older issues)

I have switched everything over to the new API (which works really well) and just left an 'empty' legacy extension without any tag mappings to register the validators, seems to work nice so far 👍

braingram added a commit to braingram/asdf that referenced this issue Jan 3, 2023
old style (legacy) extensions allowed for custom validators,
functions called when a particular schema keyword was encountered
(see CustomType.validators).

This PR introduces a similar feature for new style Extensions
where custom validators can be defined in Extension.validators.

The scope of the validators is global (same as legacy validators).

fixes asdf-format#1012
braingram added a commit to braingram/asdf that referenced this issue Jan 3, 2023
old style (legacy) extensions allowed for custom validators,
functions called when a particular schema keyword was encountered
(see CustomType.validators).

This PR introduces a similar feature for new style Extensions
where custom validators can be defined in Extension.validators.

The scope of the validators is global (same as legacy validators).

fixes asdf-format#1012

update changelog

change raise to yield
braingram added a commit to braingram/asdf that referenced this issue Jan 5, 2023
old style (legacy) extensions allowed for custom validators,
functions called when a particular schema keyword was encountered
(see CustomType.validators).

This PR introduces a similar feature for new style Extensions
where custom validators can be defined in Extension.validators.

The scope of the validators is global (same as legacy validators).

fixes asdf-format#1012

update changelog

change raise to yield
WilliamJamieson pushed a commit to braingram/asdf that referenced this issue Jan 6, 2023
old style (legacy) extensions allowed for custom validators,
functions called when a particular schema keyword was encountered
(see CustomType.validators).

This PR introduces a similar feature for new style Extensions
where custom validators can be defined in Extension.validators.

The scope of the validators is global (same as legacy validators).

fixes asdf-format#1012

update changelog

change raise to yield
@CagtayFabry
Copy link
Contributor Author

closed via #1050

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 a pull request may close this issue.

3 participants