-
Notifications
You must be signed in to change notification settings - Fork 22
Gavel doesn't support $ref in schemas #25
Comments
I saw that @apiaryio had a fork of Amanda, but didn't realize @Baggz was there as well. I have no experience with the other implementations, but a couple of them looked like they supported more of the schema spec (and some support draf4 features, thought it's not yet been published afaik). It's worth noting that none of them have plans to support other schema languages, so far as I can tell, so if that's the end goal it may make sense to just get Amanda to support the full spec rather than jumping ship. Of the projects I listed, jsonschema supports most of the spec (all of draft3 and some of draft4) and is actively developed (last commit was a few days ago). Z-Schema supports all of draft4 and looks actively developed. JSV looks like a good project and supports all of draft three, but looks unmaintained as of July. But I haven't tried using any of these so I'd be wary to suggest anything based simply on what it says in the Readmes! |
Are there any plans to address this? Z-Schema and https://github.com/natesilva/jayschema seem like decent alternatives for draft4 support. |
@cjha Yes, however it is a bit deeper in queue, because we do have a diff viewer that is fairly dependent on gavel's output...and that is fairly dependent on Amanda's. Are you guys willing to give it a shot? |
@Almad any updates on this? :) |
@honzajavorek It's yours now :P |
@joaosa I think Gavel should be able to currently validate both draft v3 (by Amanda?) and draft v4 (by tv4?), but to be honest, I have currently very little insight on what actually happens under the hood and would have to check. Amanda has last commit 2 years ago and no new development should be expected there. Not sure what are @Baggz's plans with it. As I said, I'd have to check, but
My bet is that the second list item is true (again, this is not verified, it's from the top of my head). So if that's really true and you want to help us to get faster to a solution, you may want to contribute a failing test. Would that work for you? |
@honzajavorek Thank you for the prompt response :) I think I managed to produce two failing tests and added the corresponding schemas:
If needed, I can also place the tests in a more appropriate location within the test suite. Hope it helps! |
@joaosa Thanks! This is great. Both tests make sense to me. |
@honzajavorek Any updates? :) |
@joaosa I'm sorry, not yet. Some priority stuff stepped in. |
@honzajavorek checking in again. I could potentially look into this myself :) |
@joaosa Thanks for pinging and thanks for the effort! I'd be glad to advise you in case you want to work on this 👍 I got back to your tests and I have several comments:
When there are all necessary tests (failing tests, because the feature isn't there yet), we can start to implement the feature and make the tests green. Then let's make a Pull Request and strive for releasing the feature. Gavel uses tv4 to validate Draft4 schemas and according to its README, it should support Good luck! Please get back here if you make any progress or if you get stuck, I'll try to help (and be more responsive). I hope what I wrote will help you to proceed. Note: Since Gavel.js uses Semantic Release, please read this section and make sure your commits are formatted accordingly. Only in that case the automatic releasing will work when your PR gets accepted and merged. Thanks! |
@honzajavorek Thank you for the feedback :) I have some updates on this:
Finally, I squashed some of my old commits and hopefully followed the As for the external file refs, those would be especially useful in my use-case. I could work around this if there's a way to use local schema refs to a global |
@joaosa Great! 👍 🎉 💕
Everything looks really great. Thank you! Regarding external file refs, I think it's okay to support it in Gavel, but we really need to test that it will interpret only valid JSON Schema files, not files like
If you're not sure about it, I can help with the test cases. |
@honzajavorek thank you! Glad to have contributed :) Thanks for describing the test scenarios. I'll look into it next! |
@joaosa I merged the first PR meanwhile. Thanks again! Let me know if you get any far with the additional test cases. |
Gavel uses Amanda for validating payloads against a JSON Schema. Unfortunately Amanda doesn't support
$ref
in schemas, and doesn't look like it will be added any time soon (see this issue from two years ago).This is a feature I would like to have in Gavel. It seems to me that the options are:
The text was updated successfully, but these errors were encountered: