justify
justify copied to clipboard
Custom keywords impl support
Hi, my company is considering using this library. We want to be able to extend the JSON Schema spec with custom keywords, but it is not currently supported. I would be happy to discuss this change with you and contribute.
I tried implementing a range
keyword as described in 1. I ran into these problems:
- The base keyword classes (
AbstractNumericAssertion
) are private, and can't be extended in my own package. -
ProblemBuilder
withMessage
builder method requiresMessage
as argument. I think it would be better if it acceptsBaseMessage
, which should be a public interface I can implement. - I'm not yet sure how to inject my own keyword into
Justify
, butStandardKeywordFactory
seems to be the way. Maybe it can have anaddKeyword
method?
Happy to help, if you have an API in mind, I can come up with an impl. Thanks for this great project!
@Navgeet There are two challenging tasks left for me in this project.
- Implement the latest specification
draft 2019-09
(see #29) - Implement mechanism for users to extend the validator with their own custom keywords, as you requested
I am currently working on the first task. The latest specification will introduce a new concept vocabulary, which is a unit for grouping schema keywords. The concept may force me to change the software design relating to schema keywords and may also provide an impact on the extension API for custom keywords. Could you please wait for me to improve the current design in order to accommodate the latest specification?
Sure, makes sense.