7.10.0 (2020-02-05)
Features
- add AnyTC to
astNode
converter. It's preparation for setDirectives() methods and printing added directives to SDL (for ApolloFederation support see #214). (8a5b1ce) - EnumTypeComposer: add
setDirectives()
,setFieldDirectives()
methods (69773ae) - InputTypeComposer: add
setDirectives()
,setFieldDirectives()
methods (81fab6c) - InterfaceTypeComposer: add
setDirectives()
,setFieldDirectives()
,setFieldArgDirectives()
methods (726856c) - ObjectTypeComposer: add
setDirectives()
,setFieldDirectives()
,setFieldArgDirectives()
methods (2f49d3f) - ScalarTypeComposer: add
setDirectives()
method (a6a434e) - UnionTypeComposer: add
setDirectives()
method (a386990)
Now graphql-compose supports Directive modification and printing them to SDL:
import { schemaComposer } from 'graphql-compose';
schemaComposer.createObjectTC(`type Location { city: String }`);
schemaComposer.createObjectTC(`type User { id Int location: Location }`);
UserTC.setDirectives([{ name: 'key', args: { fields: 'id } }]);
UserTC.setFieldDirectives([{ name: 'external' }]);
console.log(UserTC.toSDL({ deep: true }));
// Will print something like:
// type User @key(fields: "id") { id: Int @external location: Location }
// type Location { city: String }
Method toSDL({ deep: true })
will be very useful for Apollo Federation.
Before complete supporting of the Apollo Federation, It's required to implement resolver exports.
You may follow issue #214 for more details.