-
Notifications
You must be signed in to change notification settings - Fork 73
[Discussion]: Future of relationships #2023
Comments
/cc @craicoverflow, @wtrocki |
Thank you for creating this issue @machi1990 - this refactor has been on the cards for a while now. The current implementation is pretty hard to extend and is preventing us from easily adding direct many-to-many relationships and implicit relationships. |
Awesome work @machi1990 and @craicoverflow . Now we can make this work with context of all issues we see |
I've found that relationships caused issues with duplicate relationships, so could not complete #2057 In my attempt to allow implicit relationships in https://github.com/aerogear/graphback/pull/1873/files I had refactored relationships so that they would be stored in a config map, instead of an array. This gives many benefits, including:
Example: interface ModelRelationshipConfigMap {
[modelName: string]: ModelFieldRelationshipConfigMap
}
interface ModelFieldRelationshipConfigMap {
[fieldName: string]: FieldRelationshipMetadata
}
const relationships: ModelRelationshipConfigMap = {
Note: {
comments: {...}
},
Comment: {
note: {...}
}
} I think when this issue is actioned, this format shoulbe be implemented. |
+1, a very good idea. |
I have had chance to review relationships as I needed information form graphback that field is an relationship and sadly could not use it because of the way we do it (we build all relationships and there is no single helper to determine relationship for the model. Ended up writing my own helper detached from the core. |
This is an issue that kind of wraps up all the things we can improve around relationship supports:
RelationshipMetadataBuilder
,manyToOne
, not properly documented, some validation are wrong e.g Validation for relationships fails on valid case #2019manyToMany
relationships e.g Many-to-many relationships have strange selection set structure #1342, ManyToMany Relationship #328, How to define a ManyToMany relation with parameters (i.o.w a crosstable) #1185, Many-to-many relationships have strange selection set structure #1342, More powerful selection set filtering on many to many relations #1494@contains
definition #1723@oneToOne
to allow querying from both sides #930I felt the need to aggregate these issues here and launch the discussion if needed.
The text was updated successfully, but these errors were encountered: