Skip to content

default and $ref do not work together #92

@hlobit

Description

@hlobit

I have the following file:

---
openapi: 3.0.0
info:
  title: Test Api
  version: 0.0.1
paths:
  "/test/":
    get:
      responses:
        '200':
          description: OK
          schema:
            type: object
      parameters:
      - name: param1
        in: query
        schema:
          allOf:
          - "$ref": "#/components/schemas/type"
          default: 1
components:
  schemas:
    type:
      type: integer

Validation for this schema goes wrong, because of the default in the parameter schema.
A validation is performed when there is a default value in a schema since this pull request was merged: #35
The default validation is failing only when performed against a schema that contains a $ref.

I quickly inspected the issue: looks like dereference is done at the the lowest level of the tree, but dereferenced value is lost in recursive walk when going up.

I just opened a PR with a failing test: #91

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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