This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
Closed
Description
I'm not entirely sure if this is a bug or possibly something that might need to be clarified in the docs.
Given this example here from the docs a oneToMany
annotation will create a field on the type, so:
"""model"""
type User {
id: ID!
"""@oneToMany(field: 'author')"""
posts: [Post]!
}
"""@model"""
type Post {
id:ID!
text: String!
}
Will generate the following:
"""@model"""
type Post {
id: ID!
text: String!
author: User
}
When I inspect the schema on the server that all checks out.
The docs say something similar about the oneToOne
relationship, but inspecting the schema on the server,
I find that it is creating the field on the type that has the annotation, so the following:
"""
@model
"""
type Note {
_id: GraphbackObjectID!
title: String!
description: String!
"""
@oneToOne(field: 'note')
"""
comment: Comment!
}
"""
@model
"""
type Comment {
_id: GraphbackObjectID!
title: String!
description: String!
}
And the result on the server is this:
type Note {
_id: GraphbackObjectID!
title: String!
description: String!
comment: Comment!
_lastUpdatedAt: GraphbackTimestamp
_version: Int
}
type Comment {
_id: GraphbackObjectID!
title: String!
description: String!
_lastUpdatedAt: GraphbackTimestamp
_version: Int
}
Is there an undocumented change I am missing, or am I making a mistake with my annotations?