Comments (3)
@ahacking great to see that you're interested in using Orbit. I've enjoyed our discussions over in json-api :)
With schema avoiding segregation of links and allowing nested/embedded models (ie any value type that requires a breakdown into sub properties) , Orbit would move a step closer to supporting data sources and resources that have embedded structure.
Embedding is currently a serialization concern that can be handled in individual Orbit sources. Remotely embedded models can be deserialized and assigned local ids so that relationships can be tracked in Orbit records.
Can you elaborate on some use cases that you feel would benefit from allowing embedded models in Orbit's normalized form?
Are you concerned with ease of access to embedded models from their containers? Record dirtying / persistence?
The second area is orbit-common/source.js, which defines findLink(), addLink() and removeLink(). It is not clear that these are needed in the public api if the existing methods simply check if the property name exists in__rels[] and do an addLink/removeLink vs normal property handling. It would be nice to be agnostic to whether a property is an attribute or a link.
findLink
may have different implementations in different sources. Consider links in json-api: they may be specified as ids or hrefs. Although this is not fully implement in the JSONAPISource (a PR is expected soon), findLink
should support either case.
addLink
/ removeLink
internally call transform
, which is implemented uniquely in each source. It's up to each source to know how its "contents" should be transformed.
Let's discuss your schema / id proposal over in #42.
from orbit.
I'll elaborate more tomorrow but for embedded it would be nice to declaratively say a model is embedded even though yes it is a serializer concern. Do you have any thoughts for decorating model schema with serializer hints or concerns? I can see that for some backends certain attributes are only readable or only specifiable on create and never update and in my case some links should be embedded (but which ones?).
Per model serializer concerns need to be configured somewhere so any suggestions or thoughts on that would be great.
Some use cases for embedded in my application are entities of type color with a link to color space, or measurements with link to the unit type, or contact addresses, phone etc embedded in the contact in defined order. They are properties that have components to them eg think complex number and should never be resources. I have shapes or sizes that are a set of measurements where some dimensions are measured in meters and others millimeters. I don't want to normalize these to resources/endpoints as they don't exist on their own. Taken to it's conclusion you would have endpoints for a persons height and links to that vs just the height and unit as an embedded value.
Hope that gives you some insight into the kinds of attributes I need to model that don't stand on their own as resources.
from orbit.
Wow, this issue is over 6 years old! I'm open to discussing this topic more in the context of Orbit's current interfaces, but am going to close this issue for lack of activity.
from orbit.
Related Issues (20)
- Enable GitHub discussions to move support requests/general questions out of issue queue HOT 2
- [Docs] Add technical description of key request-processing, sync components
- `JSONAPIURLBuilder::buildPageParam()` (and likely others) have undefined properties serialized as `undefined` in query param
- Improve Validation Errors
- Integration with AbortSignal HOT 1
- serializers customization HOT 1
- custom filter operations
- [Feature] AsyncStorage data source
- Allow filtering for attribute/relationship not `null` (negated condition)
- Add "sideEffects": false to Orbit packages HOT 3
- Need optional chaining in `MemoryCache::removeInverseRelationshipsSync()` HOT 4
- jsonapi parallel request HOT 1
- parallel data querying principes HOT 3
- There is no upgrading steps in documentation HOT 2
- JSONAPISource Serialization Problem
- Store `__inverseRels__` not cleaned up with transform option `{ useBuffer: true }` HOT 1
- Optimistic Error Handling Got TypeError Not NetworkError HOT 4
- "supportsIndexedDB" is malfunctioning in some cases
- Kalakyo HOT 1
- Maintenance status?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orbit.