refactor(admin): refactor resource routes#8611
Merged
Merged
Conversation
spacewander
reviewed
Jan 6, 2023
|
|
||
| local res, err = core.etcd.get(key, not id) | ||
| if not res then | ||
| core.log.error("failed to get " .. self.kind .. "[", key, "] from etcd: ", err) |
Member
There was a problem hiding this comment.
The log function will concat the string, no need to do it ourselves
spacewander
reviewed
Jan 6, 2023
| local code, err, node_val = core.table.patch(node_value, sub_path, conf) | ||
| node_value = node_val | ||
| if code then | ||
| return code, err |
Member
There was a problem hiding this comment.
Look like we need to use {error_msg = err} here?
|
|
||
|
|
||
| return _M | ||
| return resource.new("routes", "route", check_conf) |
Member
There was a problem hiding this comment.
I think about it a bit.
Maybe it would be better to pass an opt like:
{
name = name,
kind = kind,
check_conf = check_conf
}
so people don't need to remember the order.
| } | ||
|
|
||
|
|
||
| local function check_conf(id, conf, need_id) |
Member
There was a problem hiding this comment.
Look like we can also share the id check logic? It is the same in other resources.
spacewander
reviewed
Jan 9, 2023
| name = "routes", | ||
| kind = "route", | ||
| schema = core.schema.route, | ||
| check_conf_self = check_conf |
Member
There was a problem hiding this comment.
check_conf_self is not a good name. It would be better to use a valid English verb phrase as the method name.
|
|
||
|
|
||
| function _M.new(opt) | ||
| return setmetatable({ |
Member
There was a problem hiding this comment.
Suggested change
| return setmetatable({ | |
| return setmetatable(opt |
can be simpler
spacewander
reviewed
Jan 10, 2023
spacewander
approved these changes
Jan 10, 2023
5 tasks
soulbird
approved these changes
Jan 11, 2023
hongbinhsu
added a commit
to fitphp/apix
that referenced
this pull request
Jan 30, 2023
* upstream/master: (67 commits) fix: grpc-transcode plugin: fix map data population (apache#8731) change(jwt-auth): unify apisix/core/vault.lua and apisix/secret/vault.lua (apache#8660) feat: stream subsystem support consul_kv service discovery (apache#8633) fix(proxy-mirror): use with uri rewrite (apache#8718) ci: move helper script to the right dir (apache#8691) refactor(pubsub): simpify the get_cmd implementation (apache#8608) feat: stream subsystem support kubernetes service discovery (apache#8640) docs: fix deployment links (apache#8714) fix: remove backslash before slash when encoding (apache#8684) ci: kafka should register port in the zookeeper same as exposed (apache#8672) docs: fix plugin config naming (apache#8701) docs: fix code block (apache#8700) docs: rename kms to secret (apache#8697) docs: replace transparent logos with white background logos (apache#8689) fix: upgrade lua-resty-etcd to 1.10.3 (apache#8668) fix: upgrade casbin to 1.41.3 to improve performance (apache#8676) chore: make send_stream_request more clear (apache#8627) feat: stream subsystem support nacos service discovery (apache#8584) feat: stream subsystem support dns service discovery (apache#8593) refactor(admin): refactor resource routes (apache#8611) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #8569
Checklist