Reputation: 5619
I'm checking out swagger node. This seems to be something basic so it's hard for me to believe it's a bug.
I create the sample swagger hello world project as indicated on the swagger-node git page using swagger project create hello-world
.
I use a $ref
to an external file with relative path but it's unable to open the file. Using the console I can see that it attempts a request but there's a 404 error. It seems that the swagger editor can only access the swagger.yaml file but nothing else.
as a test I copied the referenced hello.yaml file to every folder of the project and still getting 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"
Upvotes: 1
Views: 832
Reputation: 493
I have meet the same issue, and I have found that it's a swagger-editor bug.
Please find the description at Known Issues.
It will give the info Relative path support for external files is not implemented.
Upvotes: 1