-
Notifications
You must be signed in to change notification settings - Fork 925
chore: improve dynamic parameter validation errors #18501
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
0e3dc00
to
a51570a
Compare
0923f4d
to
817afe8
Compare
4f52076
to
c1d05a0
Compare
817afe8
to
21556db
Compare
c1d05a0
to
129235b
Compare
21556db
to
5f30d20
Compare
129235b
to
6a5ee9e
Compare
5f30d20
to
40063cd
Compare
0523a2f
to
f4e5548
Compare
686b2f7
to
6849a80
Compare
f4e5548
to
0523a2f
Compare
0523a2f
to
82af2e0
Compare
6849a80
to
a5f35dd
Compare
a5f35dd
to
3c2904c
Compare
Diagnostics hcl.Diagnostics | ||
Parameter map[string]hcl.Diagnostics |
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.
suggestion: unexport and return a clone via method?
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.
No one should really mutate the diagnostics. But I can do that 👍
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.
Actually I am going to leave it for now. If I make a method to export it, I would either need 1 method to return both diag sets. Or 2 methods. I think the usage is less intuitive in those cases.
func (e *ResolveError) Diagnostics()(hcl.Diagnostics, map[string]hcl.Diagnostics)
// Or
// This name is not ideal, since Diagnostics does not include the parameter ones :thinking:
func (e *ResolveError) Diagnostics()(hcl.Diagnostics)
func (e *ResolveError) ParameterDiagnostics()(map[string]hcl.Diagnostics)
coderd/httpapi/httperror/wsbuild.go
Outdated
Validations: nil, | ||
} | ||
|
||
for name, diag := range parameterErr.Parameter { |
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.
suggestion: sort map keys for deterministic output?
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.
Good idea 👍
What this does
The current
BuildError
response fromwsbuilder
does not support rich errors from validation. Changed this to use theValidations
block of codersdk responses to return all errors for invalid parameters.Example http response
Cli error