规范中未定义任何操作

时间:2020-07-02 07:43:28

标签: swagger openapi

我正在尝试使用多个文件定义openapi,但是它不起作用。 我希望主文件(swagger.yaml)将页面链接到其他文件(test.yaml和test2.yaml)

我得到的页面带有“ No operations defined in spec!

swagger.yaml文件:

openapi: 3.0.0
info:
  version: 1.0.0
  title: The big project
  description: A simple API to illustrate OpenAPI concepts
  
security:
  - BasicAuth: []

paths:  
    $ref: "test.yaml"
    $ref: "test2.yaml"

test.yaml文件:

/test:
  get:
    tags:
      - test
    summary: View all test
    description: Returns a list of test      
    responses:
      '200':
        description: Successfully returned a list of test

test2.yaml文件:

 /test2:
      get:
        tags:
          - test
        summary: View all test
        description: Returns a list of test      
        responses:
          '200':
            description: Successfully returned a list of test


          

我在这里查看了帖子:

Split OpenApi Paths into multiple path definition files

但结果相同

为什么我得到:规范中未定义任何操作!

我们如何解决?

0 个答案:

没有答案