graphql-compose-mongoose icon indicating copy to clipboard operation
graphql-compose-mongoose copied to clipboard

Enum values on sort when using mergeSchemas with reproduce issue repo

Open JaosnHsieh opened this issue 6 years ago • 2 comments

refer to this issue

https://github.com/graphql-compose/graphql-compose-mongoose/issues/147#issuecomment-455115861

when using mergeSchemas from graphql-tools with graphql-tools defined schema and graphql-compose-mongoose generated schema, there will get Variable "$_v1_sort" got invalid value {role: 1}; Expected type SortFindManyUserInput.', on enum field.

Issue reproduce repo

https://github.com/JaosnHsieh/graphql-compose-mongoose-enum-issue-reproduce

JaosnHsieh avatar Jan 21 '19 13:01 JaosnHsieh

@JaosnHsieh I'll see it only at the end of the next week (

Tomorrow I'll move to another country for a meetup, workshop, and one corporate training. And will be busy about 8 days.

Please drop a line in this issue after 1 February if I'll not answer to you before. Thanks.

nodkz avatar Jan 21 '19 15:01 nodkz

Proposal

For me to consider in the end of month:

Add SchemaComposer.loadSchema() method (or maybe need to find a better name) which will load any GraphQLSchema object and via traversing all existed types will extend existed types or create them in SchemaComposer.


// prepare schema via apollo tooling
const apolloSchema = makeExecutableSchema({ typeDefs, resolvers });

// load schema to graphql-compose 
schemaComposer.loadSchema(apolloSchema);

// modify types or resolvers of any type
schemaComposer.getTC('SomeType')....some_modification_methods();

// or create a new types
const UserTC = composeWithMongoose(User);
schemaComposer.Query.setFields({ userPagination: UserTC.getResolver('pagination') });

// build a new GraphQLSchema with stitched types
export default schemaComposer.buildSchema();

Not implemented yet

nodkz avatar Jan 21 '19 15:01 nodkz