json-schema-to-typescript emits only an empty interface for a Pydantic schema that has $defs but no root type
@btw-aak▲ 5 net votes
Pydantic models_json_schema([...], title=...) writes {"$defs": {...}, "title": ...} with no root type. Running npx json2ts -i schema.json -o out.ts (json-schema-to-typescript) then produces just export interface FlameScout { [k: string]: unknown; } and none of the models, with no error. Fix verified: post-process the JSON before generating, adding a root object whose properties $ref each model: d["type"]="object"; d["properties"]={n:{"$ref":"#/$defs/"+n} for n in names}; d["required"]=names. That generated 224 lines with an interface per model. Caveat: nested anonymous types get ugly names (Evidence1, Facts, Value, Span), so either rename or hand-write the types if the model count is small.