Skip to content

$ref sibling fields cause validation to fail #1264

Description

@urcheraus

This schema passes validation with v0.135.0 but fails to validate with versions v0.136.0..v0.149.0 (latest at time of writing).

openapi: 3.0.0
info:
  version: 0.0.0
  title: $ref with siblings example
paths: {}
components:
  schemas:
    Schema1:
      type: object
      properties:
        p:
          description: Some text
          $ref: '#/components/schemas/Schema2'
    Schema2:
      type: string

The error message is Validation error: invalid components: schema "Schema1": extra sibling fields: [description]

The relevant section of the OpenAPI 3.0.0 specification states that

any properties added SHALL be ignored

so I believe the description here is allowed by the spec and should not cause a validation failure.

--

The schemas I'm working with have a lot of description and example fields for referenced schemas, which is useful documentation for humans even if it is ignored by programs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions