json-schema icon indicating copy to clipboard operation
json-schema copied to clipboard

improve handling of fragments

Open notEthan opened this issue 8 years ago • 13 comments

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 / ~1 as 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.

notEthan avatar May 17 '17 18:05 notEthan

added https://github.com/ruby-json-schema/json-schema/pull/383 and rebased this against it

notEthan avatar May 17 '17 23:05 notEthan

this thing alive?

notEthan avatar Jun 16 '17 07:06 notEthan

@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

iainbeeston avatar Jun 16 '17 08:06 iainbeeston

sounds good, thanks

notEthan avatar Jun 16 '17 19:06 notEthan

You might need to rebase this, as I've merged a fragment-related bugfix (#217)

iainbeeston avatar Jul 05 '17 17:07 iainbeeston

oh my, what a long time I have neglected this. back to it. rebased and addressed some comments.

notEthan avatar Mar 12 '18 23:03 notEthan

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.

notEthan avatar Mar 13 '18 00:03 notEthan

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.

notEthan avatar Mar 13 '18 01:03 notEthan

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

notEthan avatar Mar 13 '18 02:03 notEthan

ping on this, hopefully you have time to look at it and we can bring it home

notEthan avatar Mar 25 '18 09:03 notEthan

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 =)

skryukov avatar Mar 17 '19 21:03 skryukov

@iainbeeston is it still maintened? Would it be possible to add more contributors as a lot of PRs are sitting? Thanks!

scalp42 avatar Jun 03 '19 05:06 scalp42

@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

iainbeeston avatar Jun 04 '19 10:06 iainbeeston