Skip to content
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

Use absolute paths when building entry classes #24

Closed
wants to merge 1 commit into from

Conversation

joshuap
Copy link
Contributor

@joshuap joshuap commented Jun 3, 2013

When using nested expands, inline entries can contain deeply nested
properties and inline elements of their own. Rather than performing a
match on any node under the current, select only the first level
properties or inline entries nodes.

The bug I was having is this (arbitrary example):

svc = OData::Service.new('...')
svc.Products.expand('Categories').expand('Categories/Sections')
products = svc.execute

products.Categories would contain both Category and Section classes, since it was matching every nested entry rather than just the first level for each Product entry node. Also, properties were not being set on the first expand associations - so products.first.categories.first.ID would be nil, even though the properties element was present for that category.

When using nested expands, inline entries can contain deeply nested
properties and inline elements of their own. Rather than performing a
match on any node under the current, select only the *first level*
properties or inline entries nodes.
@visoft
Copy link
Owner

visoft commented Jun 5, 2013

Could you create a test specifically for this issue. If you look at the test suite, I've used the VCR gem to capture responses and then load them into my tests (so we can test offline).

That is for Cucumber features. However, it's easier to just grab the XML response of the metadata from the service as well as the results of a specific query that gave you the problem, then add RSpec tests using that data. Here's an example: f5b30d8

@visoft
Copy link
Owner

visoft commented Jun 24, 2013

I was able to reproduce the problem using the public Northwind OData service, thus I was able to add tests for the issue.

This has been merged into the develop branch. Thanks for the fix!

@visoft visoft closed this Jun 24, 2013
@joshuap
Copy link
Contributor Author

joshuap commented Jun 26, 2013

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants