SHAR Production
← Все контракты

JSON Schema 2020-12

Матрица локализации

Локали и требуемые аудио/субтитры.

Схема

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sharprod.com/schemas/localization-matrix.schema.json",
  "title": "SHAR Production Localization Matrix Contract",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "master_id": {
      "type": "string"
    },
    "locales": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "tag",
          "audio",
          "subtitles"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "pattern": "^[a-z]{2}(?:-[A-Z]{2})?$"
          },
          "audio": {
            "type": "boolean"
          },
          "subtitles": {
            "type": "boolean"
          }
        }
      }
    }
  },
  "required": [
    "master_id",
    "locales"
  ]
}

Проверенный пример

{
  "input": {
    "master_id": "master-synthetic",
    "locales": [
      {
        "tag": "ru-RU",
        "audio": true,
        "subtitles": true
      }
    ]
  },
  "result": {
    "valid": true,
    "errors": []
  }
}

Отклонённый пример

{
  "input": {
    "master_id": "master-synthetic",
    "locales": [
      {
        "tag": "russian",
        "audio": true,
        "subtitles": true
      }
    ]
  },
  "result": {
    "valid": false,
    "errors": [
      {
        "instancePath": "/locales/0/tag",
        "schemaPath": "#/properties/locales/items/properties/tag/pattern",
        "keyword": "pattern",
        "params": {
          "pattern": "^[a-z]{2}(?:-[A-Z]{2})?$"
        },
        "message": "must match pattern \"^[a-z]{2}(?:-[A-Z]{2})?$\""
      }
    ]
  }
}

SHAR Production · sharprod.com