zhouzi/graphql-codegen-factories

Make the overrides optional

ertrzyiks opened this issue · 4 comments

Currently the overrides props param is required

export function createQueryMock(props: Partial<Query>)

which means that even if we don't want any specific field value to be override we still need to pass an empty object

createBlogListQueryQueryMock() // invalid
createBlogListQueryQueryMock({}) // valid

I suggest to add a default param for convenience:

export function createQueryMock(props: Partial<Query> = {})

Agreed, that would make up for a better experience 👍 Would you be interested in adding that to the schema plugin? I am currently working on fixing a few issues with the operations plugin in #45 so I can add it to that plugin there.

I can work on a PR to add it to the schema plugin

This was done for the schema through #47. We will close this issue once it's also done for the operations, probably through #45

This is now also done for the operations through #45. Thanks for the report and contribution 🙏