evestera / json_typegen

Tools and libraries to create types for Rust, Kotlin, TypeScript and Python from JSON samples
https://typegen.vestera.as
Apache License 2.0
268 stars 26 forks source link

Passthrough of remote-/local-samples features #34

Closed mbargull closed 2 years ago

mbargull commented 2 years ago

Passthrough of remote-/local-samples features from json_typegen_shared to json_typegen to make additional dependencies (esp. reqwest's dependency tree for remote-samples) optional.

The context here is that we use json_typegen in conjunction with rust-script to let users of the Snakmake workflow management system write helper scripts in Rust. With the remote-samples feature we pull in a dependency chain with reqwest that includes hyper-tls/openssl/openssl-sys which makes the overall setup a bit more complicated since you need a readily available C compiler toolchain available (either to have it compile OpenSSL or even just for its build setup checks). If we expose the remote-samples feature from json_typegen_shared as a feature of json_typegen we can circumvent these extended requirements if the user chooses to do so.

Please let me know if you'd want additional changes to the docs or tests for this and/or feel free to push to this PR branch as you see fit.

(cc @johanneskoester, @tedil)

evestera commented 2 years ago

Thank you for the pull request (and for showing me a cool use of json_typegen I hadn't seen yet)! Considering the work I've been doing lately trying to make json_typegen_shared more lightweight this change makes a lot of sense.

The issue you mention with depending on OpenSSL makes me think I should also look into making reqwest use rustls or or maybe even swap it out with e.g. ureq, for when OpenSSL is an issue but turning off remote-samples is not an option. But slightly besides the point for your issue I guess.

I'll hopefully get around to making a release including this (and all the other recent changes) relatively soon. 🙂

mbargull commented 2 years ago

Hi @evestera,

Thank you for the pull request

Happy to! And thanks for the very quick turnaround!

(and for showing me a cool use of json_typegen I hadn't seen yet)!

I can only agree on that; it's quite nice to use it for Python -> Rust object translation. All props go to @tedil for that one!

The issue you mention with depending on OpenSSL makes me think I should also look into making reqwest use rustls or or maybe even swap it out with e.g. ureq, for when OpenSSL is an issue but turning off remote-samples is not. But slightly besides the point for your issue I guess.

Yes, that'd make sense to me. Having just the Rust toolchain without additional libraries/compilers as a build requirement can be quite convenient :).

I'll hopefully get around to making a release including this (and all the other recent changes) relatively soon. slightly_smiling_face

Oh, that'd be delightful :).

Cheers, Marcel