graphile-engine icon indicating copy to clipboard operation
graphile-engine copied to clipboard

Draft: Update Resolvers type to support Scalar

Open Alx101 opened this issue 3 years ago • 1 comments

Description

Fixes missing type definition (GraphQLScalarType) for Resolvers in makeExtendSchemaPlugin.ts Discord

Performance impact

unknown

Security impact

unkown

Checklist

  • [x] My code matches the project's code style and yarn lint:fix passes.
  • [ ] I've added tests for the new feature, and yarn test passes.
  • [ ] I have detailed the new feature in the relevant documentation.
  • [ ] I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • [x] If this is a breaking change I've explained why.

Alx101 avatar Sep 07 '22 09:09 Alx101

Thanks for your contribution! To merge this as an officially supported interface we need a test that ensures it works. Doing so isn't too complex:

  1. Create yourself a plugin using this functionality; here's an example ToyCategoriesPlugin we use in the tests: https://github.com/graphile/graphile-engine/blob/v4/packages/postgraphile-core/tests/integration/ToyCategoriesPlugin.js
  2. Add a config boolean that enables your plugin; here's the one we use with ToyCategoriesPlugin: https://github.com/graphile/graphile-engine/blob/5a146e2f8f4b17fc64a97bcc7e869337c8198457/packages/postgraphile-core/tests/helpers-v5.js#L472
  3. Add a test GraphQL file that uses this functionality, it must end in .test.graphql and it must contain the special #> MyPluginNameHere: true config line; here's an example for the ToyCategoriesPlugin: https://github.com/graphile/graphile-engine/blob/06dddf87125a7c0b7ff24417aed75c9517216761/packages/postgraphile-core/tests/queries/base/named_query_builder.toys.test.graphql#L4
  4. Be sure that your GraphQL test file actually queries your scalar!

Once that's done, run the tests via UPDATE_SNAPSHOTS=1 yarn test inside the packages/postgraphile-core folder and your GraphQL query will be executed and the relevant snapshots will be created - check that they're sensible, and if so, go ahead and commit them.

benjie avatar Sep 07 '22 09:09 benjie

Going to close this for now; feel free to re-open it with a test :heart:

benjie avatar Sep 27 '23 14:09 benjie

Supported in V5: https://github.com/graphile/crystal/pull/1760

benjie avatar Sep 27 '23 15:09 benjie