How to use the graphql.GraphQLEnumType 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 / 3_0_1 / inputs / subscription.input.js View on Github external
fields: () => ({
		resourceType: {
			type: new GraphQLNonNull(
				new GraphQLEnumType({
					name: 'Subscription_Enum_input',
					values: { Subscription: { value: 'Subscription' } },
				}),
			),
			description: 'Type of resource',
		},
		_id: {
			type: require('./element.input.js'),
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
		id: {
			type: IdScalar,
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
github artsy / metaphysics / src / schema / v2 / me / conversation / index.ts View on Github external
} from "graphql"
import { pageable } from "relay-cursor-paging"
import { connectionFromArraySlice, connectionDefinitions } from "graphql-relay"
import { convertConnectionArgsToGravityArgs } from "lib/helpers"
import { ArtworkType } from "schema/v2/artwork"
import { ShowType } from "schema/v2/show"
import {
  GlobalIDField,
  NodeInterface,
  InternalIDFields,
  NullableIDField,
} from "schema/v2/object_identification"
import { MessageType } from "./message"
import { ResolverContext } from "types/graphql"

export const BuyerOutcomeTypes = new GraphQLEnumType({
  name: "BuyerOutcomeTypes",
  values: {
    PURCHASED: {
      value: "purchased",
    },
    STILL_CONSIDERING: {
      value: "still_considering",
    },
    HIGH_PRICE: {
      value: "high_price",
    },
    LOST_INTEREST: {
      value: "lost_interest",
    },
    WORK_UNAVAILABLE: {
      value: "work_unavailable",
github macarthur-lab / gnomadjs / projects / gnomad-api / src / schema / datasets / datasetArgumentTypes.js View on Github external
import { GraphQLEnumType } from 'graphql'

import datasetsConfig from './datasetsConfig'

export const AnyDatasetArgumentType = new GraphQLEnumType({
  name: 'DatasetId',
  values: Object.keys(datasetsConfig).reduce(
    (values, datasetId) => ({ ...values, [datasetId]: {} }),
    {}
  ),
})

const methodSpecificArgumentTypes = {}

export const datasetArgumentTypeForMethod = methodName => {
  if (!methodSpecificArgumentTypes[methodName]) {
    const typeName = `DatasetsSupporting${methodName.charAt(0).toUpperCase() + methodName.slice(1)}`
    const type = new GraphQLEnumType({
      name: typeName,
      values: Object.keys(datasetsConfig)
        .filter(datasetId => datasetsConfig[datasetId][methodName] !== undefined)
github artsy / metaphysics / src / schema / v2 / edition_set.ts View on Github external
import Dimensions from "./dimensions"
import {
  GraphQLString,
  GraphQLBoolean,
  GraphQLObjectType,
  GraphQLEnumType,
  GraphQLFieldConfig,
  GraphQLFloat,
} from "graphql"
import { capitalizeFirstCharacter } from "lib/helpers"
import { Sellable } from "./sellable"
import { ResolverContext } from "types/graphql"
import { listPrice } from "./fields/listPrice"

export const EditionSetSorts = {
  type: new GraphQLEnumType({
    name: "EditionSetSorts",
    values: {
      PRICE_ASC: {
        value: "price",
      },
    },
  }),
}

const EditionSetAvailabilities = [
  "sold",
  "on hold",
  "on loan",
  "permanent collection",
]
github artsy / metaphysics / src / schema / home / home_page_artwork_modules.js View on Github external
return modules
  }
  const unordered = modules.slice(0)
  const reordered = []
  preferredOrder.forEach(key => {
    remove(unordered, mod => {
      if (mod.key === key) {
        reordered.push(mod)
        return true
      }
    })
  })
  return reordered.concat(unordered)
}

const HomePageArtworkModuleTypes = new GraphQLEnumType({
  name: "HomePageArtworkModuleTypes",
  values: {
    ACTIVE_BIDS: {
      value: "active_bids",
    },
    CURRENT_FAIRS: {
      value: "current_fairs",
    },
    FOLLOWED_ARTIST: {
      value: "followed_artist",
    },
    FOLLOWED_ARTISTS: {
      value: "followed_artists",
    },
    FOLLOWED_GALLERIES: {
      value: "followed_galleries",
github Asymmetrik / graphql-fhir / src / resources / 1_0_2 / inputs / subscription.input.js View on Github external
fields: () => ({
		resourceType: {
			type: new GraphQLNonNull(
				new GraphQLEnumType({
					name: 'Subscription_Enum_input',
					values: { Subscription: { value: 'Subscription' } },
				}),
			),
			description: 'Type of resource',
		},
		_id: {
			type: require('./element.input.js'),
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
		id: {
			type: IdScalar,
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
github Asymmetrik / graphql-fhir / src / resources / 3_0_1 / schemas / medicationadministration.schema.js View on Github external
fields: () => ({
		resourceType: {
			type: new GraphQLNonNull(
				new GraphQLEnumType({
					name: 'MedicationAdministration_Enum_schema',
					values: {
						MedicationAdministration: { value: 'MedicationAdministration' },
					},
				}),
			),
			description: 'Type of resource',
		},
		_id: {
			type: require('./element.schema.js'),
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
		id: {
			type: IdScalar,
			description:
github Asymmetrik / graphql-fhir / src / resources / 1_0_2 / schemas / domainresource.schema.js View on Github external
fields: () => ({
		resourceType: {
			type: new GraphQLNonNull(
				new GraphQLEnumType({
					name: 'DomainResource_Enum_schema',
					values: { DomainResource: { value: 'DomainResource' } },
				}),
			),
			description: 'Type of resource',
		},
		_id: {
			type: require('./element.schema.js'),
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
		id: {
			type: IdScalar,
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
github graphql-js / graphene / src / definitions / enum.ts View on Github external
export const EnumType = (opts: EnumTypeConfig = {}) => <
  T extends { new (...args: any[]): {}; [key: string]: any }
>(
  target: T
): T => {
  let values: GraphQLEnumValueConfigMap = {};
  getStaticProperties(target).forEach(name => {
    values[name] = {
      value: target[name],
      description: getDescription(target, name),
      deprecationReason: getDeprecationReason(target, name)
    };
  });
  setGraphQLType(
    target,
    new GraphQLEnumType({
      name: opts.name || target.name,
      description: opts.description || getDescription(target),
      values: values
    })
  );
  return target;
};
github Asymmetrik / graphql-fhir / src / resources / 1_0_2 / inputs / order.input.js View on Github external
fields: () => ({
		resourceType: {
			type: new GraphQLNonNull(
				new GraphQLEnumType({
					name: 'Order_Enum_input',
					values: { Order: { value: 'Order' } },
				}),
			),
			description: 'Type of resource',
		},
		_id: {
			type: require('./element.input.js'),
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},
		id: {
			type: IdScalar,
			description:
				'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',
		},