-
Notifications
You must be signed in to change notification settings - Fork 76
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
Modifications to extensions
per #103.
#105
Conversation
I actually don't think we need to prepend In other words, you can really think of these fields like |
That decision should probably be bigger than just the extension object fields. Right now I don't know of any other field that has an I need to look at my C++ serializing tools to figure out what would be most sane to support before offering further suggestions, but even that would just be based on my preference because of tools I already have that I'd rather not be broken by a decision like this :-). |
Here's an example to make my point: import json
class NamespaceExtension(object):
"""Type used to deserialize core:extensions objects."""
def __init__(self, name, version, optional):
self.name = name
self.version = version
self.optional = optional
# Some example metadata
json_md = """{
"global": {
"core:extensions": [
{
"name": "extension-01",
"version": "v0.0.5",
"optional": true
},
{
"name": "extension-02",
"version": "v1.2.3",
"optional": false
}
]
}
}"""
if __name__ == '__main__':
md = json.loads(json_md)
for ext in md["global"]["core:extensions"]:
try:
deserialized_ext = NamespaceExtension(**ext)
except Exception as err:
print("Invalid core:extensions object - {}".format(err))
fmt = "Extension {0.name} ({0.version}): optional: {0.optional}"
print(fmt.format(deserialized_ext)) Outputting: Extension extension-01 (v0.0.5): optional: True
Extension extension-02 (v1.2.3): optional: False Note that if we prepend |
Okay, I think the resolution, here, is to update this PR to not prepend {
"global": {
"core:extensions": [
{
"name": "extension-01",
"version": "v0.0.5",
"optional": true
},
{
"name": "extension-02",
"version": "v1.2.3",
"optional": false
}
]
}
} Will tag this for me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a solid improvement. Once this is merged it probably makes sense to re-evaluate all of the required <EXT>:version
fields in the gloabl
namespace.
@bhilburn Is this PR truly ready to merge? |
@gmabey - No, I have not made the changes referenced in my previous comment, yet. |
efea0a3
to
9508575
Compare
@bhilburn this has been rebased and updated per discussion above. The last thing we need to do before merge is to remove the individual Are Whats up with |
@jacobagilbert - Oops, thought I had already responded to this.
If you don't mind updating them / adding them to this PR, we should be good, here |
This removes the 'global' scope 'version' fields for all extensions as this information will be tracked in the 'core:extensions' array now.
2d1ef2a
to
74e96bf
Compare
@bhilburn this dropped off my queue... but should be good to go now. I also took this opportunity to add section numbering to each canonical extension. |
This branch makes the changes described in #103, including:
I don't really care for the naming of the fields in the
extensions objects
at the moment. I first made them without theext_
prefix (e.g.,core:name
), but then decided against it as it creates a name conflict withcore:version
in the parent global object. I'd love to hear thoughts & feedback on this topic.Note this PR also contains a few other issues to fix some MD linter warnings, which is a bit sloppy to wrap up in this branch - my apologies.