Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(core):fix missing info of flattened_errors #13998
fix(core):fix missing info of flattened_errors #13998
Changes from 1 commit
76cb75e
913c513
8a4b940
87b904e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Seems the error message is always
string
?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.
@outsinre maybe nil, or table.
err_t[ref.field]
just likefield_err_t
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.
If
parent_idx
isnil
, thentostring(parent_idx)
istrue
.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.
@outsinre
i think
tostring(nil)
maybenil
?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.
The printed
nil
is a string, not the Luanil
.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.
The
errs_item_name
andentity
on this line refer to the same thing?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.
@outsinre no.
entity
is its original name.errs_item_name
is key name oferrs
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.
The
400
error is due to DB-less by default does not support this kind of format. DB-less uses declarative format that needs all entities flattened at top-level.It expects the
snis
not nested within thecertificates
.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.
Hmm 🤔 I don't know if it's possible to properly flatten errors in this case, because the result we get from the declarative validator is ambiguous. Consider this input:
It has the following duplicates:
consumers[1].basicauth_credentials[4]
(user-11
)consumers[3].basicauth_credentials[1]
(user-01
)consumers[3].basicauth_credentials[3]
(user-02
)consumers[3].basicauth_credentials[4]
(user-33
)The error table we receive from
:parse_table()
looks like this:consumers[1].basicauth_credentials[4]
with the error inconsumers[3].basicauth_credentials[4]
(presumably because they both happened at index4
)basicauth_credentials
error corresponds toIn summary, I don't think this can be fixed in the error-flattening code alone. A fix within
kong.db.schema.others.declarative_config
must be made first.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.
@flrgh
I try to add your inputs to test case, it can get 4 results.
Is this what you need?