Support JSON-based, light-weight syntax for resource definition
joelalejandro opened this issue · comments
Joel Alejandro Villarreal Bertoldi commented
It'd be interesting to make types
in Application
a dual-type property:
types: typeof Resource[] | ResourceSchemaList;
So in the Application
constructor, we could dynamically create Resource
classes accordingly.
ResourceSchemaList
would be an object-based list like:
{
ResourceName: {
attributes: {},
relationships: {}
}
}
The resourceSchemaListToResourceClasses
method would look something like:
Object.entries(resourceSchemaList).map(([resourceName, schemaDefinition]) => class extends Resource {
static schema = { ...schemaDefinition };
});
Joel Alejandro Villarreal Bertoldi commented
Could be a way to mitigate a problem described in #294.
Joel Alejandro Villarreal Bertoldi commented
Supporting this feature implies a major rewrite of the way Processors work, it's too much of a cost for a minimal benefit. I'm calling off development on this.