Module: OpenapiValidator

Defined in:
lib/openapi_validator.rb,
lib/openapi_validator/request.rb,
lib/openapi_validator/version.rb,
lib/openapi_validator/validator.rb,
lib/openapi_validator/file_loader.rb,
lib/openapi_validator/path_validator.rb,
lib/openapi_validator/extended_schema.rb,
lib/openapi_validator/request_validator.rb,
lib/openapi_validator/response_validator.rb,
lib/openapi_validator/schema/json_validator.rb,
lib/openapi_validator/schema/type_attribute.rb,
lib/openapi_validator/documentation_validator.rb,
lib/openapi_validator/schema/required_attribute.rb,
lib/openapi_validator/response_validators/json_validator.rb,
lib/openapi_validator/response_validators/image_validator.rb

Defined Under Namespace

Classes: DocumentationValidator, Error, ExtendedSchema, FileLoader, JsonValidator, PathValidator, Request, RequestValidator, RequiredAttribute, ResponseValidator, TypeAttribute, Validator

Constant Summary collapse

VERSION =
"0.5"

Class Method Summary collapse

Class Method Details

.call(doc, **params) ⇒ Object

See Also:

  • OpenapiValidator::Validator#initialize


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/openapi_validator.rb', line 9

def self.call(doc, **params)
  if doc.is_a? String
    parsed_doc = FileLoader.call(doc)
  elsif doc.is_a? Hash
    parsed_doc = doc
  else
    raise ArgumentError, "Please provide parsed OpenAPI doc as Hash or path to file as String. Passed: #{doc.class}"
  end

  Validator.new(parsed_doc, **params)
end