jsonschema
jsonschema copied to clipboard
feat(validation): Add a shared storage between all substates of a ValidateState
This new field is similar to the Misc
field from a ValidationState
but is shared between all a ValidationState and all its child SubStates.
In the project I'm using this library I have a few custom keywords and I need to be able to identify which are the datapaths that are associated with such keywords.
The easiest way I could think of solving this problem was by having this shared storage at the ValidationState
level.
This way, in my custom keyword ValidateKeyword
method, I could save the necessary info and have it available as a result of the validation.
@Arqu do you think this is something that could be merged in?
The struct isn't cleared on a new substate and keys can easily collide depending on usage.
Not clearing the struct was the whole point of adding the new field. That is pretty much the difference to the Misc field.
I'll create a basic test that at least confirms my usecase and make the name changes
At the very least lets document that in the comment on the declaration. Not really sold on the use case but like that it would add a way for others to extend the implementation for their needs.
Ie be more explicit that its not cleared and share the key space for its lifetime.