-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: add validate API to standalone mode #12718
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
base: master
Are you sure you want to change the base?
feat: add validate API to standalone mode #12718
Conversation
apisix/admin/standalone.lua
Outdated
| }) | ||
| end | ||
|
|
||
| local function validate(ctx) |
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.
can we reuse this new validate function in exist update function to reduce code duplicate between those two functions?
| for _, item in ipairs(items) do | ||
| -- prevent updating resource with the same ID | ||
| -- (e.g., service ID or other resource IDs) in a single request | ||
| local duplicated, err = check_duplicate(item, key, id_set) |
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 logic of check_deuplicate exists twice, the first time in validate_configuration, and the second time is redundant.
Provide a validate API for standalone mode that only validate input like admin api but does not save input to memory.
Required for ingress controller to validate plugin configurations that convert from CRD.
Checklist