난장판 노드를 확인하고 있습니다. 이것은 기본적인 무언가 인 것 같아서 버그라고 생각하는 것이 어렵습니다.
나는 Swagger-Node git 페이지에 표시된대로 swagger project create hello-world
을 사용하여 샘플 swagger hello world 프로젝트를 만듭니다.
상대 경로로 외부 파일에 $ref
을 사용하지만 파일을 열 수 없습니다. 콘솔을 사용하여 요청을 시도했지만 404 오류가 있음을 알 수 있습니다. Swagger 편집기는 swagger.yaml 파일에만 액세스 할 수 있지만 그 외에는 액세스 할 수없는 것 같습니다. 테스트로
나는 모든 프로젝트의 폴더 여전히 Reference could not be resolved: hello.yaml
swagger.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
hello.yaml
# binds a127 app logic to a route
x-swagger-router-controller: hello_world
get:
description: Returns 'Hello' to the caller
# used as the method name of the controller
operationId: hello
parameters:
- name: name
in: query
description: The name of the person to whom to say hello
required: false
type: string
responses:
"200":
description: Success
schema:
# a pointer to a definition
$ref: "#/definitions/HelloWorldResponse"
# responses may fall through to errors
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"