Skip to content

Failed to use $ref reference to whole file #132

@yckimura

Description

@yckimura

When using $ref to reference to whole yaml file, NoMethodError is thrown.

RSpec example that can reproduce error: master...yckimura:ref-whole-file
Failed logs: https://github.com/yckimura/openapi_parser/runs/5725197901

openapi.yaml:

openapi: 3.0.0
info:
  version: 1.0.0
  title: OpenAPI3 Test
paths:
  /whole_local_file:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: schema-object.yaml
      responses:
        '200':
          description: correct

schema-object.yaml:

type: object
required:
  - name
properties:
  name:
    type: string
  tag:
    type: string

Stacktrace:

NoMethodError:
  undefined method `any_of' for #
# ./lib/openapi_parser/schema_validator.rb:98:in `validator'
# ./lib/openapi_parser/schema_validator.rb:74:in `validate_schema'
# ./lib/openapi_parser/schema_validator.rb:62:in `validate_data'
# ./lib/openapi_parser/schema_validator.rb:45:in `validate'
# ./lib/openapi_parser/schemas/media_type.rb:15:in `validate_parameter'
# ./lib/openapi_parser/schemas/request_body.rb:24:in `validate_request_body'
# ./lib/openapi_parser/schemas/operation.rb:25:in `validate_request_body'
# ./lib/openapi_parser/request_operation.rb:52:in `validate_request_body'
# ./spec/openapi_parser/concerns/findable_spec.rb:40:in `block (4 levels) in <top (required)>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions