Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created September 7, 2021 10:00
Show Gist options
  • Save ereshzealous/82c577a7a499d9e3418a39d7b2f83a51 to your computer and use it in GitHub Desktop.
Save ereshzealous/82c577a7a499d9e3418a39d7b2f83a51 to your computer and use it in GitHub Desktop.
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"$id": "http://my-paintings-api.com/schemas/painting-schema.json",
"type": "object",
"required" : [
"profession", "gender", "maritalStatus", "dateOfBirth", "fatherName"
],
"properties" : {
"profession" : {
"type" : "string",
"enum": ["Banker", "Doctor", "Farmer", "Actor", "Singer", "Athlete", "IT Professional"]
},
"gender" : {
"type": "string"
},
"alternateContacts" : {
"type": "array",
"items": { "$ref": "#/$defs/tag" }
},
"dateOfBirth" : {
"type": "string",
"format": "date"
},
"maritalStatus" : {
"type": "string"
},
"fatherName" : {
"type": "string"
},
"familyMembers" : {
"type": "string"
},
"spouseName" : {
"type": "string"
},
"licence" : {
"type": "string",
"minLength": 5
},
"qualification" : {
"type": "string"
},
"crop" : {
"type": "string",
"minLength": 3
},
"farmSize" : {
"type": "string"
},
"latitude" : {
"type": "number"
},
"longitude" : {
"type": "number"
},
"cultivationSeasons" : {
"type": "array",
"items": { "$ref": "#/$defs/tag" }
},
"designation" : {
"type": "string"
},
"organization" : {
"type": "string"
},
"employeeCode" : {
"type": "string"
},
"registrationNumber" : {
"type": "string"
},
"sports" : {
"type": "array",
"items": { "$ref": "#/$defs/tag" }
},
"designation" : {
"type": "string"
},
"bank" : {
"type": "string"
},
"branchCode" : {
"type": "string"
},
"employeeCode" : {
"type": "string"
}
},
"oneOf": [{
"properties": {
"profession": {
"enum": ["Doctor"]
}
},
"required": ["licence", "qualification"]
},
{
"properties": {
"profession": {
"enum": ["Farmer"]
}
},
"required": ["crop", "farmSize", "latitude", "longitude"]
},
{
"properties": {
"profession": {
"enum": ["Banker"]
}
},
"required": ["designation", "branch", "branchCode", "employeeCode"]
},
{
"properties": {
"profession": {
"enum": ["Athlete"]
}
},
"required": ["sports"]
},
{
"properties": {
"profession": {
"enum": ["Singer"]
}
},
"required": ["registrationNumber"]
},
{
"properties": {
"profession": {
"enum": ["Actor"]
}
},
"required": ["registrationNumber"]
},
{
"properties": {
"profession": {
"enum": ["IT Professional"]
}
},
"required": ["designation", "organization", "employeeCode"]
}],
"$defs": {
"tag": {
"type": "string",
"minLength": 1
},
"_info" : {
"type": "object",
"properties": {
"crop" : {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment