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

Suggestion: Clearer schemagen error messages #300

Open
ckaminski opened this issue May 28, 2024 · 0 comments
Open

Suggestion: Clearer schemagen error messages #300

ckaminski opened this issue May 28, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@ckaminski
Copy link

Using the schema:

type ContactMethod { 
    id:     ID
    name:   String
    method_type: ContactMethodType
    method: ContactMethodValue
}
type Query { 
    getContactById(id: ID) : Contact
    getContactsByName(search: String) : [Contact]
    #getContactsByContactMethod(search: String) : [Contact]
    getContactsByContactMethod(search: ContactMethod) : [Contact]
}

I get the error message below when building:

Generating graphqllib GraphQL schema
Invalid argument type: ContactMethod line: 69 column: 32
CMake Error at C:/repos/cpp/appserver/x64-windows/vcpkg_installed/x64-windows/share/cppgraphqlgen/cppgraphqlgen-update-schema-files.cmake:40 (message):
Schema generation failed!

I modify this as follows and it works - perhaps it could point out it should be an input type if not a built-in?

type ContactMethod { 
    id:     ID
    name:   String
    method_type: ContactMethodType
    method: ContactMethodValue
}
input ContactMethodQueryInput { 
    name:   String
    method_type: ContactMethodType
}
type Query { 
    getContactById(id: ID) : Contact
    getContactsByName(search: String) : [Contact]
    #getContactsByContactMethod(search: String) : [Contact]
    getContactsByContactMethod(search: ContactMethodQueryInput) : [Contact]
}

Yeah, I'm pretty rusty at GraphQL - this took longer for me to find that I was happy with. :)

@wravery wravery added the good first issue Good for newcomers label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants