Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.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 ui-从组件调用参数_Swagger_Swagger Ui_Openapi - Fatal编程技术网

Swagger ui-从组件调用参数

Swagger ui-从组件调用参数,swagger,swagger-ui,openapi,Swagger,Swagger Ui,Openapi,我将swagger ui与swagger API/swagger ui docker图像一起使用。我尝试在我的路径中使用组件中定义的参数,但这不起作用。问题在哪里 在我的index.yaml文件中 components: ... parameters: Pagination: - in: query name: page schema: type: integer required: false desc

我将swagger ui与swagger API/swagger ui docker图像一起使用。我尝试在我的路径中使用组件中定义的参数,但这不起作用。问题在哪里

在我的index.yaml文件中

components:
  ...
  parameters:
    Pagination:
    - in: query
      name: page
      schema:
        type: integer
        required: false
      description: The page to go to
    - in: query
      name: per_page
      schema:
        type: integer
        required: false
      description: The number of items per page
  ...
在我的路径文件中

parameters:
  $ref: '../index.yaml#/components/parameters/Pagination'

感谢您提供的帮助

OpenAPI允许您使用
$ref
单个参数,而不是一组参数。因此,如果您有几个常用参数,则需要在
组件/参数
部分中为它们创建单独的定义。另外,
required
是参数属性,而不是架构属性:

组件:
参数:
pageParam:#相关: