📄 schemas/StandardDefinition.1.0.json
D-OPEN SOVEREIGN
1{
2  "$schema": "https://json-schema.org/draft/2020-12/schema",
3  "$id": "https://schemas.dsafe.us/StandardDefinition/1.0",
4  "title": "StandardDefinition",
5  "description": "Defines one international identifier standard within the D-SAFE ORM.",
6  "type": "object",
7  "required": ["$schema", "id", "version", "label", "governingBody", "revisionCycle", "status", "props"],
8  "additionalProperties": false,
9  "properties": {
10    "$schema": { "type": "string", "const": "https://schemas.dsafe.us/StandardDefinition/1.0" },
11    "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "Stable lowercase kebab-case identifier. Frozen once published." },
12    "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+$", "description": "Semver of the definition file (not the ISO standard version)." },
13    "label": { "type": "string" },
14    "description": { "type": "string" },
15    "governingBody": { "type": "string" },
16    "isoReference": { "type": ["string", "null"] },
17    "revisionCycle": {
18      "type": "string",
19      "enum": ["annual", "triennial", "decennial", "irregular", "continuous", "frozen"]
20    },
21    "status": {
22      "type": "string",
23      "pattern": "^(active|deprecated|superseded-by:[a-z][a-z0-9-]*)$"
24    },
25    "props": {
26      "type": "array",
27      "minItems": 1,
28      "items": {
29        "type": "object",
30        "required": ["name", "type", "normalize"],
31        "additionalProperties": false,
32        "properties": {
33          "name":        { "type": "string" },
34          "type":        { "type": "string", "enum": ["string", "uint32", "uint64"] },
35          "nullable":    { "type": "boolean", "default": true },
36          "normalize":   { "type": "string" },
37          "display":     { "type": "string" },
38          "checkDigit": {
39            "type": "object",
40            "required": ["algorithm", "position"],
41            "additionalProperties": false,
42            "properties": {
43              "algorithm": { "type": "string" },
44              "position":  { "type": "string", "enum": ["last", "embedded"] }
45            }
46          },
47          "pattern":     { "type": "string" },
48          "description": { "type": "string" }
49        }
50      }
51    },
52    "pk": {
53      "type": "string",
54      "description": "Name of the prop that serves as the primary key for crosswalk and LoadInstance(). Required when uriScheme is non-null."
55    },
56    "uriScheme":     { "type": ["string", "null"] },
57    "linkedDataUri": { "type": ["string", "null"] },
58    "externalApis": {
59      "type": "array",
60      "items": {
61        "type": "object",
62        "required": ["id", "name", "kind", "fieldMapping"],
63        "additionalProperties": false,
64        "properties": {
65          "id":             { "type": "string" },
66          "name":           { "type": "string" },
67          "kind":           { "type": "string", "enum": ["lookup", "search"] },
68          "maxResults":     { "type": "integer", "minimum": 1 },
69          "requiresApiKey": { "type": "boolean", "default": false },
70          "rateLimit": {
71            "oneOf": [
72              { "type": "null" },
73              {
74                "type": "object",
75                "required": ["requests", "windowSeconds"],
76                "additionalProperties": false,
77                "properties": {
78                  "requests":      { "type": "integer", "minimum": 1 },
79                  "windowSeconds": { "type": "integer", "minimum": 1 }
80                }
81              }
82            ]
83          },
84          "fieldMapping": {
85            "type": "array",
86            "items": {
87              "type": "object",
88              "required": ["source", "target", "overwrite"],
89              "additionalProperties": false,
90              "properties": {
91                "source":    { "type": "string" },
92                "target":    { "type": "string" },
93                "overwrite": { "type": "string", "enum": ["always", "if-empty", "never"] }
94              }
95            }
96          }
97        }
98      }
99    },
100    "translations": {
101      "type": "object",
102      "additionalProperties": {
103        "type": "object",
104        "properties": {
105          "props": {
106            "type": "object",
107            "additionalProperties": { "type": "string" }
108          }
109        }
110      }
111    }
112  }
113}
114