Skip to content

Conversation

@jayvdb
Copy link
Contributor

@jayvdb jayvdb commented Nov 15, 2025

@jayvdb jayvdb force-pushed the utoipa-gen-use-desynt branch from 6cf3dbc to d53fd67 Compare November 15, 2025 11:06
@jayvdb jayvdb marked this pull request as ready for review November 15, 2025 11:15
@juhaku juhaku added the blocked Work cannot proceed because some reason label Nov 24, 2025
@juhaku
Copy link
Owner

juhaku commented Nov 24, 2025

While this seems fascinating peace of work, it seems a bit overkill just to get r#... stripped from the struct fields. What was previously there. Though this can strip away r#... not just from named struct fields but also from the types itself which itself could be useful but not sure whether in the utoipa context.

Nonetheless as for now this need to be blocked, utoipa is still in edition 2021 and is committed to work with rust 1.75. Thus there are certain features that are not available.

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 25, 2025

Thanks for the explanation @juhaku . I have downgraded the MSRV and edition in desynt's main. Will publish soon, but before doing that I will dig in a bit more to try to find more justification for utoipa.

Indeed desynt does more than structs. People can put r# anywhere, and it is valid Rust, and of course it is even more valid inside macro args where there are no rules at all. It would be trivial for me to find "bugs" in utoipa where it fails because I put an r# where it doesnt support it. I encountered this in https://github.com/Electron100/butane , and gave up trying to plug the leaks - it needed a new approach to properly solve the problem.

More importantly, this PR currently only uses desynt's r# removal capability. The other part of the library that builds on top of that is the ability to resolve many variation of a types name, such as all possible variations of "::std::option::Option" to be simply "Option". I'll dig around in the utoipa code for where this other feature can be utilised.

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 25, 2025

I have put up #1502 as WIP to show the type resolver in action. Tests are still AI sloppy, and lots of room for improvement in the implementation. But it shows how utoipa can work correctly with many more variations of r# and type path that are valid Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Work cannot proceed because some reason

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants