Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support JSON-based, light-weight syntax for resource definition #289

Closed
joelalejandro opened this issue Jun 21, 2021 · 2 comments
Closed
Assignees
Labels
cancelled Feature is too complex for the benefits it yields
Milestone

Comments

@joelalejandro
Copy link
Member

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 };
});
@joelalejandro joelalejandro added the enhancement New feature or request label Jun 21, 2021
@joelalejandro
Copy link
Member Author

Could be a way to mitigate a problem described in #294.

@joelalejandro joelalejandro self-assigned this Oct 15, 2021
@joelalejandro joelalejandro added this to the 1.2.0 milestone Oct 15, 2021
@joelalejandro joelalejandro reopened this Oct 22, 2021
@joelalejandro
Copy link
Member Author

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.

@joelalejandro joelalejandro added cancelled Feature is too complex for the benefits it yields and removed enhancement New feature or request labels Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cancelled Feature is too complex for the benefits it yields
Projects
None yet
Development

No branches or pull requests

1 participant