feat(cuod-bundle): v1.2.1 — x-references на 5 FK полях

Демо нового x-references validator (commit 4142678).
До этого FK relationships были только в description как "FK на ...".
Теперь app-level integrity check на CRUD:

- spacecraft.satellite_type_code → satellite_type.code
- consumer.consumer_type → consumer_type.code
- deliverable_type.typical_processing_level → processing_level.code
- orbital_regime.parent_orbit_type → orbit_type.code
- antenna.ground_station → ground_station.code

Effect: POST/PUT записи с invalid FK → 422 ValidationError code
x_references_target_not_found, не silent broken reference.

Bundle version bumped 1.2.0 → 1.2.1 (breaking-change detection
прокатит — schemaVersion полей не менялись, только metadata).
This commit is contained in:
Zimin A.N.
2026-05-06 17:18:28 +03:00
parent 414267807e
commit 7b6e2145ea
6 changed files with 10 additions and 6 deletions
@@ -10,7 +10,7 @@
"properties": {
"code": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{1,31}$", "x-unique": true },
"name": { "type": "object", "x-localized": true, "patternProperties": { "^[a-z]{2}-[A-Z]{2}$": { "type": "string", "minLength": 1 } }, "required": ["ru-RU"] },
"ground_station": { "type": "string", "description": "FK ground_station.code.", "pattern": "^[A-Z][A-Z0-9_]{1,31}$" },
"ground_station": { "type": "string", "description": "FK ground_station.code.", "pattern": "^[A-Z][A-Z0-9_]{1,31}$", "x-references": "ground_station.code" },
"diameter_m": { "type": "number", "minimum": 0.5, "maximum": 100 },
"supported_bands": { "type": "array", "items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{1,31}$" }, "uniqueItems": true },
"g_t_db_per_k": { "type": "number", "description": "G/T (gain over noise temperature), дБ/К.", "minimum": -10, "maximum": 60 },
@@ -21,7 +21,8 @@
"consumer_type": {
"type": "string",
"description": "FK на consumer_type.code.",
"pattern": "^[A-Z][A-Z0-9_]{1,31}$"
"pattern": "^[A-Z][A-Z0-9_]{1,31}$",
"x-references": "consumer_type.code"
},
"industry_sector": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{1,31}$" },
"country": { "type": "string", "pattern": "^[A-Z]{2}$" },
@@ -17,7 +17,8 @@
"typical_processing_level": {
"type": "string",
"description": "FK на processing_level.code (L0/L1/L2/...).",
"pattern": "^[A-Z][A-Z0-9_]{1,31}$"
"pattern": "^[A-Z][A-Z0-9_]{1,31}$",
"x-references": "processing_level.code"
},
"status": { "type": "string", "enum": ["active", "archived"] }
}
@@ -2,7 +2,7 @@
"bundle": "cuod",
"displayName": "ЦУОД ДЗЗ",
"description": "Bundle справочников для Центра Управления Обработкой Данных ДЗЗ. Anchor v1.",
"version": "1.2.0",
"version": "1.2.1",
"supportedLocales": ["ru-RU", "en-US"],
"defaultLocale": "ru-RU",
"dictionaries": [
@@ -21,7 +21,8 @@
"parent_orbit_type": {
"type": "string",
"description": "FK на orbit_type.code.",
"pattern": "^[A-Z][A-Z0-9_]{1,31}$"
"pattern": "^[A-Z][A-Z0-9_]{1,31}$",
"x-references": "orbit_type.code"
},
"status": { "type": "string", "enum": ["active", "archived"] }
}
@@ -41,7 +41,8 @@
},
"satellite_type_code": {
"type": "string",
"description": "FK на satellite_type.code"
"description": "FK на satellite_type.code",
"x-references": "satellite_type.code"
},
"mass_kg": {
"type": "number",