How to use the gridsome/graphql.GraphQLObjectType function in gridsome

To help you get started, we’ve selected a few gridsome examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gridsome / gridsome / packages / source-graphql / transforms.js View on Github external
transformSchema (schema) {
    const query = schema.getQueryType()

    let newQuery // eslint-disable-line
    const nestedType = new GraphQLObjectType({
      name: this.typeName,
      fields: () =>
        fieldMapToFieldConfigMap(
          query.getFields(),
          createResolveType(typeName => {
            if (typeName === query.name) {
              return newQuery
            } else {
              return schema.getType(typeName)
            }
          }),
          true
        )
    })
    newQuery = new GraphQLObjectType({
      name: query.name,
github gridsome / gridsome / packages / transformer-remark / lib / types / HeadingType.js View on Github external
const {
  GraphQLInt,
  GraphQLString,
  GraphQLEnumType,
  GraphQLObjectType
} = require('gridsome/graphql')

const HeadingType = new GraphQLObjectType({
  name: 'RemarkHeading',
  fields: {
    depth: { type: GraphQLInt },
    value: { type: GraphQLString },
    anchor: { type: GraphQLString }
  }
})

const HeadingLevels = new GraphQLEnumType({
  name: 'RemarkHeadingLevels',
  values: {
    h1: { value: 1 },
    h2: { value: 2 },
    h3: { value: 3 },
    h4: { value: 4 },
    h5: { value: 5 },
github gridsome / gridsome / packages / source-graphql / transforms.js View on Github external
const nestedType = new GraphQLObjectType({
      name: this.typeName,
      fields: () =>
        fieldMapToFieldConfigMap(
          query.getFields(),
          createResolveType(typeName => {
            if (typeName === query.name) {
              return newQuery
            } else {
              return schema.getType(typeName)
            }
          }),
          true
        )
    })
    newQuery = new GraphQLObjectType({
      name: query.name,
      fields: {
        [this.fieldName]: {
          type: nestedType,
          resolve: (parent, args, context, info) => {
            return {}
          }
        }
      }
    })
    const typeMap = schema.getTypeMap()
    const allTypes = Object.keys(typeMap)
      .filter(name => name !== query.name)
      .map(key => typeMap[key])

    return new GraphQLSchema({

gridsome

A JAMstack framework for building blazing fast websites with Vue.js

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis