PackageManagerRFC
PackageManagerRFC copied to clipboard
Package Spec/MetaData files - XML or JSON?
Nuget uses xml NPM uses json. Ruby Gems use - Ruby
My preference is for xml because I
- I can put comments in xml files (json doesn't support comments)
- xml is supported in every delphi version, whereas json support is variable
- xml is more expressive
- performance is not an issue, the files are not expected to be large.
I should also mention, I've actually been using xml in my development of this project, but I'm interested to hear what others think.
+1 for XML - simpler editing than JSON
I'd prefer JSON as it's simpler and less boilerplate. Maven uses XML and is often criticized for this. Also a project file which specifies dependencies for a project may be quite big and obviously should have the same format. But XML will be ok too.
My issue with JSON is the lack of ability to comment things. Comments in the metadata file aren't really needed since it would be generated when the package is produced, but comments in the spec file are a must.
I would recommend XML too, since it's possible to attach more detailed information and/or package install instructions while retaining readability. JSON would be easier to parse, but with package management, it would quickly become very complex compared to XML.
Generally I like the way PlatformIO handles libraries and their dependencies. They are source only, but I guess we can still draw some inspiration from there: An example config file is here: https://github.com/homieiot/homie-esp8266/blob/develop/library.json
I'd vote for JSON, as the package will have a strict format and "comments" can be checked in documentation. If XML is adopted, it would be good we have some tooling to generate the file.
There's a good spec of the PlatformIO library.json file
I totally agree with @wlandgraf. I don't see the case for comments in a spec file: only choose good names for keys and write a good doc for the file format.
I'm not suggesting comments are documentation, but they are useful for package authors, the spec file is in effect source code.
Also as I mentioned in the first post
xml is supported in every delphi version, whereas json support is variable
I'm not totally sold either way yet.
Comments are useful for example to specify why a dependency on some package is needed. Or warn about some possible issues with it.
Space for comments could easily be built into the json spec. Just have a optional comments field.
I would much prefer json over xml.