Skip to content

Commit

Permalink
Fix regression.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Dec 5, 2013
1 parent eed1e36 commit fe0af82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/interpol/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def conditionally_make_nullable(raw_schema)
# Mark as non-nullable so it doesn't try to recurse down into it
# and make it nullable at that level (since we are taking care of it at this level)
sub_schema = raw_schema.merge('nullable' => false)
raw_schema.replace('type' => ['null', sub_schema])
raw_schema.replace('type' => ['null', sub_schema], 'optional' => sub_schema['optional'])
end

def should_be_nullable?(raw_schema)
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/interpol/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ def new_with(hash)
subject.validate_data!({})
end

it 'does not require optional nullable properties' do
schema['properties']['foo'].merge!('optional' => true, 'nullable' => true)
subject.validate_data!({})
end

it 'does not allow additional properties' do
expect {
subject.validate_data!('bar' => 3)
Expand Down

0 comments on commit fe0af82

Please sign in to comment.