-
Notifications
You must be signed in to change notification settings - Fork 202
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
Parsing JSON directly #10
Comments
I am using Pydantic quite heavily in tandem with our own CBOR parsing code. It would be great if we could plug in an arbitrary |
See also the work in As a total Rust noob, I made a POC fork of orjson with CBOR support: https://github.com/griels/orjson/tree/cbor-support-mk2 so it's quite simple to work in different codecs. |
The options are:
But I don't know if that's possible, it would probably be "unsafe" e.g. if you passed a pointer to something other than a |
If you have a model for "plugins" that's well developed, please explain - I can't see how that would work, but maybe I'm missing something. |
Thanks, I'll have to think about it. It seems there isn't an obvious ABI Rust code can offer for 'plugins', short of wrapping in a C FFI (maybe something like the JSONInput you mention), so I guess otherwise serde codecs might have to be injected at the source code level. Perhaps there is someone who has already tackled this. Apologies for necroposting by the way! 'Plugging' |
Would be amazing if we could parse and validate JSON directly, without creating python objects, then validating them.
The basic idea would be to create traits to achieve all the conversions used here, then implement those traits for both serde types, and pyo3 types.
Then use those types instead of pyo3 types throughout validators.
If we did this, it also opens the door to using pydantic-core without python 👀 - e.g. in an entirely theoretical "Tydantic" typescript package.
The text was updated successfully, but these errors were encountered: