Class: OpenapiValidator::DocumentationValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_validator/documentation_validator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/openapi_validator/documentation_validator.rb', line 7

def errors
  @errors
end

Class Method Details

.call(api_doc, additional_schemas: []) ⇒ DocumentationValidator

Returns validation result.

Parameters:

  • api_doc (Hash)

    parsed openapi documentation

  • additional_schemas (Array<String>) (defaults to: [])

    paths to custom schemas

Returns:



12
13
14
# File 'lib/openapi_validator/documentation_validator.rb', line 12

def self.call(api_doc, additional_schemas: [])
  new(api_doc, additional_schemas: additional_schemas).call
end

Instance Method Details

#callDocumentationValidator



17
18
19
# File 'lib/openapi_validator/documentation_validator.rb', line 17

def call
  validate
end

#valid?true, false

Returns:

  • (true, false)


22
23
24
# File 'lib/openapi_validator/documentation_validator.rb', line 22

def valid?
  errors.empty?
end