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

Minified code option #556

Open
jon-zu opened this issue Apr 15, 2024 · 3 comments
Open

Minified code option #556

jon-zu opened this issue Apr 15, 2024 · 3 comments

Comments

@jon-zu
Copy link

jon-zu commented Apr 15, 2024

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
Copy link
Collaborator

ahl commented Apr 18, 2024

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
Copy link
Author

jon-zu commented May 2, 2024

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.

@juntyr
Copy link

juntyr commented Aug 16, 2024

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.

The default inclusion of the schema in the docs also makes a trip from typify -> schemars -> typify have exponential doc comment growth. Perhaps there could be an option to disable the inclusion of the schema in the docs.

Of course, a roundtrip from typify with #[derive(schemars::JsonSchema)] is currently lossy. Since typify already takes in a schemars schema, perhaps there could be a special case for the derive / a unique option entirely to directly generate the JsonSchema impl from within typify so that no information is lost?

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

3 participants