Skip to content

Support for complex types #28

@YuukanOO

Description

@YuukanOO

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeIntroduce a needed breaking changeenhancementNew feature or requesthigh energyRepresents a task which need a lot of energy

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions