Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swagger NSwag响应头_Swagger_Openapi_Nswag - Fatal编程技术网

Swagger NSwag响应头

Swagger NSwag响应头,swagger,openapi,nswag,Swagger,Openapi,Nswag,如何在NSwag中设置响应头 我试图添加到OpenApiResponse.Headers集合 var headerSchema = new JsonSchema() { Type = JsonObjectType.String, Description = "headerDescription" }; response.Headers["headerName"] = headerSc

如何在NSwag中设置响应头

我试图添加到OpenApiResponse.Headers集合

        var headerSchema = new JsonSchema()
        {
            Type = JsonObjectType.String,
            Description = "headerDescription"
        };

        response.Headers["headerName"] = headerSchema;
不幸的是,生成的json并不正确。根据,响应头的输出如下:

paths:
  /ping:
    get:
      summary: Checks if the server is alive.
      responses:
        '200':
          description: OK
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Request limit per hour.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            X-RateLimit-Reset:
              schema:
                type: string
                format: date-time
              description: The UTC date/time at which the current rate limit window resets.

我们可以使用Nswag实现这一点吗?

您可以将Nswag代码发布到您设置的
OpenApiResponse.Headers
?您可以将Nswag代码发布到您设置的
OpenApiResponse.Headers