graphql-code-generator-community
graphql-code-generator-community copied to clipboard
'e.map is not a function' while generating C-Sharp
Which packages are impacted by your issue?
@graphql-codegen/c-sharp-operations
Describe the bug
While giving a query a name, code generations fails with : 'e.map is not a function'
Your Example Website or App
https://the-guild.dev/graphql/codegen
Steps to Reproduce the Bug or Issue
- Go to 'https://the-guild.dev/graphql/codegen'
- Select 'C# Operations'
- Observe the issue in 'Type.cs'
Expected behavior
Class "findUser" gets generated
Screenshots or Videos
No response
Platform
using demo website
Codegen Config File
No response
Additional context
No response
I try to use this plugin in my project and also see this error:
any idea about how to quick solve this?
I've also all the sudden been getting this issue, are we sure that it happens because of setting names on a query? The error for me just started and I have no clue what I've changed, but having names on queries is something I've had since before the error started occurring.
Also, generating typescript works just fine still with the same files.
@barryyeee I solved it in my project by downgrading the "c-sharp-operations" package to 2.2.14
@ullmark @barryyeee @jurkrit Any update? Last time I looked at the c-sharp plugin source code it was riddled with bugs. I was hoping v3 was going to fix these things.
Same or similar issue here: "fragmentNames.map is not a function". Downgrading to 2.2.14 solved it.
Has anyone been kind enough to take the time to investigate this issue and help triage it for the community? I've been getting familiar with this package by utilizing it in my project. But like others here, I am required to downgrade to version 2.2.14 to avoid the "fragmentNames.map is not a function" bug.
It is a bit of a poor developer experience when the latest version of a package is broken for the community. Now that I'm at least familiar with this package's usage, I could try my hand at looking at the source code to see what is going on.
It might be more effective to tag some of the authors in hopes someone might know what is going on. I saw that @dimaMachina committed 21 months ago. Also @ardatan, @gilgardosh had commits to 2 years a go.
It would be nice to get more eyes on this to at least get this package in working condition for the community. We'll worry about adding more features once we're at least confident that the basic code generation features are stable. Please comment if you can point out any specific lines of code that may be of interest. Thanks 🎐
Any update on this?
I've got pretty much the same issue. Somehow, downgrading to 2.2.14 didn't fix it for me. This is my dependencies property in package.json
"dependencies": {
"@graphql-codegen/c-sharp-operations": "^2.2.14",
"@graphql-codegen/cli": "^4.0.1"
}
And this is my demo config.ts
import type {CodegenConfig} from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: "https://rickandmortyapi.com/graphql",
documents: ["./**/*.graphql"],
generates: {
"./MyTypes.cs": {
plugins: ["c-sharp-operations"],
config: {
namespaceName: "GqlDemo",
documentMode: "documentNode",
typesafeOperation: true,
namingConvention: {
typeNames: 'change-case-all#pascalCase',
enumValues: 'change-case-all#pascalCase',
},
},
},
},
};
export default config;
Any input is appreciated!
@saihaj do you have any idea how to fix this? I'm not familiar enough with the code. Maybe others who contributed could chime in?
@saihaj do you have any idea how to fix this? I'm not deep familiar enough with the code. Maybe other who contributed could chime in?
This one is purely community driven and I am afraid I can be of any help. I would have to spend time myself to understand the code
Anyone here wants to have a look at my analysis of the issue and my PR to fix it(#820)?
@jurkrit the PR to fix this was recently merged. Can you have a look and report back. I hope we can close the issue now.
I need to work on releasing the patch version
released @graphql-codegen/[email protected], @graphql-codegen/[email protected], @graphql-codegen/[email protected]
Excellent news! Thank you @saihaj