project-status.md
September 20, 2020 ยท View on GitHub
Project Status
JSON:API
Document
-
data -
included -
errors -
meta -
jsonapi(i.e. API Information) -
links
Resource Object
-
id -
type -
attributes -
relationships -
links -
meta
Relationship Object
-
data -
links -
meta
Resource Identifier Object
-
id -
type -
meta
Links Object
-
href -
meta
Misc
- Support transforms on
Attributesvalues (e.g. to support different representations ofDate) - Support validation on
Attributes. - Support sparse fieldsets (encoding only). A client can likely just define a new model to represent a sparse population of another model in a very specific use case for decoding purposes. On the server side, sparse fieldsets of Resource Objects can be encoded without creating one model for every possible sparse fieldset.
Testing
Resource Object Validator
- Disallow optional array in
Attribute(should be empty array, notnull). - Only allow
TransformedAttributeand its derivatives as stored properties withinAttributesstruct. Computed properties can still be any type because they do not get encoded or decoded. - Only allow
MetaRelationship,ToManyRelationshipandToOneRelationshipwithinRelationshipsstruct.
Potential Improvements
These ideas could be implemented in future versions.
- (Maybe) Use
KeyPathto specifyIncludesthus creating type safety around the relationship between a primary resource type and the types of included resources. - (Maybe) Replace
SingleResourceBodyandManyResourceBodywith support at theDocumentlevel to just interpretPrimaryResource,PrimaryResource?, or[PrimaryResource]as the same decoding/encoding strategies. - Support sideposting. JSONAPI spec might become opinionated in the future (https://github.com/json-api/json-api/pull/1197, https://github.com/json-api/json-api/issues/1215, https://github.com/json-api/json-api/issues/1216) but there is also an existing implementation to consider (https://jsonapi-suite.github.io/jsonapi_suite/ruby/writes/nested-writes). At this time, any sidepost implementation would be an awesome tertiary library to be used alongside the primary JSONAPI library. Maybe
JSONAPISideloading. - Error or warning if an included resource object is not related to a primary resource object or another included resource object (Turned off or at least not throwing by default).