Skip to content

Loading…

Fix regression. #39

Merged
merged 1 commit into from

2 participants

@myronmarston
Moz member

No description provided.

@benkirzhner
Moz member

LGTM

@myronmarston myronmarston merged commit bfbea26 into master

1 check passed

Details default The Travis CI build passed
@myronmarston myronmarston deleted the fix-regression branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2013
  1. @myronmarston

    Fix regression.

    myronmarston committed
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/interpol/endpoint.rb
  2. +5 −0 spec/unit/interpol/endpoint_spec.rb
View
2 lib/interpol/endpoint.rb
@@ -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)
View
5 spec/unit/interpol/endpoint_spec.rb
@@ -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)
Something went wrong with that request. Please try again.