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

Error while using most of the GraphQL Schema #24

Closed
kiranchandran opened this issue Jan 6, 2023 · 13 comments
Closed

Error while using most of the GraphQL Schema #24

kiranchandran opened this issue Jan 6, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@kiranchandran
Copy link

kiranchandran commented Jan 6, 2023

Describe the bug

When using most of the schema available online the tool is failing to generate the client code without compilation error.

The type or namespace name 'ID' could not be found (are you missing a using directive or an assembly reference?)

How to Reproduce

Use the below schema
curl https://workshop.chillicream.com/graphql?sdl > schema.graphql

Then generate the code using below command
dotnet zeroql generate --schema ./schema.graphql --namespace TestServer.Client --client-name TestServerGraphQLClient --output Generated/GraphQL.g.cs

Expected behavior
The code should be generated without any compilation errors

Environment (please complete the following information):

  • Nuget verion [3.2.0]
  • IDE: [VS]
  • .Net Version [6.0.400, 7.0.100]
@kiranchandran kiranchandran added the bug Something isn't working label Jan 6, 2023
@byme8
Copy link
Owner

byme8 commented Jan 6, 2023

Yeap, I forgot about the built-in ID scalar. I will have a look at it

@byme8
Copy link
Owner

byme8 commented Jan 8, 2023

@kiranchandran Checkout 3.3.0-preview.2 It should generate proper GraphQL classes.

@kiranchandran
Copy link
Author

Hi @byme8 Great, Thanks.

The issue with the ID is fixed, but it still in error state with the TimeSpan data type in GraphQL. You can use the same example https://workshop.chillicream.com/graphql?sdl to re-create the issue

@byme8
Copy link
Owner

byme8 commented Jan 9, 2023

Are you sure that you are using 3.3.0-preview.2 in ZeroQL CLI and the csproj itself? It has a fix for TimeSpan too.

@byme8
Copy link
Owner

byme8 commented Jan 9, 2023

I don't see issues with https://workshop.chillicream.com/graphql?sdl.

@kiranchandran
Copy link
Author

Hi @byme8

Yes I use the version 3.3.0-preview.2.
Here is the sample I have created. https://github.com/kiranchandran/ZeroQLDemo

@byme8
Copy link
Owner

byme8 commented Jan 9, 2023

@kiranchandran
Copy link
Author

Hi @byme8,

I forgot about that config file. I though updating the nugget package is enough.
I just changes it and it works like a charm.

I just updated the sample with another schema and I get some build error for some custom types.
If you don't mind could you please help me in that too?

Thanks in Advance
Kiran

@byme8
Copy link
Owner

byme8 commented Jan 9, 2023

Do you know how the scalar CompanyIdis implemented in the C# level?

@byme8
Copy link
Owner

byme8 commented Jan 9, 2023

I mean, on the backend

@byme8
Copy link
Owner

byme8 commented Jan 29, 2023

In your new schema, there is an interface Dealer. It is just defined but never actively used. Do you know the intention behind it?

@byme8
Copy link
Owner

byme8 commented Feb 7, 2023

Uploaded version 3.4.0. It can generate proper classes from your new schema. I have tried to test as much as possible, but your schema looks like broken or changed manually. Still, I managed to generate code that at least was able to compile and pass test cases that I managed to replicate with the HotChocolate server.

@byme8 byme8 closed this as completed Feb 7, 2023
@kiranchandran
Copy link
Author

Hi @byme8

Thanks for following up and fixing this in the package. In fact I was looking for this for a project which is not active right now. But I appreciate you took time to get this fixed.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants