Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken ref when using different file for request & response

See original GitHub issue

Describe the bug

I have spent many hours trying to get to the bottom of this with no luck, so I’m hoping I’ve found a bug and it’s not just my ineptness! 😃

I have a very minimal schema representing get & post methods on a /queries endpoint (see schema below). I’m getting some super weird errors when trying to use them. The problem appears to be related to the post portion of the schema, which has references to two different files, one for the request object and one for the response object (although for debugging purposes, the contents of both files is currently identical)

When I make a GET request, I receive:

    "error": {
        "message": "can't resolve reference #/paths/~1queries/post/responses/201/content/application~1json/schema from id #",
        "missingRef": "#/paths/~1queries/post/responses/201/content/application~1json/schema",
        "missingSchema": ""
    "message": "can't resolve reference #/paths/~1queries/post/responses/201/content/application~1json/schema from id #"

I am confident the referenced file schemas/queryresponse.yaml is present:

~/ems-api/api_spec$ find

In fact, the queries.yaml schema for the get route references this file with no problems.

Bizarrely, in the spec, if I rename the the ref for the response object to schemas/queryrequest.yaml, it works, which is especially odd since both files are currently identical.

I’m surmising from all this that it’s something to do with having two differently named files for request & response refs, though in the OpenAPI 3 spec I’ve not been able to find anything that would prohibit that.

I’m completely out of ideas. My spec seems valid (according to anyway). Might this be a bug?

Examples and context


openapi: 3.0.0
  title: EMS
  description: Spec for EMS API
  version: 1.0.0
  - url: /api/v1.0
      summary: Returns all queries
      operationId: getQueries
        - name: offset
          in: query
          required: false
          description: The record index to start returning (e.g. 1 = second record)
            type: integer
          description: An array of query objects
                $ref: 'schemas/queries.yaml'
          description: Server error
      summary: Create a new query
      operationId: createQuery
        description: A JSON object describing a query
        required: true
              $ref: 'schemas/queryrequest.yaml'
          description: The created query object
                $ref: 'schemas/queryresponse.yaml'
          description: Query not found
          description: Server error


type: array
  $ref: 'queryresponse.yaml'

schemas/queryrequest.yaml & schemas/queryresponse.yaml:

type: object
    type: integer
    nullable: true
    type: string
    type: string
    nullable: true

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

AndrewIshcommented, Jun 29, 2020

Hi @cdimascio

Thanks so much for responding to this so quickly. Your fix in v3.16.4 appears to work perfectly!

Thanks for creating such a useful library, it’s made life much easier for me on my project 😃

AndrewIshcommented, Jul 14, 2020

Hi @cdimascio

Thanks for the super speedy response. I just tried it and it works perfectly! Many thanks for fixing it, and for your continued work on this extremely useful package! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

warning: ignoring broken ref refs/remotes/origin/HEAD
This command output the name of the old development branch, which no longer exists. I fixed the warnings using this: $ git symbolic-ref...
Read more >
How to correct a #REF! error - Microsoft Support
The #REF! error shows when a formula refers to a cell that's not valid. This happens most often when cells that were referenced...
Read more >
Unhandled RefsWarningException "warning: ignoring broken ...
Current behaviour Occasionally, some of my GE repo's refs are overwritten with zeroes. (It resides on an external, self-encrypting SSD from ...
Read more >
Git - Unable to resolve reference 'refs/remotes/origin/master'
Solution. Unsure the root cause of the "reference broken". To fix it, delete this file .git/refs/remotes/origin ...
Read more >
MIME types (IANA media types) - HTTP - MDN Web Docs
Multipart types indicate a category of document broken into pieces, often with different MIME types; they can also be used — especially in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found