-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
feat: Support @GQLDefault #1043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imports management is THE reason I can't use Metals 😆
Can you add documentation in https://github.com/ghostdogpr/caliban/blob/master/vuepress/docs/docs/schema.md#annotations ?
Looks great otherwise!
import caliban.Value.FloatValue.FloatNumber | ||
import caliban.InputValue.ObjectValue | ||
|
||
object DefaultValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultValueValidator
? To keep the naming consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming is my weakness :D
IO.fromEither(Parser.parseInputValue(v)) | ||
.mapError(e => | ||
ValidationError( | ||
s"$errorContext failed to parse default value: ${e.msg}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there always a line break at the end of the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, no I don't think so, but there are two messages, msg
and explanatoryText
.
Added docs in 37dd3a1. 👍
I've learnt to live with it. It being automatic is just too big of a convenience 😅. But it seems as if it hadn't run correctly on all files, so I've cleaned the imports up.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good, thanks!
Hi!
This hopefully closes #1010.
As discussed, I've had some trouble with validating the default values. I think this approach is sort of OK, but am happy to try other paths that might lead to less code duplication.
The error messages aren't great right now because they're lacking some context. Will improve them before marking this PR as ready to go!