anjia0532 edited a comment on issue #6105:
URL: https://github.com/apache/apisix/issues/6105#issuecomment-1012895362


   > > 同key数据结构不一致,常见的比如 node.nodes 
无值{},有值[],更奇葩的是upstream的node.nodes[].nodes,通过接口更新的是{},通过dashboard更新的是[{},{}],就很难受
   > 
   > Could you provide detailed steps to reproduce it?
   > 
   > It's a bit weird in this case, because both `{}` and `[]` are valid 
`nodes` values. The array format is preferable, because:
   > 
   > 1. it can be PATCHed
   > 2. it is extendable
   
   > Could you provide detailed steps to reproduce it?
   
   My env `apache/apisix:2.9-alpine`  and `apache/apisix-dashboard:2.8`
   
   ref doc 
[docs/apisix/admin-api/#request-body-parameters-3](https://apisix.apache.org/docs/apisix/admin-api/#request-body-parameters-3)
 
   `nodes`'s Description:  `Hash table or array. If it is a hash table, the key 
of the internal element is the upstream machine address list, the format is 
Address + (optional) Port, where the address part can be IP or domain name, 
such as 192.168.1.100:80, foo.com:80, etc. The value is the weight of node. If 
it is an array, each item is a hash table with key host/weight and optional 
port/priority. The nodes can be empty, which means it is a placeholder and will 
be filled later. Clients use such an upstream will get 502 response.` means  `{ 
"ip:port": weight} or [{"host":"", "weight ":1, "port":80}]` 
   
   > 根据文档的描述,upstream的nodes这个字段,同时支持 lua的hash 
table和数组两种格式,dashboard通过ui修改的都是数组形式。而我不确定 
[stand-alone#how-to-configure-router--upstream](https://apisix.apache.org/docs/apisix/stand-alone#how-to-configure-router--upstream)
 stand-alone 的upstream支不支持数组形式。
   
   > 1. it can be PATCHed
   > 2. it is extendable
   
   > 用golang解析这种可变类型的结构,很痛苦。更喜欢某些接口返回 host/hosts,uri/uris 这种不同key返回不同类型的方式


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to