4 ms·
I could imagine use cases for this for example for REST apis that consume json and then have to transform it generically to some other json for db storage in a
by elcapitan 9y ago
I could imagine use cases for this for example for REST apis that consume json and then have to transform it generically to some other json for db storage in a document database. The internal storage could change over time with the outside spec staying the same, and such transforms could be used to do the mapping per version.
This particular implementation looks a bit messy though - XSLT is valid XML and Xpath, while this solution uses templating syntax. That's more human readable, but also slightly inconsequent - you wouldn't be able to validate such a template with json schema for example.
- gliechtenstein 9y ago> That's more human readable, but also slightly inconsequent - you wouldn't be able to validate such a template with json schema for example. Could you elaborate?
- elcapitan 9y agoJust to use the json-schema example - because the transform uses templating syntax inside strings, I wouldn't be able to write a json-schema to check if a given transform object is valid or not, which can quickly become an issue for growing sizes of transforms.