-
Notifications
You must be signed in to change notification settings - Fork 1
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
Restrictions on keys in medium metadata and annotation properties #61
Comments
I like the idea of using |
Having them as python classes is still good idea, I think, so that we can have control over reserved fields (some required, others optional). |
@angus-lherrou ba0d546 attempts to solve some issues from having two-tiered attributes in a class, namely some named attributes at first-class, and a |
That makes a lot of sense. I hadn't thought about the all optional fields issue, so that's great, and I had been thinking along the same lines as far as having required attributes as first-class attributes. One potential issue with the way you're handling private fields is that arbitrary user-defined attribute names might have trailing underscores, and those would disappear on serialization. So we could tell users about that behavior and restrict possible attribute names, or we could use a different way (maybe a "private_attributes" dict in every such object). |
Maybe we can move that logic up to the superclass Your point on the private marker is very valid, I think. I added that only to handle name conflict btw |
ba0d546 (rebased) is generalizing the idea of two-tiered class attributes. I think we might want the named vs unnamed attribute groups in the |
#82 implements naming constraints on keys in MMIF object (basically by not posing any constraints). As we're happy so far with the implementation, I think this issues can be closed now. I'll let @angus-lherrou to confirm. |
#60 (at 5a53b53) implements
Annotation.add_property
andMedium.add_metadata
usingsetattr
(the previous code, which appeared to hint at__setitem__
, was not yet implemented). This necessarily requires that all properties in theannotationProperties
andmediumMetadata
JSON objects be valid Python identifiers, and not just valid strings as before.If this is a requirement that we are okay with, we can proceed with the change I've implemented in that commit. If we'd prefer not to have that restriction, we can implement it differently (i.e. with a field in the
AnnotationProperties
andMediumMetadata
classes containing a dictionary and some magic methods to wrap around that).The text was updated successfully, but these errors were encountered: