How to use the graphql.GraphQLNonNull function in graphql

To help you get started, we’ve selected a few graphql 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 Asymmetrik / graphql-fhir / src / resources / 1_0_2 / inputs / signature.input.js View on Github external
type: new GraphQLNonNull(UriScalar),
			description:
				'A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key).',
		},
		whoReference: {
			type: new GraphQLNonNull(GraphQLString),
			description:
				'A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key).',
		},
		_contentType: {
			type: require('./element.input.js'),
			description:
				'A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature.',
		},
		contentType: {
			type: new GraphQLNonNull(CodeScalar),
			description:
				'A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature.',
		},
		_blob: {
			type: require('./element.input.js'),
			description: 'The base64 encoding of the Signature content.',
		},
		blob: {
			type: new GraphQLNonNull(Base64BinaryScalar),
			description: 'The base64 encoding of the Signature content.',
		},
	}),
});
github Asymmetrik / graphql-fhir / src / resources / 3_0_1 / schemas / elementdefinitionconstraint.schema.js View on Github external
description:
				'Description of why this constraint is necessary or appropriate.',
		},
		requirements: {
			type: GraphQLString,
			description:
				'Description of why this constraint is necessary or appropriate.',
		},
		_severity: {
			type: require('./element.schema.js'),
			description:
				'Identifies the impact constraint violation has on the conformance of the instance.',
		},
		// valueSetReference: http://hl7.org/fhir/ValueSet/constraint-severity
		severity: {
			type: new GraphQLNonNull(CodeScalar),
			description:
				'Identifies the impact constraint violation has on the conformance of the instance.',
		},
		_human: {
			type: require('./element.schema.js'),
			description:
				'Text that can be used to describe the constraint in messages identifying that the constraint has been violated.',
		},
		human: {
			type: new GraphQLNonNull(GraphQLString),
			description:
				'Text that can be used to describe the constraint in messages identifying that the constraint has been violated.',
		},
		_expression: {
			type: require('./element.schema.js'),
			description:
github sdelrio0 / pyrope / __tests__ / collections / organizations / types.js View on Github external
fields: () => ({
    uuid: {
      type: new GraphQLNonNull(GraphQLString),
    },
    createdAt: {
      type: GraphQLString,
    },
    updatedAt: {
      type: GraphQLString,
    },
    contacts: {
      type: new GraphQLList(ContactType),
      dependent: 'nullify',
      hasMany: true,
      resolve: (source, args, context) => resolvers.getContacts(source)
    }
  })
});
github alrighty / react-universal-starter-kit / modules / server / data / mutations / likePost.js View on Github external
import {
  GraphQLNonNull,
  GraphQLID
} from 'graphql'
import { PostType } from '../types'
import { Post } from '../models'
import checkLoggedIn from 'server/utils/checkLoggedIn'

export default {
  type: PostType,
  args: {
    id: {
      type: new GraphQLNonNull(GraphQLID)
    }
  },
  resolve: async (root, { id }, { req }) => {
    checkLoggedIn(req)

    const { user } = req

    if (!user.likes.some(postId => postId.equals(id))) {
      user.likes.push(id)

      await user.save()
    }

    return Post.findById(id)
  }
}
github artsy / metaphysics / src / schema / fields / pagination.js View on Github external
fields: () => ({
    first: {
      type: PageCursor,
      description:
        "Optional, may be included in `around` (if current page is near the beginning).",
    },
    last: {
      type: PageCursor,
      description:
        "Optional, may be included in `around` (if current page is near the end).",
    },
    around: {
      type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(PageCursor))),
      description: "Always includes current page",
    },
    previous: { type: PageCursor },
  }),
})
github graphql / graphql-relay-js / src / mutation / mutation.js View on Github external
const outputType = new GraphQLObjectType({
    name: name + 'Payload',
    fields: augmentedOutputFields,
  });

  const inputType = new GraphQLInputObjectType({
    name: name + 'Input',
    fields: augmentedInputFields,
  });

  return {
    type: outputType,
    description,
    deprecationReason,
    args: {
      input: {type: new GraphQLNonNull(inputType)},
    },
    resolve: (_, {input}, context, info) => {
      return Promise.resolve(mutateAndGetPayload(input, context, info)).then(
        payload => {
          payload.clientMutationId = input.clientMutationId;
          return payload;
        }
      );
    },
  };
}
github pradel / sigle / server / graphql / QueryType.ts View on Github external
query.username = username;
        }

        return mrResolve(args, PublicStoryModel, query, opts);
      },
    },

    publicStory: {
      description: 'Fetch a public story',
      type: PublicStoryType,
      args: {
        storyId: {
          type: GraphQLNonNull(GraphQLString),
        },
        username: {
          type: GraphQLNonNull(GraphQLString),
        },
      },
      resolve: async (_, args, context) => {
        const { db } = context;
        const { storyId, username } = args;

        const radiksData = db.collection(config.radiksCollectionName);
        const publicStory = await radiksData.findOne({
          radiksType: 'PublicStory',
          username,
          _id: storyId,
        });

        return publicStory;
      },
    },
github the-control-group / authx / packages / strategy-password / src / server / graphql / mutation / GraphQLCreatePasswordAuthorityInput.ts View on Github external
fields: () => ({
    id: {
      type: GraphQLID,
      description: "Optional UUID to use for the new authority."
    },
    enabled: {
      type: GraphQLBoolean,
      defaultValue: true
    },
    name: {
      type: new GraphQLNonNull(GraphQLString),
      description: "The name of the authority."
    },
    description: {
      type: new GraphQLNonNull(GraphQLString),
      description: "A description of the authority."
    },
    rounds: {
      type: GraphQLInt,
      defaultValue: 10,
      description:
        "The number of bcrypt rounds to use when generating new hashes."
    },
    administration: {
      type: new GraphQLList(new GraphQLNonNull(GraphQLAdministrationInput)),
      description:
        "An optional list of roles to which scopes will be added for the purpose of administering the created authority.",
github morrys / wora / packages / mui / examples / todo / src / data / schema / mutations / MarkAllTodosMutation.ts View on Github external
} from '../../database';

type Input = {
  complete: boolean,
  userId: string,
};

type Payload = {
  changedTodoIds: ReadonlyArray,
  userId: string,
};

const MarkAllTodosMutation = mutationWithClientMutationId({
  name: 'MarkAllTodos',
  inputFields: {
    complete: {type: new GraphQLNonNull(GraphQLBoolean)},
    userId: {type: new GraphQLNonNull(GraphQLID)},
  },
  outputFields: {
    changedTodos: {
      type: new GraphQLList(new GraphQLNonNull(GraphQLTodo)),
      resolve: ({changedTodoIds}: Payload): ReadonlyArray =>
        changedTodoIds.map((todoId: string): Todo => getTodoOrThrow(todoId)),
    },
    user: {
      type: new GraphQLNonNull(GraphQLUser),
      resolve: ({userId}: Payload): User => getUserOrThrow(userId),
    },
  },
  mutateAndGetPayload: ({complete, userId}: Input): Payload => {
    const changedTodoIds = markAllTodos(complete);