brandur/json_schema

json_schema and json_pointer

okitan opened this issue · 1 comments

json_schema and json-pointer cannot be used at the same time.
That is because JsonPointer is module in json_schema but class in json-pointer.

[1] pry(main)> require "json-pointer"
=> true
[2] pry(main)> require "json_schema"
TypeError: JsonPointer is not a module

This kind of conflict is really difficult to solve, when I'd like to use two libraries and one uses json_schema and the other uses json-pointer.

I think the easiest workaround (but ugly) of it is to change JsonPointer in json_schema from module to class.
It is really lucky JsonPointer in json_shema does not have JsonPointer.evaluate and JsonPointer::Evaluator...

What do you think about this issue?

Oof, this is a tricky one.

I think I ended up exposing JsonPointer from the package because I'd thought about splitting it out into its own package eventually (outside of json_schema). Looking back on it now though, it's really not right that json_schema brings things in that are not scoped to its local namespace. JsonPointer here should probably be JsonSchema::JsonPointer to be representative of the fact that it comes from this package.

That said, given that this is technically a breaking API change, I'd probably want to increment the major version to wrap all of this up.

Would this approach solve your problem?