Eine Art | Schlüsselwörter) | Beispiel / Beschreibung |
---|
"Schlüsselwörter" zur Beschreibung des Schemas | "$schema" | "$schema": http:
Wird verwendet, um die Entwurfsversion des Schemas festzulegen. |
"$id"
| "$id": "http://archi-blair.com/schemas/RolesDictionaryDef.json#"
Wird verwendet, um eine eindeutige Kennung für ein Dokument oder seine Unterschaltungen anzugeben. |
"title" "description" "examples" "comment"
| {
"title": "JSON schema for dictionary",
"description": " ",
"examples": ["user", "manager"],
"comment": " ))"
}
|
Allgemeine "Validierungsschlüsselwörter" unabhängig vom Artikeldatentyp | "enum" | {"enum": [ "administrator", "superuser" ]}
Es wird geprüft, ob mindestens 1 Wert übereinstimmt.
|
"const" | {"const": "user" }
Es wird geprüft, ob der eingestellte Wert genau eingehalten wird.
|
"type" | {"type": ["number", "string", "null", "boolean"]}
{"type": "array"}
Gibt den Datentyp an, den das Schema verwenden wird. Dieses Schlüsselwort ist optional, und der Schlüsselwortwert kann eine Zeichenfolge sein, die einen gültigen Datentyp darstellt, oder ein Array von Zeichenfolgen, die gültige Datentypen darstellen.
|
Keywords, , | "type": "string"
minLength maxLength pattern contentEncoding contentMediaType
| {
"type": "string",
"minLength": 3,
"maxLength": 10,
"pattern": "^test\\/[a-z-]+$",
"contentEncoding": "base64",
"contentMediaType": "application/json"
}
.
|
"type": "number" "type": "integer"
minimum exclusiveMinimum maximum exclusiveMaximum multipleOf
| {
"type": "number",
"minimum": 1.5,
"exclusiveMinimum": true,
"maximum": 12.3,
"exclusiveMaximum": true,
"multipleOf": 0.5
}
.
|
"type": "object"
properties required dependencies minProperties maxProperties propertyNames patternProperties additionalProperties
|
"employees": {
"description": "",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"enum": ["employee"],
"enumNames": [""]
},
"enabled": {
"type": "boolean",
"default": true
}
},
"additionalProperties": false
}
}
, ( ).
|
"type": "array"
minItems maxItems uniqueItems contains items additionalItems
|
"employees": {
"description": "",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"enum": ["employee"],
"enumNames": [""]
},
"enabled": {
"type": "boolean",
"default": true
}
},
"additionalProperties": false
}
}
, ( ).
|
"type": "boolean"
| {"type": "boolean"}
boolean (true false).
|
"type": "null"
| {"type": "null"}
null «» .
|
"type": "____" "format": "____"
| {
"type": "string",
"format": "date"
}
format . , .. -, , , .
|
"type": "____" "default": "____"
| {
"enabled": {
"type": "boolean",
"default": true
}
.
, .
|
| "not" "if-then-else"
| {
"not": {
"type": "string"
}
}
, .
|
, | "anyOf" "oneOf" "allOf"
| {
"type": "string",
"anyOf": [
{"const": "user"},
{"const": "manager" }
]
}
, .
|
, | "$id" "$ref" | RolesDictionaryDef.json:
{
"$id": http:
}
1 $ref ( ):
"items": {
"type": "object",
"minLength": 1,
"properties": {
"name": {
"description": " ",
"type": "string"
},
"description": {
"description": " ",
"type": "string"
},
"dictionaryGroup": {
"$ref": "RolesDictionaryDef.json#/definitions/roles"
}
},
"additionalProperties": false
}
2 JSON. , $ref .
|
"$ref" "definitions" | "$ref": "#/definitions/roles" , «definitions»:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": " ",
"type": "object",
"properties": {
"dictionaries": {
"description": "",
"type": "array",
"maxItems": 1,
"items": {
"type": "object",
"minLength": 1,
"properties": {
"name": {
"description": " ",
"type": "string",
"enum": [
"Roles Dictionary"
]
}
"dictionaryGroups": {
"$ref": "#/definitions/roles",
"description": " "
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false,
"definitions": {
"roles": {
"description": "",
"type": "object",
"properties": {
"administrators": {
"description": "",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"enum": [
"administrator",
"superuser"
],
"enumNames": [
"",
"- "
]
},
"enabled": {
"type": "boolean",
"default": true
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"$id": "http://archi-blair.com/schemas/RolesDictionaryDef.json#"
}
, . $ref definitions.
|
"$ref" .
| "$ref": " #/definitions/roles"
"$ref": "RolesDictionaryDef.json#/definitions/roles"
, . , .
|