Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schemas affected by an event validation #237

Closed
afranzi opened this issue Nov 8, 2018 · 5 comments
Closed

Schemas affected by an event validation #237

afranzi opened this issue Nov 8, 2018 · 5 comments

Comments

@afranzi
Copy link
Contributor

afranzi commented Nov 8, 2018

Hi there,

I was wondering if there is any way to know which schemas were matching with a specific event.

This feature could be great for testing if the object schemas are being matched properly as expected.

Thanks,

@erosb
Copy link
Contributor

erosb commented Nov 8, 2018

Hello,

any way to know which schemas were matching with a specific event

I'm not sure if I understand what you mean. My first idea would be just looping through schemas and validating the event json against each schema, checking which one passes.

@afranzi
Copy link
Contributor Author

afranzi commented Nov 8, 2018

Hi @erosb,

Imagine that you have an event schema with some fields that are OneOf/AnyOf with $refs to other objects schemas and some of them as a recursive $refs.

I would like to know which $refs were matching against the validated event.

@erosb
Copy link
Contributor

erosb commented Nov 8, 2018

Aha! That's not supported currently by the library.
I can imagine though that it could be possible to attach some sort of listener to the Validator object which gets notified on anyOf/oneOf matches. Let's keep this issue open, it may be implemented in the future (I can't promise any ETA though).

@afranzi
Copy link
Contributor Author

afranzi commented Nov 13, 2018

I've just opened a PR related #242 with this issue. :)

@erosb erosb closed this as completed Dec 15, 2018
@erosb
Copy link
Contributor

erosb commented Dec 15, 2018

The listener API is now included in version 1.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants