oxidecomputer / typify

JSON Schema -> Rust type converter
Apache License 2.0
356 stars 53 forks source link

Minified code option #556

Open jon-zu opened 2 months ago

jon-zu commented 2 months ago

It'd be helpful to allow options to completely/partially minify the generated code. Especially docs can bloat up the code a lot. So I'd suggest we add an option to generate code without docs.

ahl commented 2 months ago

I'm reluctant to strip out documentation that comes from the schema itself. Perhaps you're reacting to the inclusion of the schemas themselves in the docs? I added that thinking it was neat, but it certainly adds to the LoC count. What's your goal with reducing the amount of code? I wouldn't think that comments would materially impact build times for example.

jon-zu commented 2 months ago

Sorry for the late reply, my use case is that I auto generate a schema from older game binary files which are somewhat inconsistent, so the result is a really bloated schema (LOC: 30k with docs, 4k without) which unfortunately slows down rust-analyzer a lot. For now, I'm using a simple python script to remove the docs, which works just fine for me. Otherwise I really like the generated docs.