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

Correctly dereference paths containing '.' #21

Merged
merged 1 commit into from Feb 22, 2019

Conversation

Projects
None yet
2 participants
@pimterry
Copy link
Contributor

pimterry commented Feb 22, 2019

This PR fixes #20.

mpath uses . to describe paths, so a.b.c is property a, then property b, then property c. Unfortunately, that makes it impossible to use keys that contain a ., even though that's legal JSON and appears in some schemas (in my case, Stripe's OpenAPI spec).

This PR drops the mpath dependency entirely, and replaces it by splitting the key on /, and stepping into the schema key by key. I also filter empty keys out, which neatly gets rid of both the / special case and the empty string special case.

I've also added a quick test covering this. That failed before, and now passes (along with all the others).

@bojand bojand merged commit 207cdde into bojand:master Feb 22, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bojand

This comment has been minimized.

Copy link
Owner

bojand commented Feb 22, 2019

Hello, thanks for the PR. Merged and published as 0.9.0. Somehow there was a 0.8.0 already published even though the code was at 0.7.0, perhaps I double published something by mistake before. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.