Hi,
I called schema_for! on a type where I accidentally used a recursively defined type as a key in a BTreeMap, which is not allowed in JSON Schemas because all keys must be strings. However, it took me quite a while to figure out where the problem was coming from because I was getting a stack overflow. It's not a major bug, but I'm reporting it so you're aware of it.
Minimal reproducible example
use std::collections::BTreeMap;
use schemars::{JsonSchema, schema_for};
#[derive(JsonSchema, Ord, PartialOrd, Eq, PartialEq)]
struct Test(BTreeMap<Test, u32>);
fn main() {
schema_for!(Test);
}
Error
thread 'main' (59210) has overflowed its stack
fatal runtime error: stack overflow, aborting