-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ids and schema #42
Comments
@ahacking I can get behind all of these goals:
As I see it, here are the constraints on ids / remoteIds:
I am still puzzling over this and will follow up soon. |
Thanks for that, your rules above confirm my understanding of the code and are exactly what I have been basing my modification's on. Some questions:
I've been playing with schema definition putting all attributes links and ids into a properties object. I like defining schema that way as when I think of embedded objects I don't think of them as links, it also aligns with how you define models in Ember. But registering a model requires building attribites and links as thats what the rest of the code expects. It's late here (almost 2am) so I'll pick this up again in the morning. Thanks for your speedy response! |
Some DBs (MongoDB perhaps?) use However, in the case of UUIDs, we would need to duplicate the value of
I'm open to just using a decent v4 UUID generator instead of the hokey timestamp + counter that's a default. I want to be sure of licensing issues (Orbit is MIT) and performance before including this. |
If you don't need to copy the value and merely reference it then no additional memory is required aside from the reference itself which is required on both sides of the fence. What are your thoughts on composite keys? Being able to support an id based on some combination of attributes might be required for those with APIs that don't use surrogate keys. |
Closed through the merge of #45 |
I've noticed that schema only allows one to specify the id handling globally for all models.
I have models that use UUID's however there are others that have natural keys and I can't say that globally for all instances of all models that the id attribute can be handled uniformly.
If I have API's from a number of sources, there isn't any particular global rule that can be used, for some models a UUID may be fine and in other cases the api might use type/small-integer-id or slug, in some models the remote id attribute name may vary.
I can see that the IdMap segregates model types, to keep their key spaces distinct, and handles the attribute type names too, however the schema model definition limits what can be expressed.
I believe the schema definition needs to be enhanced to:
In relation to my other issue #40 regarding embedded models/links, I am exploring if schema would be better described treating everything (ids, attrs, links) as just model property definitions.
Example:
I think its important to keep things under a 'properties' key in-case there are future model/schema concerns that are not property specific.
Let me know your thoughts on your preferred way forward. I am trying things out with Orbit so I am willing to work up a PR with my changes if you're open to taking this approach or an alternative that provides similar capability. I am also aware that such a schema definition change also requires changes to Ember-Orbit.
The text was updated successfully, but these errors were encountered: