Json -
Код: Выделить всё
{
"$schema": "http://json-schema.org/draft-03/schema",
"title": "Email Recipient",
"description": "Schema for an email recipient document.",
"type": "object",
"additionalProperties": false,
"required": true,
"properties": {
"firstName": {
"type": "string",
"maxLength": 30
},
"lastName": {
"type": "string",
"minLength": 1,
"maxLength": 50
},
"emailAddress": {
"type": "string",
"pattern": "|^[\\w-']+(?:[\\.\\+&=][\\w-']+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,10}$",
"maxLength": 255,
"required": true
},
"ccEmailAddresses": {
"type": "array",
"items": {
"type" : "string",
"pattern": "|^[\\w-']+(?:[\\.\\+&=][\\w-']+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,10}$"
}
}
}
}
Далее я попробовал поместить шаблон как -
Код: Выделить всё
{
"$schema": "http://json-schema.org/draft-03/schema",
"title": "Email Recipient",
"description": "Schema for an email recipient document.",
"type": "object",
"additionalProperties": false,
"required": true,
"properties": {
"firstName": {
"type": "string",
"maxLength": 30
},
"lastName": {
"type": "string",
"minLength": 1,
"maxLength": 50
},
"emailAddress": {
"type": "string",
"pattern": "|^[\\w-']+(?:[\\.\\+&=][\\w-']+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,10}$",
"maxLength": 255,
"required": true
},
"ccEmailAddresses": {
"type": "array",
"pattern": "|^[\\w-']+(?:[\\.\\+&=][\\w-']+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,10}$",
"items": {
"type" : "string"
}
}
}
}
Я не смог найти никакой документации по этому вопросу, но это, должно быть, очень распространенный вариант использования.
Буду очень признателен за любую помощь.
Спасибо,
Подробнее здесь: https://stackoverflow.com/questions/372 ... chema2pojo