Swagger 的 body 参数名称的用途是什么?

What is the purpose of the name for Swagger's body parameter?

如下图,我将body参数命名为main_name_of_parameter:

swagger: "2.0"

info:
  title: Learing Swagger Title
  description: Learing Swagger Description
schemes:
  - http
host: testing.example.com
basePath: /api
consumes:
  - application/json
produces:
  - application/json

paths:
 /test:
    post:
      summary: testing a post
      description: testing a post
      parameters:
        - name: main_name_of_parameter
          in: body
          description: main_name_of_parameter
          schema:
            properties:
              property_one:
                type: string
              property_two:
                type: string

然后我使用 swagger UI 对其进行了测试,它生成了以下卷曲:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
   "property_one": "string", \ 
   "property_two": "string" \ 
 }' 'http://testing.example.com/api/test'

如上所示,main_name_of_parameter 从未发送到服务器。 Swagger 的主体参数名称的用途是什么?

好吧,该名称用于代码生成器,作为生成方法的参数名称。但正如你所说,这个名字并没有真正的用途,实际上它是 removed in the 3.0 specification.