-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you get into an array inside an object? #30
Comments
try |
I just tried it with |
I just tried expect_json_types('array2.0.WhatIsThis.array3.0', {value7: :string_or_null}) I got |
hmm, what version of airborne are you using? |
0.1.8
|
@fmorales I just tried using the following snippet of code: require 'airborne'
describe 'issue 30' do
it 'gets value7' do
get 'https://gist.githubusercontent.com/fmorales/5b21b301c5e8ae39118c/raw/2e41a8a6569d9b11ef02e9a76ca4165a81ae0859/gistfile1.json'
expect_json_types('array2.0.WhatIsThis.array3.0', {value7: :string_or_null})
end
end and just like @sethpollack is experiencing, it works correctly. Can you verify that your code is doing the same thing? |
I tried dropping your code snippet into my harness, and it works. I am still not having any luck with getting into the same structure myself. I'm at a loss for what I am doing wrong. |
I figured out the problem, but not the solution. the key 'value7' is not always present. How do I test for it being a string_or_null if it is itself there_or_null. Is there a way to do that? |
You should be able to wrap it in a call to require 'airborne'
describe 'issue 30' do
it 'gets value7' do
get 'https://gist.githubusercontent.com/fmorales/5b21b301c5e8ae39118c/raw/2e41a8a6569d9b11ef02e9a76ca4165a81ae0859/gistfile1.json'
expect_json_types('array2.0.WhatIsThis.array3.0', optional({value7: :string_or_null}))
end
end We put lots of effort into the documentation, please check them out to see if they help you out: https://github.com/brooklynDev/airborne/blob/master/README.md |
Thank you so much for you help. I had tried that. I must have been using it wrong. Thank you for the clarifacation. |
Here is the json that is giving me greif
https://gist.github.com/fmorales/5b21b301c5e8ae39118c
I am trying to get to value7 under WhatIsThis. WhatIsThis is an object, and value7 is an array under it. I am trying to get to it with:
expect_json_types('array2..WhatIsThis..array3.0', {value7: :string_or_null})
I get an error that I am getting a hash. I looked in the docs for how I access a hash, but I can't find anything. Help!
The text was updated successfully, but these errors were encountered: