kloeckner-i / ember-cli-mirage-graphql

A library for mocking GraphQL with Ember CLI Mirage
MIT License
24 stars 10 forks source link

Custom directives #59

Closed knownasilya closed 3 years ago

knownasilya commented 3 years ago

Getting this:

Error: Unknown directive "specifiedBy".
    at assertValidSDL (validate.js:112)
    at Module.buildASTSchema (buildASTSchema.js:76)
    at Object.buildSchemaFromTypeDefinitions (buildSchemaFromTypeDefinitions.js:36)
    at makeExecutableSchema (makeExecutableSchema.js:53)
    at schema.js:34
    at FunctionRouteHandler.userFunction (handler.js:18)
    at FunctionRouteHandler.handle (mirage-esm.js:2995)
    at RouteHandler._getMirageResponseForRequest (mirage-esm.js:3504)
    at RouteHandler.handle (mirage-esm.js:3484)
    at Object.eval [as handler] (mirage-esm.js:8166)

With the schema having this:

"""
The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")

Is there a way to define this?

jneurock commented 3 years ago

I'm not super up-to-speed on how to define custom directives, at least from the schema perspective. Additionally, I don't know if it's enough to add a definition to the raw schema or if there needs to be some programatic addition of directives on the GraphQL JS side.

I can try to find out but, TBH, I'd be Googling. I'd be happy to look into the issue by adding a failing test to Mirage GraphQL but not to this add-on.

Side note: I'm not sure if I can still administer changes to this repo but I can open a PR to encourage adoption of Mirage GraphQL over this add-on in some way, shape or form. This add-on shouldn't be used anymore. I'll see if there's a standard way to let people know through add-on conventions.

knownasilya commented 3 years ago

Closing this since mirage/graphql works fine