microsoft / microsoft/cppgraphqlgen
Suggestion: Clearer schemagen error messages
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 350
- Forks
- 56
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 3
Description
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. :)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the schema-generation entry point referenced in cppgraphqlgen-update-schema-files.cmake at line 40, then reproduce the shown schema-generation failure. The completed change should make an invalid object type used as an argument explain that an input type is required, while preserving the existing failure behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, graphql
- Domain
- api, developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100