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

Allow to override existing schema with GraphQL-faker #156

Open rossoha opened 3 years ago

rossoha commented 3 years ago

At the moment faker doesn't allow to override fields that already on the backend, but there might be a situation when existing API is not yet implemented and return some default value (like null). So it would be nice to have a way to override such a response.

Example error message: Field "User.firstName" already exists in the schema. It cannot also be defined in this type extension.

Example schema from server:

type User {
    _instanceName: String
     id: UUID
    firstName: String
    lastName: String
}

Example extension file content :

extend type User {  
  firstName: String @fake(type: firstName)
}