mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
autogenerate type when possible
This commit is contained in:
parent
d102044ef4
commit
987d537b15
1 changed files with 4 additions and 1 deletions
|
@ -147,9 +147,12 @@ export const GraphQLSchema = {
|
|||
// get resolver name from resolveAs object, or else default to field name
|
||||
const resolverName = field.resolveAs.fieldName || fieldName;
|
||||
|
||||
// use specified GraphQL type or else convert schema type
|
||||
const fieldGraphQLType = field.resolveAs.type || fieldType;
|
||||
|
||||
// if resolveAs is an object, first push its type definition
|
||||
// include arguments if there are any
|
||||
mainSchema.push(`${resolverName}${field.resolveAs.arguments ? `(${field.resolveAs.arguments})` : ''}: ${field.resolveAs.type}`);
|
||||
mainSchema.push(`${resolverName}${field.resolveAs.arguments ? `(${field.resolveAs.arguments})` : ''}: ${fieldGraphQLType}`);
|
||||
|
||||
// then build actual resolver object and pass it to addGraphQLResolvers
|
||||
const resolver = {
|
||||
|
|
Loading…
Add table
Reference in a new issue