Add ability to specify local mock file
See original GitHub issueFirst off, this project is amazing. It’s extremely useful for bootstrapping an app before the graphql server exists.
The faker methods are extremely useful, but I’m finding myself wishing I could run custom code to generate what I need in certain scenarios.
What if there was something like this
schema.faker.graphql
type JiraIssue {
id: ID @fake(type: uuid)
key: String @fake(type: mock, func: "jiraIssue")
}
graphql-faker-mocks.js
// Imagine this function does something more exciting
export const jiraIssue = () => 'ABC-123'
The semantics here might not be great. It could be a separate directive or the parameters could be different. Ultimately the idea is just to be able to custom mocks.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to mock File in javascript? - Stack Overflow
The project consists of an audio player which has the ability to drag'n'drop files in a playlist. I'm using Jasmine as a testing...
Read more >Using Mock to test package builds - Fedora Project Wiki
First, install the mock package, which is available from Fedora Package ... If you want to set up a local mirror, refer Docs/Drafts/ ......
Read more >How to Quickly Mock an API Server in a Client-Side Project
I'm imagining a web application that allows users to upload files, then it shows a list of all the files that have been...
Read more >Setting up a Local Mock API for your Front-end (React) Project
The solution was to start shipping all my frontend projects with a local mock API that matched the interface of the real backend...
Read more >Setting up mock servers | Postman Learning Center
In the sidebar, select New and select Mock Server. ... Select an existing collection, or create a new collection and add an initial...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah I see the use case where you need a constant predicted result, this might be useful for writing unit tests. Any progress on that @zephraph ?
Any news on this? It would be really interesting to be able to call a custom function to generate mock data for
@fake
and@examples
directives.