array_of_strings_or_null not working
Closed this issue · 5 comments
Hi Guys,
Thanks in advance for bringing out Airborne as a tool for rest API validation. It's just been a couple of weeks since I started using it and so far it's been good
In the documentation it is mentioned that "or_null" can be appended for any of the data types. But when I try to use it for array_of_strings, my scripts return an error.
Please can you let me know if this support can be provided? It becomes more a specific schema validation vis-a-vis array_or_null.
Thanks in advance,
VJ
It should work, can you give me more info on the error?
Hey Seth,
Here's the error I get :-
Failures:
- api /program/:programid: should validate types and values of movie data
Failure/Error: expect_json_types('*', final_schema)
Expected services
to be of type array_of_strings_or_null
got NilClass instead
Diff:
@@ -1,2 +1,2 @@
-Array
+NilClass
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:201:in `expect_array'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:186:in `check_array_types'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:126:in `block in expect_json_types_impl'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:115:in `each'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:115:in `expect_json_types_impl'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:13:in `block in expect_json_types'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:136:in `block in call_with_path'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/path_matcher.rb:82:in `block in expect_all'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/path_matcher.rb:82:in `each'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/path_matcher.rb:82:in `expect_all'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/path_matcher.rb:25:in `get_by_path'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:135:in `call_with_path'
# /home/vj/.rvm/gems/ruby-2.1.4/gems/airborne-0.2.3/lib/airborne/request_expectations.rb:12:in `expect_json_types'
# ./spec/program_programid_related_spec/api_program_programid_related_happy_path.rb:50:in `block (2 levels) in <top (required)>'
Finished in 0.73466 seconds (files took 1.26 seconds to load)
1 example, 1 failure
Ok, I just pushed a fix.
Hi Seth,
I've used the v0.2.5 Airbornwe Version & this problem seems to be fixed. Though I've tried it on just one api.
Thanks alot! :)
Regards,
VJ
No Problem. Thanks for letting me know.