0
以下招搖定義被髮送:指定數組作爲GET參數使用揚鞭/ OpenAPI的規格
swagger: '2.0'
host: example.com
paths:
/theResource:
get:
parameters:
- $ref: '#/parameters/fields'
parameters:
fields:
name: fields
description: Fields to return
in: query
type: array
collectionFormat: multi
uniqueItems: true
items:
type: string
enum:
- column1
- column2
- column3
將生成以下URL,並且服務器將僅接收fields
等於column3
。
http://example.com/theResource?fields=column1&fields=column2&fields=column3
如何更改它,以便它在參數中發送數組?例如:
http://example.com/theResource?fields[]=column1&fields[]=column2&fields[]=column3
也許只是將名稱從'fields'更改爲'fields []'? – user1032531
順便說一句,你要找的術語是YAML(不是招搖的 - 招搖是產品) –
@ʰᵈˑ是的,它是YAML,但它也可以是JSON。也許我應該說「開放式API規範」? – user1032531