Skip to content

Add Serde support #83

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add Serde support #83

wants to merge 1 commit into from

Conversation

zkat
Copy link
Member

@zkat zkat commented Oct 11, 2024

This PR adds full serde support to kdl-rs. It works kinda like quick-xml

@zkat zkat force-pushed the zkat/serde branch 5 times, most recently from cd37125 to 1cc1aa8 Compare November 30, 2024 19:25
@zkat zkat force-pushed the zkat/serde branch 6 times, most recently from d6c25bb to 05b95ca Compare December 4, 2024 04:22
@zkat zkat force-pushed the zkat/serde branch 2 times, most recently from 21359e1 to dea9129 Compare December 4, 2024 04:36
@zkat zkat force-pushed the zkat/serde branch 4 times, most recently from 441178d to 1587661 Compare December 9, 2024 07:55
@zkat zkat force-pushed the zkat/serde branch 7 times, most recently from 70992c6 to 8594cf9 Compare December 20, 2024 09:34
@zkat zkat force-pushed the zkat/serde branch 3 times, most recently from 1384083 to a85107d Compare December 22, 2024 02:49
@TheLostLambda
Copy link

Hi @zkat !

I have a bit of time in the evenings in the coming week and was thinking I could take a swing at this! I've been using knuffel / knus stuff again, but since you planted the quick-xml stuff in my head I've wanted to help make that happen and kinda replace knus.

Let me know if I should hold off / if you've been working on this offline — I don't want to step on your toes!

@zkat
Copy link
Member Author

zkat commented Jan 15, 2025

@TheLostLambda oh god yes please help. Save me. I hate this so much 😂

@TheLostLambda
Copy link

Haha, oh dear... I'll try my best... Watching the Jon Gjengset video now and I'll keep you posted on any progress! 😅

@TheLostLambda
Copy link

Hi @zkat ! I've been looking into this a bit and whilst I'm sure it is possible, the more looking I've done the more I'm on the fence about if it's the right way to go about this?

I'm very open to being convinced either way, but I think the actual user experience of using serde_rename with a bunch of special syntax might, to some extent, defeat the DX benefits of using something more "standard" like serde in the first place.

I use things like #[knus(children(name="route"))] incredibly often (where that filters the children of a node to those named "route", then parses each of those and collects them into a Vec<Route>), and I don't see how we'd emulate something like that in serde?

With that being said, I would really really like kdl-rs to have a derive macro — are you still open to that "evil plan" you mentioned over the holidays? KDL v2 -> KDL v1 -> Knus? Eventually, to be honest, I'd like kdl-rs to "eat" knus and for the derive macro to operate on the AST kdl-rs is already generating, but even that shorter-path solution would be beneficial, I think!

The major reason I'm using KDL over anything else is because it lets me create things that are slightly closer to DSLs than normal config files — I think it would be good if whatever derive-macro solution we integrate is just as flexible as KDL itself!

@zkat
Copy link
Member Author

zkat commented Apr 21, 2025

@TheLostLambda I have no idea, but @fasterthanlime recently expressed interest in trying to see if facet could be used instead of serde and was willing to take on that work? Just pinging him into this thread for reference.

@fasterthanlime
Copy link

@TheLostLambda I have no idea, but @fasterthanlime recently expressed interest in trying to see if facet could be used instead of serde and was willing to take on that work? Just pinging him into this thread for reference.

That is correct! I've been getting facet-json to near feature-completion and I'm excited to start work on KDL :)

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

Successfully merging this pull request may close these issues.

3 participants