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

add basic asdf string-like tags #581

Open
CagtayFabry opened this issue Oct 6, 2021 · 3 comments
Open

add basic asdf string-like tags #581

CagtayFabry opened this issue Oct 6, 2021 · 3 comments
Labels
ASDF everything ASDF related (python + schemas) discussion

Comments

@CagtayFabry
Copy link
Member

since tagging strings is easy and having tags can be used to search files etc. we could add some more 'base' classes that simply inherit from string and represent special string styles

some ideas:

  • DOI
  • ISO (or other) standards
  • URLs, URNs

since I imagine most users don't want to be bothered instancing new classes to specify their strings this would probably only be usable if we auto-convert strings using regex matches or similar when serializing (which I am not sure we are able to do and might have a massive performance impact)

@CagtayFabry CagtayFabry added the ASDF everything ASDF related (python + schemas) label Oct 6, 2021
@vhirtham
Copy link
Collaborator

vhirtham commented Oct 7, 2021

Not sure if it causes more trouble than benefit. Apart from having a searchable tag, what else do we gain? Also, it is most likely that those items are already stored with a corresponding key that can be searched for too. On the downside, we have to maintain additional schemas and python functions. Even if the maintenance overhead is small, I am currently not convinced that we get a real benefit out of it. In the end, a string is a string, and if its purpose can either be deduced from the content or a corresponding key in the file. I do not see the need to further categorize the different types of strings.

The only reason for me to consider this would be if we can actually do something with those wrapper classes. For example, let Python fetch some metadata using the DOI.

@CagtayFabry
Copy link
Member Author

two advantages besides searching that come to my mind:

  • if we have schemas/tags we can implement regex pattern etc. to make sure the fields are in a valid format
  • personally I like having tags in the file to show the intended class/meaning of a node :)

To start it is probably enough to add the schemas with (without tag implementations) and if we want to enforce field in other schemas we can use $ref

For a python implementation I would imagine it would be as simple as having a mapping between tag names and regex patterns to match but we don't have to worry about that now, not really a high priority :)

@vhirtham
Copy link
Collaborator

vhirtham commented Oct 7, 2021

  • if we have schemas/tags we can implement regex pattern etc. to make sure the fields are in a valid format

This should also be possible using custom validators (wx_doi or wx_regex)

  • personally I like having tags in the file to show the intended class/meaning of a node :)

Not really an advantage but a matter of taste here 😉 The key of a string object should already provide that information.

Don't get me wrong. I am not strictly against it, but so far I see no real benefit. It currently feels to me as something we do just because we can and not because we need it. But I might be wrong here. So feel free to implement it.

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

2 participants