Some basic resources, such as classificators (i.e. resources with nothing more than an ID and a name), don't need to have relationships specified.
This PR modifies resourceFor to insert an empty ({}) object for resource.schema.relationships in case the definition doesn't include it.
This change has no impact on the ResourceSchema definition, since relationships will continue to be mandatory (otherwise, we'd have lots of | undefined casts to resolve, and that seemed like a lot of changes for a minor DX improvement).
Resolves #232.
Some basic resources, such as classificators (i.e. resources with nothing more than an ID and a name), don't need to have relationships specified.
This PR modifies
resourceFor
to insert an empty ({}
) object forresource.schema.relationships
in case the definition doesn't include it.This change has no impact on the
ResourceSchema
definition, sincerelationships
will continue to be mandatory (otherwise, we'd have lots of| undefined
casts to resolve, and that seemed like a lot of changes for a minor DX improvement).