Skip to content

Instantly share code, notes, and snippets.

@jadhavj
Created January 6, 2016 09:03
Show Gist options
  • Save jadhavj/cea837822572354ab048 to your computer and use it in GitHub Desktop.
Save jadhavj/cea837822572354ab048 to your computer and use it in GitHub Desktop.
{
"$schema": "UserSchema",
"id": "user",
"type": "object",
"properties": {
"ID": {
"id": "ID",
"type": "string"
},
"username": {
"id": "username",
"type": "value",
"pattern":"^[a-z0-9_-]{3,15}$"
},
"password": {
"id": "password",
"type": "string",
"pattern":"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$"
},
"role": {
"id": "role",
"type": "string"
},
"firstname": {
"id": "firstname",
"type": "string"
},
"lastname": {
"id": "lastname",
"type": "string"
},
"address": {
"id": "address",
"type": "object",
"properties": {
"street": {
"id": "address/street",
"type": "string"
},
"city": {
"id": "address/city",
"type": "string"
},
"state": {
"id": "address/state",
"type": "string"
},
"zip": {
"id": "address/zip",
"type": "integer"
}
}
},
"email": {
"id": "email",
"type": "string",
"pattern":"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"
},
"mobile_number": {
"id": "mobile_number",
"type": "integer",
"pattern":"/^(\+\d{1,3}[- ]?)?\d{10}$/"
},
"card_details": {
"id": "card_details",
"type": "object",
"properties": {
"card_number": {
"id": "card_details/card_number",
"type": "integer",
"pattern":"^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$"
},
"cardholder_name": {
"id": "card_details/cardholder_name",
"type": "string"
},
"expiry": {
"id": "card_details/expiry",
"type": "integer"
"pattern":"/^(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})$/"
},
"card_type": {
"id": "card_details/card_type",
"type": "string",
"oneOf":[
{"type":"VISA"},
{"type":"MASTER"},
{"type":"AmericanExpress"},
{"type":"Dinners Club"},
{"type":"JCB Cards"}
]
}
}
}
},
"required": [
"ID",
"username",
"password",
"role",
"firstname",
"lastname",
"email",
"mobile_number",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment