Swagger UI not sending array correctly

后端 未结 1 1266
轻奢々
轻奢々 2020-12-21 22:15

I am trying to send multiple values (an array) (refer to on line 93 in spec ->... name: recipients[] ...)

The problem I am facing is the Swagger-ui call the endpoint

相关标签:
1条回答
  • 2020-12-21 22:52

    It looks like the way to specify this is to add collectionFormat: multi

    - name: recipients[]
      in: formData
      description: Email addresses for recipients (multiple values allowed).
      required: true
      type: array
      collectionFormat: multi
      items:
          type: string
    

    Possible values from http://swagger.io/specification/ are:

    • csv - comma separated values foo,bar.
    • ssv - space separated values foo bar.
    • tsv - tab separated values foo\tbar.
    • pipes - pipe separated values foo|bar.
    • multi - corresponds to multiple parameter instances instead of multiple values for a single instance foo=bar&foo=baz. This is valid only for parameters in "query" or "formData".
    0 讨论(0)
提交回复
热议问题