Current behavior
I’m getting You can only create scalar fields and '<FieldName>' is not a scalar value. Did you intend to create a relation? when I’m creating relations. Specifically it happens when I’m setting a relation like this:
type FirstType {
seconds: SecondType @relation(name: "TypeRelation")
}
type SecondType {
firsts: [FirstType!]! @relation(name: "TypeRelation")
}
Expected behavior?
It should create a relationship.
If I deploy
type User @model {
id: ID! @isUnique
name: String
dateOfBirth: DateTime
}
type FirstType {
seconds: SecondType @relation(name: "TypeRelation")
}
type SecondType {
firsts: [FirstType!]! @relation(name: "TypeRelation")
}
I get these (expected) error messages:
There are issues with the new service definition:
FirstType
✖ The model `FirstType` is missing the @model directive. Please add it. See: https://github.com/graphcool/graphcool/issues/817
✖ All models must specify the `id` field: `id: ID! @isUnique`
SecondType
✖ The model `SecondType` is missing the @model directive. Please add it. See: https://github.com/graphcool/graphcool/issues/817
✖ All models must specify the `id` field: `id: ID! @isUnique`
Please add more information so this can be reproduced.
When adding @model and id fields, I have been unable to reproduce the issue regarding the relation field on FirstType.
So the issue came down to it being related to changing the relationship type. I could deploy my schema just fine to a new env but not to an env that had a pre-existing field of the same name on the type but with a different relationship format (n:n instead of 1:n, for example). Removing the type from the schema, deploying and then adding it back in made it work.
Ah ok. So it's actually the same as described here: https://github.com/graphcool/framework/issues/1171
Closing this, thanks 👌
Most helpful comment
So the issue came down to it being related to changing the relationship type. I could deploy my schema just fine to a new env but not to an env that had a pre-existing field of the same name on the type but with a different relationship format (n:n instead of 1:n, for example). Removing the type from the schema, deploying and then adding it back in made it work.