
Stop Writing JSON Schemas by Hand: I Built a Generator That Creates Them Automatically
Stop Writing JSON Schemas by Hand: I Built a Generator That Creates Them Automatically Here's a problem every API developer faces: You have a JSON response from your API. Something like: { "id" : 123 , "name" : "John Doe" , "email" : "john@example.com" , "created_at" : "2024-01-15T10:30:00Z" , "is_active" : true , "tags" : [ "premium" , "verified" ] } Now you need to write a JSON Schema for it (for API documentation, validation, code generation, etc.): { "$schema" : "http://json-schema.org/draft-07/schema#" , "type" : "object" , "properties" : { "id" : { "type" : "integer" }, "name" : { "type" : "string" }, "email" : { "type" : "string" , "format" : "email" }, "created_at" : { "type" : "string" , "format" : "date-time" }, "is_active" : { "type" : "boolean" }, "tags" : { "type" : "array" , "items" : { "type" : "string" } } }, "required" : [ "id" , "name" , "email" ] } Current options: Write it manually — 30+ minutes per schema, error-prone Use an online converter — Free but often inaccu
Continue reading on Dev.to Python
Opens in a new tab



