Skip to content

$ref with escaped slash (~1) causes "Reference not found" error #2206

@chrg1001

Description

@chrg1001

Description

It seems that Reference not found errors occur when an escaped slash (~1) is present in a $ref string.

Error: Reference not found: #/paths/~1api~1users/get/responses/200/content/application~1json/schema

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example-hcuescjt?file=docs%2Fschema.json

OpenAPI specification (optional)

{
  "openapi": "3.0.0",
  "info": {
    "title": "Sample API",
    "version": "1.0.0"
  },
  "paths": {
    "/api/users": {
      "get": {
        "summary": "Get users",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Post user",
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1api~1users/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    }
  }
}

System information (optional)

No response

Metadata

Metadata

Assignees

Labels

bug 🔥Broken or incorrect behavior.important 📌This issue is important and will be addressed when capacity allows.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions