swagger-node:使用swagger"项目编辑" $ ref(多个文件)

时间:2017-09-03 09:46:58

标签: node.js express swagger swagger-node-express swagger-node

我正在检查swagger节点。这似乎是基本的,所以我很难相信它是一个错误。

我使用import { NavLink } from 'reactstrap'; import { NavLink as RRNavLink } from 'react-router-dom'; <NavLink exact to="/about" tag={RRNavLink}>About</NavLink> 创建示例swagger hello world项目,如swagger-node git页面所示。​​

我将swagger project create hello-world用于具有相对路径的外部文件,但无法打开该文件。使用控制台我可以看到它尝试了一个请求,但是出现了404错误。似乎swagger编辑器只能访问swagger.yaml文件,但没有别的。

作为测试我将引用的hello.yaml文件复制到项目的每个文件夹中,仍然获得$ref

swagger.yaml

Reference could not be resolved: hello.yaml

hello.yaml

swagger: "2.0"
info:
  version: "0.0.1"
  title: Hello World App
# during dev, should point to your local machine
host: localhost:10010
# basePath prefixes all resource paths 
basePath: /
# 
schemes:
  # tip: remove http to make production-grade
  - http
  - https
# format of bodies a client can send (Content-Type)
consumes:
  - application/json
# format of the responses to the client (Accepts)
produces:
  - application/json
paths:
  /hello:
    $ref: hello.yaml
  /swagger:
    x-swagger-pipe: swagger_raw
# complex objects have schema definitions
definitions:
  HelloWorldResponse:
    required:
      - message
    properties:
      message:
        type: string
  ErrorResponse:
    required:
      - message
    properties:
      message:
        type: string

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我发现它是一个招摇的编辑器错误。 请在Known Issues找到说明。 它会提供信息Relative path support for external files is not implemented.