1

Can you explain what this schema means?

type ScapholdSchema {
  id: ID!
  name: String!
  description: String
  types: [ScapholdType]
}
vince
  • 1,904
  • 1
  • 12
  • 17
yayitswei
  • 4,587
  • 5
  • 27
  • 34

1 Answers1

1

Great question! That is GraphQL syntax for defining a type in the GraphQL schema. In this case, the type name is called ScapholdSchema and it has fields that are id, name, description, and types, respectively. Continuing down the hierarchy, each field has a type as well, some scalar and others as custom objects. In your snippet, the word to the right of the field name defines its type (ID!, String!, etc...).

To answer your question more directly, the exclamation mark means it's a non-null field (i.e. required). One final thing to note is the ScapholdType field type. This is GraphQL object that is defined elsewhere in the GraphQL type system (much like ScapholdSchema is here). And the brackets around it denote that the types field is a list of ScapholdType objects.

Hope that helps!

vince
  • 1,904
  • 1
  • 12
  • 17