Manage Object Types
Create New Object Type
This example creates a new Object Type
called tv_show. It also creates and assigns a number of fields
and relationships
to existing objects.
Please note that adding an object will require you to activate a new version of the schema before you are able to start using it.
mutation MyMutation {
createObjectConfiguration(
objects: [
{
name: "tv_show"
fields: [
{ name: "name", operation: CREATE, type: STRING },
{ name: "number_of_episodes", operation: CREATE, type: INTEGER },
{ name: "number_of_seasons", operation: CREATE, type: INTEGER },
{ name: "synopsis", operation: CREATE, type: STRING },
{ name: "popularity", operation: CREATE, type: FLOAT }
]
relationships: [
{
to_class: Season
relationship_name: "seasons"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
{
to_class: Episode
relationship_name: "episodes"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
{
to_class: Rating
relationship_name: "ratings"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
{
to_class: Genre
relationship_name: "genres"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
{
to_class: SkylarkImage
relationship_name: "images"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
{
to_class: SkylarkAsset
relationship_name: "assets"
reverse_relationship_name: "tv_shows",
operation: CREATE
},
]
}
]
) {
version
messages
}
}
Field Type Mapping
When creating object type and setting up new fields, you'll need to specify a field type. Here's a list of the types Skylark supports:
string
integer
float
boolean
enum
datetime
date
email
ip_address
json
phone
time
timestamp
url
Updated about 2 months ago