Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with apollo server v3 #56

Open
PinkaminaDianePie opened this issue Aug 19, 2021 · 8 comments
Open

Doesn't work with apollo server v3 #56

PinkaminaDianePie opened this issue Aug 19, 2021 · 8 comments

Comments

@PinkaminaDianePie
Copy link

It doesn't work after migrating to apollo server v3, no errors is thrown, but no directives actually produce errors in info.validationErrors

@cabelitos
Copy link
Contributor

cabelitos commented Aug 19, 2021

@PinkaminaDianePie could you please provide a minimal reproducible example?
thank you.

  • Which directive are you using?
  • A simple example would be nice

@PinkaminaDianePie
Copy link
Author

@cabelitos hi, that's an issue for all of the directives.
Steps to reproduce:

  1. In the root of apollo-validation-directives repo run yarn add apollo-server @graphql-tools/schema
  2. In the examples/value-validation-directives.ts file replace import { makeExecutableSchema } from 'graphql-tools'; by import { makeExecutableSchema } from '@graphql-tools/schema';
  3. Run yarn example:value-validation - there will be TS error on schemaDirectives: { listLength, pattern, range, stringLength }, line. Removing this line will allow the project to start, but it will obviously fail all of the tests.

Note that using latest '@graphql-tools/schema'; package is recommended by the Apollo v3 migration guide here: https://www.apollographql.com/docs/apollo-server/migration/#schemadirectives so downgrading @graphql-tools/schema back to the old graphql-tools sounds as a not that good option - it might cause some issues with other Apollo server v3 features later.

@cranberyxl
Copy link

Has anyone figured out a way to use these directives with apollo server 3?

@adavis
Copy link

adavis commented Mar 10, 2022

Has anyone figured out a way to use these directives with apollo server 3?

Did you ever get this to work? Or did you find a workaround? Thanks

@cranberyxl
Copy link

We have not sorted it out. We either need to find a way to adapt v2 plugins to v3, find a v3 plugin that does this, or port the functionality that we use to our own plugin.

@DDDKnightmare
Copy link
Contributor

This option may be a good temporary workaround, if you are still using graphql@^15.x

@barbieri barbieri mentioned this issue Jul 20, 2022
@oliveirarleo
Copy link

We are implementing it right now.

@PinkaminaDianePie
Copy link
Author

@oliveirarleo btw if you have limited time/money, you can use this one instead: https://www.npmjs.com/package/graphql-constraint-directive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants