Hi. Seems that there is no way to handle custom directives. This issue was created at @IvanGoncharov's request.
I use graphql-faker to define schemas with fake data. Frontend developers feel really great with it, cause it consists of easy-to-run-graphql-server and there is no need in heavy backend, databases, etc.
$ graphql-faker --open ./schema.graphql
To fake data, schema must contain some additional directives: @fake(…) and @examples(…). They describe the true nature of entities: names, emails, phone numbers, …
type Query {
hello: String! @fake(type: firstName)
}
As a GraphQL API developer, I write the following code:
And I want the graphql parser just to ignore those @fake and @examples directives, and have a single schema.graphql file both for graphql-faker, and for my graphql API.
As a bypass I wrote a regex, though it's not reliable (context-grammar, braces, quotes, all that stuff). The better way is to resolve custom directives after grammar parsing, and custom directives handlers could help here.
Hi. Seems that there is no way to handle custom directives. This issue was created at @IvanGoncharov's request.
I use graphql-faker to define schemas with fake data. Frontend developers feel really great with it, cause it consists of easy-to-run-graphql-server and there is no need in heavy backend, databases, etc.
To fake data, schema must contain some additional directives:
@fake(…)
and@examples(…)
. They describe the true nature of entities: names, emails, phone numbers, …As a GraphQL API developer, I write the following code:
And I want the graphql parser just to ignore those
@fake
and@examples
directives, and have a singleschema.graphql
file both for graphql-faker, and for my graphql API.As a bypass I wrote a regex, though it's not reliable (context-grammar, braces, quotes, all that stuff). The better way is to resolve custom directives after grammar parsing, and custom directives handlers could help here.