Closed edugomez closed 7 years ago
Looking good. Two quick comments:
(1) I was thinking of the codelists
property in extensions.json
as an array of codelist CSV file names, such that if you find an extensions.json at http://example.com/exts/extendedMethod/extension.json that contains ```"codelists":["+method.csv","-documentType.csv","newCodelist.csv"] you can then know that you can fetch http://example.com/exts/extendedMethod/codelists/+method.csv and http://example.com/exts/extendedMethod/-documentType.csv and http://example.com/exts/extendedMethod/newCodelist.csv without needing the server to support directory listing.
(2) Is there a way we can make sure the schema is .gitignored when someone clones the repo and then tries to commit their own extension?
(1) I was thinking of it as a boolean as a way of saying 'yes, look in the codelists directory and you will find some csv there', but probably you are right. It makes entry.json somehow not so clean, but definitely makes life easier when fetching the codelists (as I don't think there's a way of listing the csv files served from that directory)
(2) I'm not sure how that can be done as the file is version-controlled and therefore pulled with the repo. I know it is possible to control this locally (eg a .gitignore.local) but not sure how to force a user to not add those files. Let me go back to you after looking into it.
Also, I'm not sure whether dependencies should point at an extension.json (as it is now in the extension-schema.json) or to the registry (ie to a entry.json). What do you think?
(2) is not a priority - so let's leave that for now.
For the dependencies: perhaps something we need to write a quick discussion post on. Will open a separate issue...
Any tool using extensions need to accommodate the proposed changes to the template once those changes are added to the actual extensions.
Cove in particular won't work due to the fact that "name" and "description" are now objects mapping language codes to strings in the specified language. Also, it is ready to get the doc url from the extension, but it is expecting a _"documentationurl" instead of a "documentationUrl" field.
Cove in particular won't work due to the fact that "name" and "description" are now objects mapping language codes to strings in the specified language. Also, it is ready to get the doc url from the extension, but it is expecting a "documentation_url" instead of a "documentationUrl" field.
I think this snippet already in CoVE should deal with that (haven't tested yet):
# Section to be removed when extensions conform to new schema
old_documentation_url = extensions_descriptor.get('documentation_url', '')
if old_documentation_url and 'documentationUrl' not in extensions_descriptor:
extensions_descriptor['documentationUrl'] = {'en': old_documentation_url}
# End section
for field in ['description', 'name', 'documentationUrl']:
field_object = extensions_descriptor.get(field, {})
if isinstance(field_object, str):
field_value = field_object
else:
field_value = field_object.get(cur_language)
if not field_value:
field_value = field_object.get('en', '')
extension_description[field] = field_value
And this by @kindly should also fix it for the standard docs:
# This loop is temporary only so docs work while transistioning onto new format
for item in entry_obj:
item["documentation_url"] = item["documentationUrl"]["en"]
item["url"] = item["url"][:-14]
# endloop
So I would say we are good to go. If something breaks, we know where to look to fix it quckly
@timgdavies
issues #3 and #4