Is your feature request related to a problem? Please describe.
I have a data structure that has nested types.
enum LearnType {
page
link
heading
question
note
}
type ExampleDoc
@model
{
id: ID!
learn: [Learn]
}
type LearnItem {
title: String
text: String
pageId: String
content: String
url: String
question: String
answer: String
schemaVersion: String!
}
type Learn {
seq: Int
type: LearnType
item: LearnItem
schemaVersion: String!
}
I only have 1 DynamoDB table for the ExampleDocs, the learn items would then just be nested. This works as expected with using the GraphQL clients.
When I try to generated the model definition for the Datastore, I see the following error:
Error: Unknown type Learn for field learn. Did you forget to add the @model directive
Describe the solution you'd like
I would like the model generator to allow nested types that are not @models
Describe alternatives you've considered
Open to ideas
normally type Learn would appear at the top of the schema document, before it is referenced.
It seems that object with @model directive cannot contain any objects or list of objects that are not a model too.
Example:
type Stop {
locationExternalCode: String!
locationName: String!
}
type Job @model {
stops: [Stop]
}
will fail, but if @model is removed or if both are models it works
My case has Geolocation that is passed to ElasticSearch as a Geopoint - so without support for this then any geospatial applications are unsupported.
type Geolocation
{
lat: Float
lon: Float
}
Tracking this request as a part of #2988
Closing this as a duplicate
Most helpful comment
It seems that object with @model directive cannot contain any objects or list of objects that are not a model too.
Example:
will fail, but if @model is removed or if both are models it works