Yaml-json-schema
提供:Dev Guides
YAML-JSONスキーマ
JSON schema in YAML is considered as the common denominator of most modern computer languages. It allows parsing JSON files. It is strongly recommended in YAML that other schemas should be considered on JSON schema. The primary reason for this is that it includes key value combination which are user friendly. The messages can be encoded as key and can be used as and when needed.
JSONスキーマはスカラーであり、値がありません。 JSONスキーマのマッピングエントリは、nullが有効として扱われるキーと値のペアの形式で表されます。
例
ヌルのJSONスキーマは次のように表されます-
!!null null: value for null key
key with null value: !!null null
JSON表現の出力は以下に記載されています-
{
"null": "value for null key",
"key with null value": null
}
例
次の例は、ブールJSONスキーマを表します-
YAML is a superset of JSON: !!bool true
Pluto is a planet: !!bool false
以下は、JSON形式で同じための出力です-
{
"YAML is a superset of JSON": true,
"Pluto is a planet": false
}
例
次の例は、整数のJSONスキーマを表します-
negative: !!int -12
zero: !!int 0
positive: !!int 34
{
"positive": 34,
"zero": 0,
"negative": -12
}
例
JSONスキーマのタグは、次の例で表されます-
A null: null
Booleans: [ true, false ]
Integers: [ 0, -0, 3, -19 ]
Floats: [ 0., -0.0, 12e03, -2E+05 ]
Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]
以下に示すように、JSON出力を見つけることができます-
{
"Integers": [
0,
0,
3,
-19
],
"Booleans": [
true,
false
],
"A null": null,
"Invalid": [
true,
null,
"0o7",
58,
12.300000000000001
],
"Floats": [
0.0,
-0.0,
"12e03",
"-2E+05"
]
}