Skip to content

Commit

Permalink
refactor: extract desc definition from the schema (#3737)
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
  • Loading branch information
spacewander authored Mar 3, 2021
1 parent 01849b9 commit a97ba0d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions apisix/schema_def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ local rule_name_def = {
}


local desc_def = {
type = "string",
maxLength = 256,
}


local health_checker = {
type = "object",
properties = {
Expand Down Expand Up @@ -368,7 +374,7 @@ local upstream_schema = {
},
upstream_host = host_def,
name = rule_name_def,
desc = {type = "string", maxLength = 256},
desc = desc_def,
service_name = {
type = "string",
maxLength = 256,
Expand Down Expand Up @@ -427,7 +433,7 @@ _M.route = {
uniqueItems = true,
},
name = rule_name_def,
desc = {type = "string", maxLength = 256},
desc = desc_def,
priority = {type = "integer", default = 0},

methods = {
Expand Down Expand Up @@ -562,7 +568,7 @@ _M.service = {
upstream = upstream_schema,
upstream_id = id_schema,
name = rule_name_def,
desc = {type = "string", maxLength = 256},
desc = desc_def,
labels = labels_def,
script = {type = "string", minLength = 10, maxLength = 102400},
create_time = timestamp_def,
Expand All @@ -588,7 +594,7 @@ _M.consumer = {
labels = labels_def,
create_time = timestamp_def,
update_time = timestamp_def,
desc = {type = "string", maxLength = 256},
desc = desc_def,
-- deprecate fields, will be removed soon
id = id_schema,
},
Expand Down Expand Up @@ -732,7 +738,7 @@ _M.plugin_config = {
type = "object",
properties = {
id = id_schema,
desc = {type = "string", maxLength = 256},
desc = desc_def,
plugins = plugins_schema,
labels = labels_def,
create_time = timestamp_def,
Expand Down

0 comments on commit a97ba0d

Please sign in to comment.