Closed
Description
Can somebody share proper way how to pass directives
for fields when creating type via GraphQLObjectType
? I want to integrate graphql-cost-analysis to our GraphQL Schema.
A astNode: FieldDefinitionNode in GraphQLFieldConfig
is ReadOnly and there is now way to write directives via object config. Or i something missing?
Desired way to declare directive will be such:
const UserType = new GraphQLObjectType({
name: 'User',
fields: {
name: {
type: GraphQLString,
description: '...',
resolve: () => ...,
directives: [
{ name: 'cost', args: { useMultipliers: false, complexity: 2 } },
{ name: 'unique' },
],
// or maybe simpler if graphql spec does not allow duplicated names
directives: {
cost: { useMultipliers: false, complexity: 2 },
unique: true,
},
},
},
});
Metadata
Metadata
Assignees
Labels
No labels