Class: RSpec::Swag::ExtendedSchema

Inherits:
JSON::Schema::Draft4
  • Object
show all
Defined in:
lib/rspec/swag/extended_schema.rb

Instance Method Summary collapse

Constructor Details

#initializeExtendedSchema

Returns a new instance of ExtendedSchema.



8
9
10
11
12
# File 'lib/rspec/swag/extended_schema.rb', line 8

def initialize
  super
  @uri = URI.parse("http://tempuri.org/rswag/specs/extended_schema")
  @names = ["http://tempuri.org/rswag/specs/extended_schema"]
end

Instance Method Details

#validate(current_schema, data) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rspec/swag/extended_schema.rb', line 14

def validate(current_schema, data, *)
  if data.nil? && (current_schema.schema["nullable"] == true || current_schema.schema["x-nullable"] == true)
    return
  end

  super
end