Skip to content

[Bug]: Response content schema path is unresolvable #858

Closed
@litteratum

Description

@litteratum

Actual Behavior

I have the following paths:

openapi: 3.1.0
info:
  title: My API
  description: My API
  version: 1.0.0

paths:
  /customer:
    post:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: response.json

The "response.json" schema exists on the same level as the "api.yaml".

Then I use OpenAPI.from_file_path("apis/api.yaml"). And it fails with:

referencing.exceptions.Unresolvable: response.json

So for some reason, response schema resolution always fails...

Expected Behavior

I expect response schemas to be looked up relative to the API specification file. The same they are looked up for requests (and which works for me).

Steps to Reproduce

  1. Create the following "api.yaml":
openapi: 3.1.0
info:
  title: My API
  description: My API
  version: 1.0.0

paths:
  /customer:
    post:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: response.json
  1. Create a "response.json" file with {} content.
  2. Run the following code:
from openapi_core import OpenAPI

OpenAPI.from_file_path("api.yaml")

OpenAPI Core Version

0.19.2

OpenAPI Core Integration

flask

Affected Area(s)

dependencies, schema

References

No response

Anything else we need to know?

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugIndicates an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions