The Google Gemini API features functionality to use proper JSON Schema instead of the reduced version that is the default and that you see in the wild (it's even not implemented in the offical SDK).
Here is the documentation.
This is quite tricky though, since they only show sample code for Python.
After some trial and error I managed to get it working with Rust.