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

library: Consider exporting validator classes, not just raw schemas #105

Open
untitaker opened this issue Apr 11, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@untitaker
Copy link
Member

Our Rust and Python libraries currently export schema objects that users can then plug into their favorite JSON schema validator library. This was intentionally done so because we did not want to be prescriptive of what people want to do with it. People could choose to use arroyo's codecs or write their own glue code.

I think it would make sense to move arroyo's codecs into this library, and replicate them into Rust as well, for three reasons:

  • @jjbayer has provided feedback here that the ingest team would not like to maintain that code

  • A story for msgpack #104 might require us to make proprietary extensions to JSON-schema that are incompatible with generic JSON-schema validators out there

  • We could write validators that both 1) perform validation 2) return the correct Python type

    def get_event(message: Any) -> EventV1:
        # invoke fastjsonschema here and perform typing.cast
        ...
    

Needs more thought. Proprietary extensions to JSON schema are unlikely to be desirable if they make it impossible to use off the shelf validation libraries.

@jjbayer
Copy link
Member

jjbayer commented Apr 13, 2023

Thanks for tracking this! It makes sense to defer this decision until we have more use cases.

@jjbayer has provided feedback getsentry/relay#2013 (comment) that the ingest team would not like to maintain that code

FWIW, my concern was about library boundaries, not team boundaries. Happy to contribute across repositories, and contributions to Relay are always welcome.

@untitaker untitaker added the enhancement New feature or request label Apr 13, 2023
@untitaker
Copy link
Member Author

This is partially fixed by #116 for Python. Not entirely clear to me which API would work best in Rust.

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

No branches or pull requests

2 participants