Compile time JSON type checking

Hello! When I use the sqlx::query_as! macro I get compile time type validation. Is there anything that lets me do that with a JSON file? Specifically I want a crate that generates/validates a type with a JSON file. I don't want a website to generate it

You can put calls to serde_json in a proc-macro.

You should check out json_shema. It's all about validating json for correctness. It's dynamic in that you give it json and then it tells you if it conforms to the schema, but you'll just need to run it at build time. Perhaps a proc macro or maybe just a regular build step before compiling.

I think I came across a json_schema crate... Ah this might be the one: Rust Package Registry

There are a bunch of crates doing similar things and related things like generating schemas, or generating struct definitions from a schema.