JCMais/graphql-yup-middleware

not working with graphql v15

Closed this issue · 6 comments

graphql v15 is more strict about graphql fields

you need to move them to extensions

@sibelius Which extensions did you refer to? Could you add link to the doc if there's any? I'm also looking into other options. Thanks!

export const getMutationExtensions = (
  info: GraphQLResolveInfo,
  mutationName: string,
): GraphQLFieldConfigMap<any, GraphQLContext> | null => {
  const mutationType = info.schema.getMutationType();
  if (!mutationType) {
    return null;
  }

  const fields = mutationType.getFields();

  return fields[mutationName].extensions;
};

on v14 graphql returned everything inside getFields(), however now, you need to explicit use extensions to store yup schema or something else

@mymywang it's related to this proposal that was added on GraphQL 15: graphql/graphql-js#1527

I should be able to do something about it this weekend.

I've pushed graphql-yup-middleware@next as a pre-release version with support for the extensions field, the readme was updated accordingly. Anyone is welcome to test it and post feedback here.

That's awesome!
I'll give a try ASAP and bring feedback.

graphql-yup-middleware@1.0.0 has been released with support to (only) GraphQL v15 using the extensions field.