-
Notifications
You must be signed in to change notification settings - Fork 5
Make a plan for how to handle product types #2
Comments
If field names appear in the serialized data, you can tag schemas and serialized data with version numbers using semver. You can check statically that versions are backwards-compatible, and if they aren't, require a major verison bump. All the versions would remain in the schema.
If you have constrained types, such as I have never actually implemented the compatibility checks but I don't see why it shouldn't work. It's analogous to subtyping where upcasts are coercions. |
@rightfold: Field names will definitely appear in serialized data. My plan is to make Plate useful for describing meaningful-on-their-own formats like https://en.wikipedia.org/wiki/ICalendar, not to compete with Protocol Buffers-style formats that do very efficient serialization by dropping field names.
I think the simplest thing to do is to leave versioning out of the core of Plate. I really like the idea of doing static analysis on version compatibility though, once we get the core of Plate finished this would be a great tool to build. |
Also @rightfold your twitter comments are super relevant:
Maybe we should have each product type say explicitly whether it allows extra rows or not. |
Currently product types act like PureScript row types where as long as the required fields exist it doesn't matter if there are other fields as well. See the implementation here. Is this actually what we want?
This issue is made additionally tricky by the goals of a schema system as opposed to a type system. As a schema system we'd like to be able to add additional, optional fields to a product type and still maintain backwards compatibility with old data. Is there a principled way to do this that won't cause us trouble in the future?
The text was updated successfully, but these errors were encountered: