Adds a notion of partial resources which are an extension of the
PrimaryData internal type. This allows for separate definitions of
models that do not have id fields and are not expected to have included
data.
There may be a few edge cases where a user wants support included resources
without an id in the primary data, or wants to only submit relationships
with an ID, but this can be resolved separately.
TODO:
[ ] Check sanity of this change
[ ] Document methods
[ ] Document macros
[ ] More tests
[ ] Fixup commits
Hi,
Have been thinking about how to resolve #74 and therefore implemented the suggestion of PartialResources to what I would understand them to be. I have added a test, but this change requires an extra macro for implementing a new PartialJsonApiModel trait, with the idea that users would invoke this macro for a separate struct, though I am unsure on the ergonomics of this.
If there is any feedback on these changes I would appreciate it, otherwise I will try to fixup this PR over the course of the next few weeks with docs and tests.
Adds a notion of partial resources which are an extension of the
PrimaryData
internal type. This allows for separate definitions of models that do not haveid
fields and are not expected to have included data.This is useful in cases where a server should generate the IDs for resources: https://jsonapi.org/format/1.0/#crud-creating-client-ids
There may be a few edge cases where a user wants support included resources without an id in the primary data, or wants to only submit relationships with an ID, but this can be resolved separately.
TODO:
Hi,
Have been thinking about how to resolve #74 and therefore implemented the suggestion of PartialResources to what I would understand them to be. I have added a test, but this change requires an extra macro for implementing a new
PartialJsonApiModel
trait, with the idea that users would invoke this macro for a separate struct, though I am unsure on the ergonomics of this.If there is any feedback on these changes I would appreciate it, otherwise I will try to fixup this PR over the course of the next few weeks with docs and tests.