aerogear / offix

GraphQL Offline Client and Server
https://offix.dev
Apache License 2.0
758 stars 45 forks source link

Provide abstraction for object ID in datastore and other flags #599

Closed wtrocki closed 4 years ago

wtrocki commented 4 years ago

Feature Request

We need to understand the limitations around object id. Provide specific marker for ID field and how it is being represented. Additionally we need certain properties on model like required flag and scalar representation

kingsleyzissou commented 4 years ago

@wtrocki this is the duplicate (#575)

wtrocki commented 4 years ago

U https://github.com/aerogear/offix/issues/575#issuecomment-661068980

wtrocki commented 4 years ago

Reopening as I have closed the other issue :D

wtrocki commented 4 years ago

This is huge problem, however it is blocked by couple things at the moment. We have currently schema but we will need to provide ability for users to:

ID generation

1) Generate client side ID themselves (this will require us to have __clientId flag or something) to know that this object has client side id

2) Do not allow users to provide client side ID and generate it ourselves

Server side ID replacement

I have written quick code that allow us to rewrite ID based on client side id for create operation. For that, we assume that every add operation for particular ID will require rewrites for other operations for this ID

Id abstraction

Our model/schema has now id field that we can control. This ID will be _id by default and we need to map those in multiple places (we not always have access to model schema)

wtrocki commented 4 years ago

@kingsleyzissou @Eunovo ID generation - what woul you see happening here?

Eunovo commented 4 years ago

Is there any reason why users should provide client-side id? We can handle it ourselves

wtrocki commented 4 years ago

Is there any reason why users should provide client-side id? We can handle it ourselves

This is what we have now so.. my assumption was that we wanted this somehow this way. From my point we should manage it at model level (currently happens on the store which is not right)