amplify-js
amplify-js copied to clipboard
Support cyclical models in datastore
Is this related to a new or existing framework?
No response
Is this related to a new or existing API?
DataStore
Is this related to another service?
No response
Describe the feature you'd like to request
Currently, DataStore does not support models with circular references. For example this schema:
type SomeType {
NewField: String
}
type TestModel @model @auth(rules: [{allow: public}]) {
id: ID!
untitledfield: [SomeType]
}
type MenuModel @model @auth(rules: [{allow: public}]) {
id: ID!
menu: Menu
}
type Menu {
name: ID!
submenus: [Menu]
}
calling initialize method will trigger the following error:
RangeError: Maximum call stack size exceeded
at Object.toString (<anonymous>)
at isGraphQLScalarType (types.ts:284:1)
at utils.ts:126:1
https://github.com/aws-amplify/amplify-adminui/issues/423
Describe the solution you'd like
I'd like DataStore to be able to handle circular dependencies
Describe alternatives you've considered
I've considered flattening my schema to remove recursive models, and using AppSync api calls directly instead of datastore
Additional context
https://github.com/aws-amplify/amplify-adminui/issues/423
Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Duplicate of https://github.com/aws-amplify/amplify-js/issues/6736
What's the update on this?