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 for complex types #28

Open
YuukanOO opened this issue Sep 15, 2020 · 0 comments
Open

Support for complex types #28

YuukanOO opened this issue Sep 15, 2020 · 0 comments
Labels
breaking change Introduce a needed breaking change enhancement New feature or request high energy Represents a task which need a lot of energy
Milestone

Comments

@YuukanOO
Copy link
Contributor

YuukanOO commented Sep 15, 2020

Similar and prior to #7 , it may be useful to enable the usage of complex types on a schema:

// To save a resource of this shape
const data = {
  id: 'someid',
  profile: {
    firstName: 'john',
    lastName: 'doe',
  },
};

// With a schema like this
const schema = {
  id: is.key(),
  profile: is.object({
    firstName: is.string('...'),
    lastName: is.string('...'),
  }),
}

Complex types are embedded in the enclosing schema and does not need a separate repository, this is purely for convenience to avoid a big flat structure and the representation in the triple will still be standard.

This feature will introduce a needed breaking change, the Schema.type should be moved to the Repository (and the type becomes mandatory in the repository options), I think it makes more sense after all, only the repository cares about a Thing type after all, the schema is here only to map JS <-> Thing

@YuukanOO YuukanOO added enhancement New feature or request low energy Represents a task which does not need a lot of energy labels Sep 15, 2020
@YuukanOO YuukanOO added breaking change Introduce a needed breaking change high energy Represents a task which need a lot of energy and removed low energy Represents a task which does not need a lot of energy labels Sep 15, 2020
@YuukanOO YuukanOO added this to the Planned milestone Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Introduce a needed breaking change enhancement New feature or request high energy Represents a task which need a lot of energy
Projects
None yet
Development

No branches or pull requests

1 participant