Skip to content

References to references fail as "cyclic reference" #57

Closed
@someniatko

Description

@someniatko

Consider this simple YAML:

openapi: 3.0.2
info:
  title: 'City API'
  version: dev
paths:
  '/city':
    get:
      description: 'Get City'
      responses:
        '200':
          description: 'success'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/City'

components:
  schemas:
    City:
      $ref: '#/components/schemas/Named'
    Named:
      type: string
(new League\OpenAPIValidation\PSR7\ValidatorBuilder)
    ->fromYaml($yaml)
    ->getResponseValidator();

Response schema references "City" schema, which itself references "Named" schema, which is perfectly valid. However, the library throws the following exception:

cebe\openapi\exceptions\UnresolvableReferenceException : Cyclic reference detected, setReferenceContext() called on a Reference Object.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions