-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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(dbless): improve validation errors from /config #10161
Conversation
725251f
to
f96a5f1
Compare
f96a5f1
to
a33bbaf
Compare
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 great to me so far. I verified that the flattened output reflects what was discussed in the design. I understand it is still WIP so I am leaving the review as comment for now until it's ready
142ce09
to
1723fdb
Compare
e679091
to
01a3045
Compare
The initial goal was to use the processed input when generating the final error array. |
83af116
to
e041d3c
Compare
Rebased onto master just now. I'm cherry-picking to EE to hopefully make sure there are no surprises over on that side. |
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.
A few questions but overall I think its looking great. I would like to get 1 more review's eyes on this if possible, but the test cases look good
8b547f6
to
9191229
Compare
This reverts commit 44f425b.
summary
This is a quality-of-life feature for the
/config
endpoint in dbless mode.the problem
When the configuration passed into
POST /config
has validation errors, the raw structures fromkong.db.schema
are returned. Here's an example where a single service is missing the value for thehost
property and contains an invalid value for theport
property:The errors are not correlated to the input entity in any meaningful way, so this gets very confusing once you have more than a couple entities--especially if they are nested underneath other entities (i.e.
service.routes
).the solution
This PR adds an optional
flatten_errors
query param to the endpoint. When truth-y (e.g.POST /config?flatten_errors=1
), errors are reshaped and attached to the response in aflattened_errors
array at the top level (old fields are retained for backwards compatibility). Here's what the previous response looks like withflatten_errors
turned on:PR status
This is ready for merge after an approving review or two.
todofix tests broken by the changes made tokong.db.declarative
flattened
array optional via query param (?)