Skip to content

Instantly share code, notes, and snippets.

@KOUISAmine
Last active November 6, 2023 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KOUISAmine/43eb817a2f274361050ceaa2e09d844c to your computer and use it in GitHub Desktop.
Save KOUISAmine/43eb817a2f274361050ceaa2e09d844c to your computer and use it in GitHub Desktop.
JsonSchemaExample
{
"type": "object",
"properties": {
"users": {
"type": "array",
"minItems": 20,
"maxItems": 20,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"initialOffset": 1,
"autoIncrement": true
},
"name": {
"type": "string",
"faker": "name.findName"
},
"age": {
"type": "integer",
"maximum": 70,
"minimum": 18
},
"birthday": {
"format": "date-time",
"type": "string"
},
"email": {
"type": "string",
"faker": "internet.email"
},
"gender": {
"type": "string",
"pattern": "male|female|i don't know"
},
"married": {
"type": "boolean"
},
"hobbies": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"enum": ["reading","gardening","cooking","dance","sport","art","travel"]
}
},
"avatar": {
"type": "string",
"faker": "internet.avatar"
},
"cash": {
"type": "string",
"faker": {
"finance.amount": [100, 10000, 2, "$"]
}
}
},
"required": ["id", "name", "age", "birthday", "email", "gender", "married", "hobbies", "avatar", "cash"]
}
}
},
"required": ["users"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment