How to use the graphql-compose.schemaComposer.createInputTC function in graphql-compose

To help you get started, we’ve selected a few graphql-compose 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 graphql-compose / graphql-compose-aws / src / types / AwsConfigITC.js View on Github external
/* @flow */

import { schemaComposer } from 'graphql-compose';

export default schemaComposer.createInputTC({
  name: 'AwsConfig',
  fields: {
    accessKeyId: 'String',
    secretAccessKey: 'String',
    region: 'String',
  },
});
github graphql-compose / graphql-compose-relay / src / __tests__ / wrapMutationResolver.js View on Github external
it('should create args.input if not exists and move all args into it', () => {
      expect(Object.keys(fieldConfigManyArgsWithoutInput.args)).toEqual(
        expect.arrayContaining(['input'])
      );

      const type: any = getNamedType(fieldConfigManyArgsWithoutInput.args.input.type);
      const itc = schemaComposer.createInputTC(type);
      expect(itc.hasField('sort')).toBe(true);
      expect(itc.hasField('limit')).toBe(true);
      expect(itc.hasField('clientMutationId')).toBe(true);
    });
github graphql-compose / graphql-compose-relay / src / __tests__ / wrapMutationResolver.js View on Github external
it('should add `clientMutationId` field to args.input', () => {
      const itc = schemaComposer.createInputTC(fieldConfig.args.input.type);
      expect(itc.hasField('clientMutationId')).toBe(true);
      expect(itc.getFieldType('clientMutationId')).toBe(GraphQLString);
    });
github graphql-compose / graphql-compose-aws / src / AwsParam.js View on Github external
shapes?: AwsShapes
  ): InputTypeComposer {
    const fields = {};

    if (param.members) {
      Object.keys(param.members).forEach(fname => {
        fields[fname] = this.convertParam(
          param.members[fname],
          `${name}${upperFirst(fname)}`,
          true,
          shapes
        );
      });
    }

    const itc = schemaComposer.createInputTC({
      name: `${name}Input`,
      fields,
    });

    if (Array.isArray(param.required)) {
      itc.makeRequired(param.required);
    }

    return itc;
  }