GraphQL Scalar Types

From Logic Wiki
Jump to: navigation, search


  1. ID - Used to store unique identifier
  2. String
  3. Booelan
  4. Int
  5. Float
  type Query {
      title: String!
      price: Float!
      releaseYear: Int
      rating: Float
      inStock: Boolean!
  }
const resolvers = {
  Query: {
    title() {
      return 'The War of Art'
    },
    price() {
      return 12.99
    },
    releaseYear() {
      return null
    },
    rating() {
      return 5
    },
    inStock() {
      return true
    }
  }
}

See Also https://graphql.org/learn/schema/#scalar-types