openapi-to-graphql-nullable
Version:
Fork of openapi-to-graphql that fixes nullable handling. Published to NPM since there's no other easy way to consume a Lerna package. Unmaintained.
30 lines (26 loc) • 725 B
text/typescript
// 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, GraphQLString } from 'graphql'
/**
* Returns empty GraphQLObjectType.
*/
export function getEmptyObjectType(name: string): GraphQLObjectType {
return new GraphQLObjectType({
name: name + 'Placeholder',
description: 'Placeholder object',
fields: {
message: {
type: GraphQLString,
description: 'Placeholder field',
resolve: () => {
return 'This is a placeholder field.'
}
}
}
})
}