Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field ignored if it has the same method name as another field #269

Open
floge07 opened this issue Dec 13, 2024 · 3 comments
Open

Field ignored if it has the same method name as another field #269

floge07 opened this issue Dec 13, 2024 · 3 comments

Comments

@floge07
Copy link

floge07 commented Dec 13, 2024

Hi,

the current versions can't seem to handle something like this:

[Name("getItem")
public object getItem(string id)
{
    ...
}

[Name("getItemByIdAndPath")
public object getItem(string id, string path)
{
    ...
}

In this case, we get this error:
Cannot query field "getItemByIdAndPath" on type "Query"

It seems it just gets ignored while parsing and doesn't exist.

Luckily, we only had one occurrence of this, and the fix is easy. But still, you should probably be made aware of this.

GraphQL: 8.2.1
GraphQL.Server.Transports.AspNetCore: 8.2.0
GraphQL.Convetions: 8.0.0

@Shane32
Copy link
Member

Shane32 commented Dec 13, 2024

I don’t think the conventions project was ever made to be compatible with GraphQL.NET’s attributes for its type-first definitions. You might check that you’re referencing GraphQL.Comventions.NameAttribute and not GraphQL.NameAttribute.

@floge07
Copy link
Author

floge07 commented Dec 13, 2024

Yeah, the NameAttribute from the main GraphQL namespace has never worked, these are all definitely the ones from the GraphQL.Conventions namespace.

And this exact setup worked before I updated the packages.
I just noticed that I didn't make this clear in this issue. Not sure if you noticed that I'm the same guy from the other two recent issues ^^.

These were the previous versions:
GraphQL: 7.2.0
GraphQL.Server.Transports.AspNetCore: 7.1.1
GraphQL.Convetions: 7.0.0

So I'm pretty sure in saying this is a new problem. And, like I said, the workaround is simple, so I don't really need you this fix this.
But it should be mentioned somewhere. At least as far I could see, the Conventions project doesn't have a migration guide?

@Shane32
Copy link
Member

Shane32 commented Dec 13, 2024

There's been hardly any changes since v4; just a couple bug fixes. I've tried to assist making the minimal changes to keep the repository to compile with the latest versions. As such, it shouldn't need a migration guide. Any changes are probably unintentional and/or bugs.

There's a whole bunch of tests to ensure that the [Name] attribute works correctly, and all tests pass with GraphQL.NET 8, so I really don't know what the problem would be.

If you can write a code snippet which reproduces the problem, then perhaps @tlil or I can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants