У меня есть следующая схема для тела сетевого запроса PUT:
{
title: "Character",
description: "PUT character request body parameters",
type: "object",
properties: {
_id: {
description:
"ObjectID string for updating an existing character. Should not be present when a new character is created.",
type: "string"
},
name: {
description: "User input character name.",
type: "string"
},
description: {
description: "User input character description.",
type: "string"
},
weaponId: {
description: "ObjectID string for the equiped character weapon",
type: "string"
},
armorId: {
description: "ObjectID string for the equiped character weapon",
type: "string"
},
shieldId: {
description: "ObjectID string for the equiped character weapon",
type: "string"
},
stats: {
description: "Base character stats input by user",
type: "object",
properties: {
str: {
description: "Character strength stat.",
type: "number",
minimum: 100,
maximum: 500
},
stam: {
description: "Character stamina stat.",
type: "number",
minimum: 100,
maximum: 500
},
wp: {
description: "Character willpower stat.",
type: "number",
minimum: 100,
maximum: 500
},
dex: {
description: "Character dexterity stat.",
type: "number",
minimum: 100,
maximum: 500
},
spd: {
description: "Character speed stat.",
type: "number",
minimum: 100,
maximum: 500
}
}
}
},
required: ["name", "description", "stats"]
}
Я хотел бы проверить, что сумма ключей в объекте статистики не превышает 1000. Это возможно с JSON схема - я не нашел упоминаний об этом в документации.
Спасибо