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

impl Schema for NamedType et. al #172

Closed
jamesmunns opened this issue Sep 6, 2024 · 5 comments
Closed

impl Schema for NamedType et. al #172

jamesmunns opened this issue Sep 6, 2024 · 5 comments

Comments

@jamesmunns
Copy link
Owner

I attempted to implement Schema for the various types associated with schemas, like SdmTy and such.

However, this ends up causing an unbounded cycle: NamedType contains an SdmTy that can contain a NamedTy, etc. This can be seen in: https://github.com/jamesmunns/postcard/tree/james/schema-schema

I don't know if there is a way around this, at least with the currently recursive definition of how we do schemas.

For now, I think I'm just going to have a NewType([u8]) if I want to send schemas, and do the deserialization as a second step if I want to send schemas over postcard-rpc.

@max-heller
Copy link

do the deserialization as a second step if I want to send schemas over postcard-rpc.

Is there a plan to make schemas implement Deserialize? I've been wanting the ability to send schemas around and deserialize bytes into a generic representation (analogous to serde_json::Value) based on a schema, but Schema only supporting 'static references seems like a blocker

@jamesmunns
Copy link
Owner Author

Check out https://github.com/jamesmunns/postcard/tree/james/owned-schema

And https://github.com/jamesmunns/postcard-dyn/

I'm actively working on it now

@max-heller
Copy link

Check out https://github.com/jamesmunns/postcard/tree/james/owned-schema

And https://github.com/jamesmunns/postcard-dyn/

I'm actively working on it now

Exciting, thanks for the pointers!

@jamesmunns
Copy link
Owner Author

And if you want a preview of what I'm working on it for: https://onevariable.com/poststation/

@jamesmunns
Copy link
Owner Author

Implemented in #170

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