Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Support for External Files #1555

Closed
omernave1 opened this issue Oct 10, 2019 · 1 comment
Closed

Support for External Files #1555

omernave1 opened this issue Oct 10, 2019 · 1 comment

Comments

@omernave1
Copy link

omernave1 commented Oct 10, 2019

Describe the bug
Dredd only accepts references to #/comments within the same file.

To Reproduce
Add a reference to an external #/comments in your current yml file.

Expected behavior
Dredd should recognize the reference and read the specifications from the external file.

What is in your dredd.yml?

openapi: 3.0.1

info:
  title: API
  description: My API
  version: 0.1.0

paths:
  /accounts:
    get:
      summary: List accounts
      description: List accounts
      operationId: listAccounts
      tags:
        - accounts
      parameters:
        - $ref: "./common-api.yml#/components/parameters/Page"
        - $ref: "./common-api.yml#/components/parameters/PageSize"
      # add filter parameters (search)
      responses:
        '200':
          $ref: "#/components/responses/AccountPageResponse"
        "400":
          $ref: "./common-api.yml#/components/responses/BadRequest"
        "401":
          $ref: "./common-api.yml#/components/responses/Unauthorized"
        "403":
          $ref: "./common-api.yml#/components/responses/Forbidden"
        "404":
          $ref: "./common-api.yml#/components/responses/NotFound"
        default:
          $ref: "./common-api.yml#/components/responses/BadRequest"

What's your dredd --version output?

dredd v12.1.0 (Darwin 18.7.0; x64)

Does dredd --loglevel=debug uncover something?
Yes

API description parser error in /Users/onave/Documents/Workspace/iceberg-api-specification/definitions/accounts.yml:301 (from line 301 column 17 to column 66): Only local references to '#/components' within the same file are supported
@honzajavorek
Copy link
Contributor

Thank you! This is a known limitation which has been put in place for security reasons some time ago. Basically it is a duplicate of #676. I'll comment there to keep the conversation at one place.

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

No branches or pull requests

2 participants