Paste a payload, get a JSON Schema for it. Useful for the first draft of a contract test, when the API exists and the schema does not.
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"signedUpAt": {
"type": "string",
"format": "date-time"
},
"email": {
"type": "string",
"format": "email"
},
"loginCount": {
"type": "integer"
},
"score": {
"type": "number"
},
"active": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"address": {
"type": "object",
"properties": {
"city": {
"type": "string"
},
"state": {
"type": "string"
}
},
"required": [
"city",
"state"
]
},
"deletedAt": {
"type": "null"
}
},
"required": [
"id",
"name",
"signedUpAt",
"email",
"loginCount",
"score",
"active",
"tags",
"address",
"deletedAt"
]
}One payload can't tell you which fields are optional, so everything in it comes out required. That's the safer way round to be wrong: a schema that asks too much fails loudly, one that asks too little waves bad data through.