gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

What is the project's stance on backwards compatible save files?

Open moritz89 opened this issue 3 years ago • 6 comments

Subject of the issue

I wanted to know if the project has a stance on backwards compatibility with regards to the saved files (serialized grids)? If not, then I guess the best workaround is to save a version number with the saved files and then migrate from version to version. If this is the case, would that that contribution be of interest?

On a related point, would a JSON Schema definition make sense?

Your environment

  • version: 8-9

moritz89 avatar Sep 11 '23 13:09 moritz89

I've left versioning to application as typically you will save bunch of extra info in there as well, and trivial for app to save a revision and convert if they care about old format.

not sure I would want the bloat in this lib to support every format since I implemented the save()/load() function to be honest... what fields are you worry about ? JSON schema might make sense - right now it is in a TS definition GridStackOptions

adumesny avatar Sep 11 '23 18:09 adumesny

Good to know. Then I'll just version the saved JSON and if an incompatibility pops up deal with it in application via a migration function.

The TS definition is more than enough and if required, can also be used to generate JSON Schema.

moritz89 avatar Sep 11 '23 18:09 moritz89

that said if you want to have GridStackOptions have a version field as well and write convertion from older format and doesn't look like a lot of work/bloat, then I'm open to it. this would only work going forward as we don't have old fomat versions.

adumesny avatar Sep 11 '23 19:09 adumesny

That has the potential to be very useful.

  • How would the version number be accessible from the library. As far as I can tell, it isn't integrated in the bundled library
  • How would it be saved in the JSON save() returns as currently it returns a list

moritz89 avatar Sep 12 '23 11:09 moritz89

it would only work in the GridStackOptions case where a new field would be added.

adumesny avatar Sep 12 '23 14:09 adumesny

closing since no donation for that work.

adumesny avatar Mar 30 '24 21:03 adumesny