Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

External definition of the path to the endpoints raises swagger error #505

Open
cortezthekiller opened this issue Jun 11, 2017 · 1 comment

Comments

@cortezthekiller
Copy link

cortezthekiller commented Jun 11, 2017

Using node v7.10.0 and npm 4.2.0.
I have created a nodejs 'Hello World' project and I was trying to reorganize the main swagger.yaml taking the paths out to a sepparate paths.yaml file. I get a swagger error:

Relative paths to the individual endpoints. They must be relative to the 'basePath'.

This is how I reference the paths object in my api/swagger/swagger.yaml file¨:

paths:
  $ref: './paths.yaml'
  /swagger:
    x-swagger-pipe: swagger_raw

and this is the referenced file (api/swagger/paths.yaml) :

/hello:
  # 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"

Is it possible to reference the paths to the endpoints in a sepparate yaml file as I'm trying to do? In that case, is the swagger error pointing to the $ref object in the swagger.yaml file or is it pointing to the /hello endpoint in paths.yaml ?

@basask
Copy link

basask commented Jun 22, 2017

I have hit the same issue. Same node and npm version also.
There is a PR #496 to fix it. Works just fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants