Closed vitorcamachoo closed 2 years ago
Hi,
It's probably an issue with typenames: pascal-case
, can you try without this option?
If it doesn't work, can you check if it's due to prefix
option as well?
PRs are welcomed to fix this bug, but if you can't, can you provide a unit test or repository to reproduce ?
Thanks
I've tried with multiple configurations. The first thing I'm seeing is the top import when I'm trying to reuse types, I have my types on PascalCase and it's importing as lowercase. The order thing is the reuse of the factory functions, for example mockUser
(with prefix mock
, also the default have the same problem) is defined, but on the rest of the other factories that will use this mockUser
it is being written as mockuser
as lowercase.
By the way, this plugin will be very helpful to my team 🙌
@vitorcamachoo I think it's because your typenames
config is wrong
It should be:
plugins:
- typescript-mock-data
config:
typesFile: ./types.ts'
typenames: 'pascal-case#pascalCase'
prefix: 'mock'
See documentation
Hi @ardeois, with the configuration that you wrote, I get the same errors like you can see on the attached screenshots:
Could you provide me a repo to reproduce? I tried to reproduce in local and was not able to reproduce.
I'm getting this same, but so far I'm struggling to create a minimal reproduction. I'll post an update as soon as I can.
@ardeois A colleague found that the root of this bug is in the graph definition itself
type someThing
)Here's an example with a failing test https://github.com/ardeois/graphql-codegen-typescript-mock-data/compare/master...ccblaisdell:fix-pascalcase-in-mock-dependencies?expand=1
Hii,
I'm getting wrong typeNames when reusing types from another generated files and for the functions that are being reused inside mock generated file like you can check in the screenshot: Configuration:![Screenshot 2021-02-10 at 11 46 05](https://user-images.githubusercontent.com/20595956/107506124-8fb16980-6b95-11eb-8519-798bddbbf453.png)
Result:![Screenshot 2021-02-10 at 11 46 17](https://user-images.githubusercontent.com/20595956/107506142-96d87780-6b95-11eb-9dfc-34544a28ae14.png)