Virtual Types have long been a hidden gem in Structrs API-Builder module (available in the Enterprise Edition). To make this powerful feature more widely known, we introduced a new management interface for virtual types. Before, the user had to know that virtual types existed and manually configure them in the CRUD section.
A picture is worth a thousand words
The following animated GIF demos some of the features of virtual types but one should study the documentation to learn about all the functionality of virtual types. (Click the image to open it in a new tab/window)
Example Use-Cases for Virtual Types
- Highly customisable Export
Virtual Types allow users to tailor JSON documents to whatever format external APIs need. Some of the internal fields (
typeetc) are 'in the way'? Simply don't include them or map them to a different name.
- Highly customisable Import
Virtual Types can also be used for data creation. If, for example, an external API send an
idproperty along, simply create a mapping which does not interfere with Structrs internal
- Schema indirection to avoid refactorings in pages
Users can create a virtual type per schema type and only use the virtual type in their application (REST-only) and if schema changes occur only the virtual type needs to be updated and the application can remain untouched.
If you have even better ideas, tweet your use cases @structr