Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GraphQL CRUD partial updates
/* @flow */
import { GraphQLNonNull } from 'graphql';
export default function makeRequired(partial?: boolean) {
if (partial) {
return (type: mixed) => type;
}
return (type: mixed) => new GraphQLNonNull(type);
}
/* @flow */
import { GraphQLString } from 'graphql';
import makeRequired from './makeRequired';
export default function widgetFields(partial?: boolean) {
const required = makeRequired(partial);
return {
name: { type: required(GraphQLString) },
description: { type: GraphQLString },
color: { type: required(GraphQLString) },
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.