UNPKG

openapi-to-graphql-lxwang2

Version:

Generates a GraphQL schema for a given OpenAPI Specification (OAS)

36 lines (32 loc) 834 B
// Copyright IBM Corp. 2018. All Rights Reserved. // Node module: openapi-to-graphql // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT /** * Utilities related to GraphQL. */ import { GraphQLObjectType as GQObjectType, GraphQLInputObjectType as GQInputObjectType, GraphQLObjectType, GraphQLInputObjectType, GraphQLString } from 'graphql' /** * Returns empty GraphQLObjectType. */ export function getEmptyObjectType(name: string): GQObjectType { return new GraphQLObjectType({ name: name + 'Placeholder', description: 'Placeholder object', fields: { message: { type: GraphQLString, description: 'Placeholder field', resolve: () => { return 'This is a placeholder field.' } } } }) }