json-schema
json-schema copied to clipboard
improve handling of fragments
I've encountered a few problems dealing with fragments that this PR addresses:
- traversing the pointer through the document tries to instantiate the value as a json schema at every level, which is not valid when the value is an array, and not needed in any case. only the final value pointed to needs to be instantiated as a schema.
- when validate_schema is on, it validates the given json document, not the schema at the pointer. it should not assume that the given value is a json schema, only that the value at the pointer is.
- strings containing escaped values, either URI escaped in the fragment, or escaped with
~0/~1as defined in https://tools.ietf.org/html/rfc6901 are not handled correctly.
I made a class JSON::Schema::Pointer to abstract the parsing and evaluation of pointers, and updated other code around this.
added https://github.com/ruby-json-schema/json-schema/pull/383 and rebased this against it
this thing alive?
@notEthan Sorry, I've been immensely busy at work and at home for several weeks. I'll take a proper look at this once things calm down here
sounds good, thanks
You might need to rebase this, as I've merged a fragment-related bugfix (#217)
oh my, what a long time I have neglected this. back to it. rebased and addressed some comments.
if you agree that a Pointer is a Pointer, I hope this is ready to be merged. if you feel strongly that it should be polymorphic, I can do that.
hmm. test failures on jruby that I'm not getting locally. one looks related to this change, others don't. will address what I can.
I put a commit fixing a require that was missing, causing failures on jruby, ahead of the content of this PR, it can be merged together or separately
ping on this, hopefully you have time to look at it and we can bring it home
Hi @iainbeeston thanks for the great gem! Could you please look at this PR again? Keys with slashes are all over the place in the swagger specs =)
@iainbeeston is it still maintened? Would it be possible to add more contributors as a lot of PRs are sitting? Thanks!
@scalp42 I'm afraid that the gem does not have any active maintainers at the moment. If you're interested in becoming one please comment on #423