Class: RequestHandler::SchemaParser

Inherits:
Object
  • Object
show all
Defined in:
lib/request_handler/schema_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema:, schema_options: {}) ⇒ SchemaParser

Returns a new instance of SchemaParser.



6
7
8
9
10
11
12
13
14
15
# File 'lib/request_handler/schema_parser.rb', line 6

def initialize(schema:, schema_options: {})
  missing_arguments = []
  missing_arguments << { schema: "is missing" } if schema.nil?
  missing_arguments << { schema_options: "is missing" } if schema_options.nil?
  raise MissingArgumentError.new(missing_arguments) unless missing_arguments.empty?
  raise InternalArgumentError.new(schema: "must be a Schema") unless validation_engine.valid_schema?(schema)

  @schema = schema
  @schema_options = schema_options
end