Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.
This repository was 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

Description

@cortezthekiller

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions