PackageManagerRFC icon indicating copy to clipboard operation
PackageManagerRFC copied to clipboard

Package Spec/MetaData files - XML or JSON?

Open vincentparrett opened this issue 6 years ago • 11 comments

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.

vincentparrett avatar Feb 14 '19 06:02 vincentparrett

+1 for XML - simpler editing than JSON

landrix avatar Feb 14 '19 10:02 landrix

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.

casteng avatar Feb 14 '19 22:02 casteng

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.

vincentparrett avatar Feb 14 '19 23:02 vincentparrett

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.

code-kungfu avatar Feb 15 '19 03:02 code-kungfu

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

luebbe avatar Feb 15 '19 12:02 luebbe

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.

wlandgraf avatar Feb 15 '19 16:02 wlandgraf

There's a good spec of the PlatformIO library.json file

luebbe avatar Feb 19 '19 08:02 luebbe

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.

jcangas avatar Feb 20 '19 00:02 jcangas

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.

vincentparrett avatar Feb 20 '19 01:02 vincentparrett

Comments are useful for example to specify why a dependency on some package is needed. Or warn about some possible issues with it.

casteng avatar Feb 20 '19 20:02 casteng

Space for comments could easily be built into the json spec. Just have a optional comments field.
I would much prefer json over xml.

JBontes avatar Feb 22 '19 13:02 JBontes