brandur / json_schema

A JSON Schema V4 and Hyperschema V4 parser and validator.
MIT License
230 stars 45 forks source link

Fix reference expansion for hyper-schema links #80

Closed brandur closed 7 years ago

brandur commented 7 years ago

As described in #79, a change that I'd put in improve and optimize reference expansion in #75 unfortunately had the effect of breaking expansion when it came to hyper-schema links.

This patch corrects that problem by making links behave more like schemas so that they can be hydrated from a different reference object just like a schema can. Also adds a new Attributes module to better extract and test attribute handling.

The only unusual part of the implementation is that I had to move Link attributes into the Schema class so that it's possible to copy them over when expanding a reference. The old Link class still works as before though, so this change is backward compatible.

Fixes #79.