Provide example/functionality for validating incoming json against schema
There are many examples of extracting a schema from a rust type. But what I would really like is for me to deserialize a RootSchema from my backend, and use it to validate incoming data entirely dynamically. In other words, my code will only have a RootSchema but no concrete types that have #[derive(JsonSchema)].
As far as I can tell, there is no way to do this with schemars.
I'm not using axum, so probably not. I mean something more like this, where the schema and value are dynamic and serializeable.
My understanding is that this crate is intended to provide the ability to generate JSON Schema.
What axum_jsonschema does is to create a JSON Schema with schemars and then validate it using jsonschema and serde_json.
(#[derive(Deserialize, JsonSchema)] is required for struct)
If you want to validate a structure after deserializing it with serde_json, you can use a combination of schemars and validator.
(#[derive(Deserialize, JsonSchema, Validate)] is required for struct)
In any case, a devive like #[derive(JsonSchema)] is necessary if you want to use schemars.