graphql-kit / graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.
MIT License
2.69k stars 225 forks source link

Add support for `@override` directive #135

Open Ackar opened 3 years ago

Ackar commented 3 years ago

Add support for an @override directive as mentionned in https://github.com/APIs-guru/graphql-faker/issues/17#issuecomment-487934463

This works by finding all the fields with an @override directive in the extension schema and removing them from the source schema.

hotsezus commented 3 years ago

This PR solves new directive problem but i'm not sure if editor works properly when extending remote type and overriding some field. We need to be sure editor will not output that local field is already defined in remote schema.

Ackar commented 3 years ago

@AlexDerbenew It does work properly overriding remote types fields.

For example, running graphql-faker --extend http://swapi.apis.guru we can define the following extension schema:

extend type Film {
  title: String @override @fake(type: words)
}
Ackar commented 3 years ago

@IvanGoncharov Any thoughts on this?

NShahri commented 3 years ago

@IvanGoncharov is there any plan to merge or support this feature?

moimikey commented 3 years ago

this is the only thing stopping me from continuing to use this lib. @override is needed.