@cardenelabs/dragon 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -720
- package/dist/cli.cjs +4529 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +4523 -0
- package/dist/cli.js.map +1 -0
- package/dist/export.cjs +3912 -0
- package/dist/export.cjs.map +1 -0
- package/dist/export.d.cts +36 -0
- package/dist/export.d.ts +36 -0
- package/dist/export.js +3907 -0
- package/dist/export.js.map +1 -0
- package/dist/fonts.cjs +7 -0
- package/dist/fonts.cjs.map +1 -0
- package/dist/fonts.js +4 -0
- package/dist/fonts.js.map +1 -0
- package/dist/index.cjs +4105 -20356
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -5522
- package/dist/index.d.ts +227 -5522
- package/dist/index.js +4091 -20283
- package/dist/index.js.map +1 -1
- package/dist/player.global.js +2 -0
- package/dist/schema-BBWfniwH.d.cts +112 -0
- package/dist/schema-BBWfniwH.d.ts +112 -0
- package/package.json +39 -24
- package/src/cli.ts +237 -0
- package/src/export/capture.ts +277 -0
- package/src/export/fonts.ts +68 -0
- package/src/export/html.ts +32 -0
- package/src/export/index.ts +146 -0
- package/src/field-messages.ts +104 -0
- package/src/figure-text.ts +42 -0
- package/src/index.ts +30 -283
- package/src/layout/architecture.ts +381 -0
- package/src/layout/measure.ts +21 -0
- package/src/layout/scene.ts +353 -0
- package/src/layout/sequence.ts +189 -0
- package/src/load-fonts.ts +8 -0
- package/src/look/fonts.ts +33 -0
- package/src/look/palettes.json +209 -0
- package/src/look/values.ts +155 -0
- package/src/markdown.ts +35 -0
- package/src/messages.ts +122 -0
- package/src/parser.ts +342 -310
- package/src/player-global.ts +4 -0
- package/src/player.ts +271 -0
- package/src/printer.ts +76 -0
- package/src/render/icons.ts +41 -0
- package/src/render/motion.ts +106 -0
- package/src/render/parts.ts +279 -0
- package/src/render/svg.ts +341 -0
- package/src/schema.ts +161 -16
- package/src/schemas/diagram.schema.json +150 -0
- package/src/schemas/validate-diagram.d.ts +12 -0
- package/src/schemas/validate-diagram.js +8 -0
- package/src/timeline.ts +166 -0
- package/src/tokenize.ts +20 -281
- package/src/version.ts +55 -0
- package/src/view.ts +16 -0
- package/src/words.ts +79 -0
- package/examples/quick-start.md +0 -142
- package/src/canvas-bounds.ts +0 -52
- package/src/color.ts +0 -197
- package/src/compile/actor-ids.ts +0 -297
- package/src/compile/actor-option-notice.ts +0 -379
- package/src/compile/actors.ts +0 -103
- package/src/compile/c4.ts +0 -74
- package/src/compile/chain.ts +0 -93
- package/src/compile/chart-fields.ts +0 -193
- package/src/compile/deep-rewrite.ts +0 -30
- package/src/compile/derived-source.ts +0 -18
- package/src/compile/direction.ts +0 -102
- package/src/compile/edge-option-notice.ts +0 -112
- package/src/compile/er-relation.ts +0 -200
- package/src/compile/flow.ts +0 -54
- package/src/compile/flowchart.ts +0 -344
- package/src/compile/funnel.ts +0 -87
- package/src/compile/gantt.ts +0 -337
- package/src/compile/generic.ts +0 -696
- package/src/compile/hierarchy.ts +0 -92
- package/src/compile/journey.ts +0 -93
- package/src/compile/kinds.ts +0 -139
- package/src/compile/lanes.ts +0 -138
- package/src/compile/metro.ts +0 -271
- package/src/compile/mind.ts +0 -393
- package/src/compile/node-title.ts +0 -24
- package/src/compile/notice.ts +0 -141
- package/src/compile/order.ts +0 -57
- package/src/compile/parts-lookup.ts +0 -17
- package/src/compile/parts.ts +0 -2709
- package/src/compile/placement-apply.ts +0 -689
- package/src/compile/placement.ts +0 -15
- package/src/compile/quadrant.ts +0 -265
- package/src/compile/record.ts +0 -75
- package/src/compile/row-marks.ts +0 -128
- package/src/compile/rows.ts +0 -40
- package/src/compile/sequence.ts +0 -305
- package/src/compile/slug.ts +0 -37
- package/src/compile/stages.ts +0 -247
- package/src/compile/subtitle.ts +0 -35
- package/src/compile/swimlane-marks.ts +0 -87
- package/src/compile/swimlane.ts +0 -82
- package/src/compile/timeline.ts +0 -213
- package/src/compile/topology.ts +0 -44
- package/src/compile/tree.ts +0 -69
- package/src/compile/value-chart.ts +0 -337
- package/src/compile/values.ts +0 -432
- package/src/compile/word-state.ts +0 -82
- package/src/compile.ts +0 -3168
- package/src/focus.ts +0 -46
- package/src/input-size.ts +0 -181
- package/src/json-line-map.ts +0 -30
- package/src/json-parser.ts +0 -4306
- package/src/keywords.ts +0 -417
- package/src/near-name.ts +0 -42
- package/src/notation-lint.ts +0 -342
- package/src/relative-pos.ts +0 -251
- package/src/schemas/diagram.json +0 -3088
- package/src/types.ts +0 -1009
- package/src/v05/index.ts +0 -9
- package/src/v05/input-table.generated.ts +0 -138
- package/src/v05/parser-types.ts +0 -32
- package/src/v05/parser.ts +0 -6668
- package/src/v05/readout-table.generated.ts +0 -1088
- package/src/v05/removed-syntax.ts +0 -115
- package/src/value-syntax.ts +0 -313
- package/src/write-position.ts +0 -270
package/src/schema.ts
CHANGED
|
@@ -1,24 +1,169 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSON Schema
|
|
2
|
+
* 図の原本の形と、原本を JSON Schema で検査する命令。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* const client = new Anthropic();
|
|
8
|
-
* const res = await client.messages.create({
|
|
9
|
-
* model: "claude-sonnet-5",
|
|
10
|
-
* max_tokens: 4096,
|
|
11
|
-
* tools: [{ name: "create_diagram", description: "...", input_schema: diagramJsonSchema }],
|
|
12
|
-
* messages: [{ role: "user", content: "..." }],
|
|
13
|
-
* });
|
|
14
|
-
* const diagram = jsonToDiagram(res.content[0].input);
|
|
4
|
+
* 形の正は `schemas/diagram.schema.json` の 1 本で、下の型はその写し。
|
|
5
|
+
* 誤りは JSON Pointer で場所を示す。欄が足りない時と知らない欄がある時は、その欄の場所まで示す。
|
|
6
|
+
* 誤りの文は呼ぶ側が渡した言葉 (渡さなければ日本語) で出す。文の表は `field-messages.ts` が持つ (#2999)。
|
|
15
7
|
*
|
|
16
|
-
* schema
|
|
8
|
+
* 検査の関数は schema から前もって書き出した物 (`schemas/validate-diagram.js`) を使う。
|
|
9
|
+
* ajv に schema をその場で組み立てさせると `new Function` を使い、`eval` を許さない頁の CSP で止まる。
|
|
10
|
+
* 書き出しは `scripts/build-validator.mjs` が ajv の設定 `{ allErrors: true, discriminator: true, strictTypes: false }` で行う。
|
|
17
11
|
*/
|
|
12
|
+
import type { ErrorObject } from "ajv";
|
|
13
|
+
import { type Allowed, FIELD_MESSAGES, type FieldMessages, type Forbidden } from "./field-messages";
|
|
14
|
+
import validate from "./schemas/validate-diagram.js";
|
|
15
|
+
import type { NotationLang } from "./words";
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
export type Color = "blue" | "amber" | "green" | "violet" | "rose" | "slate" | "coin";
|
|
18
|
+
/** 色の役の一覧。記法の `[色 …]` で書ける値と、誤りの文に並べる値 */
|
|
19
|
+
export const COLORS: readonly Color[] = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
20
|
+
|
|
21
|
+
export interface Region {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
note?: string;
|
|
25
|
+
color?: Color;
|
|
26
|
+
icon?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Box {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
sub?: string;
|
|
33
|
+
color?: Color;
|
|
34
|
+
icon?: string;
|
|
35
|
+
region?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type Carry = { kind: "envelope" } | { kind: "tag"; text: string } | { kind: "coin" } | { kind: "none" };
|
|
39
|
+
|
|
40
|
+
export type LabelSide = "above" | "below" | "left" | "right";
|
|
41
|
+
|
|
42
|
+
/** 見せ方。`fixed` は全体を止めて中だけ動かし、`follow` は寄って動かし全体図で今どこかを示す。 */
|
|
43
|
+
export type ViewMode = "fixed" | "follow";
|
|
44
|
+
|
|
45
|
+
export type DiagramEvent =
|
|
46
|
+
| { type: "edge"; from: string; to: string; label?: string; carry: Carry; labelSide?: LabelSide }
|
|
47
|
+
| { type: "action"; box: string; label: string }
|
|
48
|
+
| { type: "swap"; box: string; text: string }
|
|
49
|
+
| { type: "strip"; field: string; value?: string; tag?: string };
|
|
50
|
+
|
|
51
|
+
export interface Step {
|
|
52
|
+
title: string;
|
|
53
|
+
body: string;
|
|
54
|
+
code?: string;
|
|
55
|
+
events: DiagramEvent[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface Diagram {
|
|
59
|
+
version: number;
|
|
60
|
+
kind: "sequence" | "architecture";
|
|
61
|
+
title: string;
|
|
62
|
+
view?: ViewMode;
|
|
63
|
+
regions?: Region[];
|
|
64
|
+
boxes: Box[];
|
|
65
|
+
strip?: { title: string; fields: string[] };
|
|
66
|
+
steps: Step[];
|
|
67
|
+
sequence?: { lifelines: string[] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface FieldError {
|
|
71
|
+
/** 誤った欄の場所 (JSON Pointer) */
|
|
72
|
+
pointer: string;
|
|
73
|
+
message: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type Checked = { ok: true } | { ok: false; errors: FieldError[] };
|
|
77
|
+
|
|
78
|
+
export interface CheckOptions {
|
|
79
|
+
/** 誤りの文の言葉。渡さなければ日本語 */
|
|
80
|
+
lang?: NotationLang;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** 段の中で起きることの種類。schema の event の `discriminator` が見る `type` の値 */
|
|
84
|
+
const EVENT_TYPES = ["edge", "action", "swap", "strip"] as const satisfies readonly DiagramEvent["type"][];
|
|
20
85
|
|
|
21
86
|
/**
|
|
22
|
-
*
|
|
87
|
+
* schema の書けない組み合わせ (`else: { not: { required: [欄] } }`) の 2 か所。誤りの場所の最後の欄で引き、根は "" で引く。
|
|
88
|
+
* 2 か所とも ajv の誤りでは決まりの場所 (`#/else/not`) が同じになるので、誤りの場所で分ける
|
|
23
89
|
*/
|
|
24
|
-
|
|
90
|
+
const NOT_ALLOWED: Record<string, Allowed> = {
|
|
91
|
+
"": { field: "sequence", kind: "sequence" },
|
|
92
|
+
carry: { field: "text", kind: "tag" },
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const escape = (key: string): string => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
96
|
+
|
|
97
|
+
/** `^[^…]+$` の形の決まりから書けない字を読む。違う形の決まりでは `undefined` */
|
|
98
|
+
function forbiddenOf(pattern: string): Forbidden | undefined {
|
|
99
|
+
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
100
|
+
if (inside === undefined) return undefined;
|
|
101
|
+
const chars: string[] = inside.match(/\\.|[^\\]/gu) ?? [];
|
|
102
|
+
return { space: chars.includes("\\s"), chars: chars.filter((char) => char !== "\\s").map((char) => char.replace(/^\\/u, "")) };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** `anyOf` の中の決まりが出した誤り。`anyOf` の誤り 1 つにまとめて出す */
|
|
106
|
+
const branchesOf = (anyOf: ErrorObject, errors: readonly ErrorObject[]): ErrorObject[] =>
|
|
107
|
+
errors.filter(
|
|
108
|
+
(error) =>
|
|
109
|
+
error !== anyOf &&
|
|
110
|
+
error.schemaPath.startsWith(`${anyOf.schemaPath}/`) &&
|
|
111
|
+
(error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`)),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
function toFieldError(error: ErrorObject, errors: readonly ErrorObject[], m: FieldMessages): FieldError {
|
|
115
|
+
const params = error.params as Record<string, unknown>;
|
|
116
|
+
const at = error.instancePath;
|
|
117
|
+
switch (error.keyword) {
|
|
118
|
+
case "additionalProperties": {
|
|
119
|
+
const key = String(params.additionalProperty);
|
|
120
|
+
return { pointer: `${at}/${escape(key)}`, message: m.additionalProperties(key) };
|
|
121
|
+
}
|
|
122
|
+
case "required": {
|
|
123
|
+
const key = String(params.missingProperty);
|
|
124
|
+
return { pointer: `${at}/${escape(key)}`, message: m.required(key) };
|
|
125
|
+
}
|
|
126
|
+
case "not": {
|
|
127
|
+
const allowed = NOT_ALLOWED[at.slice(at.lastIndexOf("/") + 1)];
|
|
128
|
+
return { pointer: allowed ? `${at}/${allowed.field}` : at, message: m.not(allowed) };
|
|
129
|
+
}
|
|
130
|
+
case "anyOf": {
|
|
131
|
+
const branches = branchesOf(error, errors);
|
|
132
|
+
const missing = branches.every((branch) => branch.keyword === "required") ? branches.map((branch) => String(branch.params.missingProperty)) : [];
|
|
133
|
+
return { pointer: at, message: m.anyOf(missing) };
|
|
134
|
+
}
|
|
135
|
+
case "discriminator": {
|
|
136
|
+
const tag = String(params.tag);
|
|
137
|
+
return { pointer: `${at}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
|
|
138
|
+
}
|
|
139
|
+
case "enum":
|
|
140
|
+
return { pointer: at, message: m.enum((params.allowedValues as unknown[]).map(String)) };
|
|
141
|
+
case "type":
|
|
142
|
+
return { pointer: at, message: m.type(String(params.type)) };
|
|
143
|
+
case "minLength":
|
|
144
|
+
return { pointer: at, message: m.minLength(Number(params.limit)) };
|
|
145
|
+
case "pattern":
|
|
146
|
+
return { pointer: at, message: m.pattern(forbiddenOf(String(params.pattern))) };
|
|
147
|
+
case "minItems":
|
|
148
|
+
return { pointer: at, message: m.minItems(Number(params.limit)) };
|
|
149
|
+
case "minimum":
|
|
150
|
+
return { pointer: at, message: m.minimum(Number(params.limit)) };
|
|
151
|
+
case "const":
|
|
152
|
+
return { pointer: at, message: m.const(String(params.allowedValue)) };
|
|
153
|
+
case "oneOf":
|
|
154
|
+
return { pointer: at, message: m.oneOf };
|
|
155
|
+
default:
|
|
156
|
+
return { pointer: at, message: error.message ?? error.keyword };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** 原本の JSON を検査する。版が道具より新しいかは見ない (`readDiagram` が見る)。 */
|
|
161
|
+
export function validateDiagram(input: unknown, options: CheckOptions = {}): Checked {
|
|
162
|
+
if (validate(input)) return { ok: true };
|
|
163
|
+
const all = validate.errors ?? [];
|
|
164
|
+
const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
|
|
165
|
+
const m = FIELD_MESSAGES[options.lang ?? "ja"];
|
|
166
|
+
// 条件付きの決まり (if / then) は中で落ちた決まりの誤りを別に出すので、包む側の if の誤りは出さない
|
|
167
|
+
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
|
|
168
|
+
return { ok: false, errors };
|
|
169
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "dragon の図の原本",
|
|
3
|
+
"description": "区画、箱、線、運ぶ物、段、中身の帯の 6 部品を共通の骨組みに置き、図の種類だけの物は種類の欄に置く。座標は持たない。",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["version", "kind", "title", "boxes", "steps"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"version": { "description": "形式の版", "type": "integer", "minimum": 1 },
|
|
9
|
+
"kind": { "description": "図の種類", "enum": ["sequence", "architecture"] },
|
|
10
|
+
"title": { "$ref": "#/definitions/text" },
|
|
11
|
+
"view": { "description": "見せ方。書かなければ字の大きさで選ぶ。fixed は全体を止めて中だけ動かし、follow は寄って動かし全体図で今どこかを示す", "enum": ["fixed", "follow"] },
|
|
12
|
+
"regions": { "type": "array", "items": { "$ref": "#/definitions/region" } },
|
|
13
|
+
"boxes": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/box" } },
|
|
14
|
+
"strip": { "$ref": "#/definitions/strip" },
|
|
15
|
+
"steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } },
|
|
16
|
+
"sequence": { "$ref": "#/definitions/sequence" }
|
|
17
|
+
},
|
|
18
|
+
"if": { "required": ["kind"], "properties": { "kind": { "const": "sequence" } } },
|
|
19
|
+
"then": { "required": ["sequence"] },
|
|
20
|
+
"else": { "not": { "required": ["sequence"] } },
|
|
21
|
+
"definitions": {
|
|
22
|
+
"text": { "type": "string", "minLength": 1 },
|
|
23
|
+
"id": { "type": "string", "pattern": "^[^\\s\\[\\]「」=:]+$" },
|
|
24
|
+
"color": { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] },
|
|
25
|
+
"region": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["id", "name"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"id": { "$ref": "#/definitions/id" },
|
|
31
|
+
"name": { "$ref": "#/definitions/text" },
|
|
32
|
+
"note": { "$ref": "#/definitions/text" },
|
|
33
|
+
"color": { "$ref": "#/definitions/color" },
|
|
34
|
+
"icon": { "$ref": "#/definitions/text" }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"box": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["id", "name"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"id": { "$ref": "#/definitions/id" },
|
|
43
|
+
"name": { "$ref": "#/definitions/text" },
|
|
44
|
+
"sub": { "$ref": "#/definitions/text" },
|
|
45
|
+
"color": { "$ref": "#/definitions/color" },
|
|
46
|
+
"icon": { "$ref": "#/definitions/text" },
|
|
47
|
+
"region": { "$ref": "#/definitions/id" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"strip": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": ["title", "fields"],
|
|
54
|
+
"properties": {
|
|
55
|
+
"title": { "$ref": "#/definitions/text" },
|
|
56
|
+
"fields": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/text" } }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"step": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["title", "body", "events"],
|
|
63
|
+
"properties": {
|
|
64
|
+
"title": { "$ref": "#/definitions/text" },
|
|
65
|
+
"body": { "$ref": "#/definitions/text" },
|
|
66
|
+
"code": { "$ref": "#/definitions/text" },
|
|
67
|
+
"events": { "type": "array", "items": { "$ref": "#/definitions/event" } }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"event": {
|
|
71
|
+
"description": "段の中で起きること。起きる順に並べる",
|
|
72
|
+
"type": "object",
|
|
73
|
+
"required": ["type"],
|
|
74
|
+
"discriminator": { "propertyName": "type" },
|
|
75
|
+
"oneOf": [
|
|
76
|
+
{
|
|
77
|
+
"description": "線。運ぶ物を載せて送る側から受ける側へ走る",
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": ["type", "from", "to", "carry"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"type": { "const": "edge" },
|
|
83
|
+
"from": { "$ref": "#/definitions/id" },
|
|
84
|
+
"to": { "$ref": "#/definitions/id" },
|
|
85
|
+
"label": { "$ref": "#/definitions/text" },
|
|
86
|
+
"carry": { "$ref": "#/definitions/carry" },
|
|
87
|
+
"labelSide": { "description": "線の名前を置く側 (寄せの指示)", "enum": ["above", "below", "left", "right"] }
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"description": "箱の中の処理",
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"required": ["type", "box", "label"],
|
|
95
|
+
"properties": {
|
|
96
|
+
"type": { "const": "action" },
|
|
97
|
+
"box": { "$ref": "#/definitions/id" },
|
|
98
|
+
"label": { "$ref": "#/definitions/text" }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"description": "箱の下の小さな字の書き換え",
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"required": ["type", "box", "text"],
|
|
106
|
+
"properties": {
|
|
107
|
+
"type": { "const": "swap" },
|
|
108
|
+
"box": { "$ref": "#/definitions/id" },
|
|
109
|
+
"text": { "$ref": "#/definitions/text" }
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"description": "中身の帯の欄の値と札",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": false,
|
|
116
|
+
"required": ["type", "field"],
|
|
117
|
+
"anyOf": [{ "required": ["value"] }, { "required": ["tag"] }],
|
|
118
|
+
"properties": {
|
|
119
|
+
"type": { "const": "strip" },
|
|
120
|
+
"field": { "$ref": "#/definitions/text" },
|
|
121
|
+
"value": { "$ref": "#/definitions/text" },
|
|
122
|
+
"tag": { "$ref": "#/definitions/text" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"carry": {
|
|
128
|
+
"description": "線の上を走る物。封筒 (メッセージや要求)、札 (名前のある値)、硬貨 (価値)、無し",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"required": ["kind"],
|
|
132
|
+
"properties": {
|
|
133
|
+
"kind": { "enum": ["envelope", "tag", "coin", "none"] },
|
|
134
|
+
"text": { "$ref": "#/definitions/text" }
|
|
135
|
+
},
|
|
136
|
+
"if": { "required": ["kind"], "properties": { "kind": { "const": "tag" } } },
|
|
137
|
+
"then": { "required": ["text"] },
|
|
138
|
+
"else": { "not": { "required": ["text"] } }
|
|
139
|
+
},
|
|
140
|
+
"sequence": {
|
|
141
|
+
"description": "時系列図の種類の欄。生存線を左から並べる順",
|
|
142
|
+
"type": "object",
|
|
143
|
+
"additionalProperties": false,
|
|
144
|
+
"required": ["lifelines"],
|
|
145
|
+
"properties": {
|
|
146
|
+
"lifelines": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/id" } }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `scripts/build-validator.mjs` が `diagram.schema.json` から前もって書き出した検査の関数の型。
|
|
3
|
+
* 中身は ajv が組み立てた関数で、頁で `eval` を使わずに動く。
|
|
4
|
+
*/
|
|
5
|
+
import type { ErrorObject } from "ajv";
|
|
6
|
+
|
|
7
|
+
declare const validate: {
|
|
8
|
+
(input: unknown): boolean;
|
|
9
|
+
errors?: ErrorObject[] | null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default validate;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// packages/dragon/scripts/build-validator.mjs が diagram.schema.json から書き出した。手で直さない
|
|
3
|
+
function ucs2length(str) {
|
|
4
|
+
let length = 0;
|
|
5
|
+
for (const _ of str) length++;
|
|
6
|
+
return length;
|
|
7
|
+
}
|
|
8
|
+
export const validate = validate10;export default validate10;const schema11 = {"title":"dragon の図の原本","description":"区画、箱、線、運ぶ物、段、中身の帯の 6 部品を共通の骨組みに置き、図の種類だけの物は種類の欄に置く。座標は持たない。","type":"object","additionalProperties":false,"required":["version","kind","title","boxes","steps"],"properties":{"version":{"description":"形式の版","type":"integer","minimum":1},"kind":{"description":"図の種類","enum":["sequence","architecture"]},"title":{"$ref":"#/definitions/text"},"view":{"description":"見せ方。書かなければ字の大きさで選ぶ。fixed は全体を止めて中だけ動かし、follow は寄って動かし全体図で今どこかを示す","enum":["fixed","follow"]},"regions":{"type":"array","items":{"$ref":"#/definitions/region"}},"boxes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/box"}},"strip":{"$ref":"#/definitions/strip"},"steps":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/step"}},"sequence":{"$ref":"#/definitions/sequence"}},"if":{"required":["kind"],"properties":{"kind":{"const":"sequence"}}},"then":{"required":["sequence"]},"else":{"not":{"required":["sequence"]}},"definitions":{"text":{"type":"string","minLength":1},"id":{"type":"string","pattern":"^[^\\s\\[\\]「」=:]+$"},"color":{"enum":["blue","amber","green","violet","rose","slate","coin"]},"region":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"$ref":"#/definitions/id"},"name":{"$ref":"#/definitions/text"},"note":{"$ref":"#/definitions/text"},"color":{"$ref":"#/definitions/color"},"icon":{"$ref":"#/definitions/text"}}},"box":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"$ref":"#/definitions/id"},"name":{"$ref":"#/definitions/text"},"sub":{"$ref":"#/definitions/text"},"color":{"$ref":"#/definitions/color"},"icon":{"$ref":"#/definitions/text"},"region":{"$ref":"#/definitions/id"}}},"strip":{"type":"object","additionalProperties":false,"required":["title","fields"],"properties":{"title":{"$ref":"#/definitions/text"},"fields":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/text"}}}},"step":{"type":"object","additionalProperties":false,"required":["title","body","events"],"properties":{"title":{"$ref":"#/definitions/text"},"body":{"$ref":"#/definitions/text"},"code":{"$ref":"#/definitions/text"},"events":{"type":"array","items":{"$ref":"#/definitions/event"}}}},"event":{"description":"段の中で起きること。起きる順に並べる","type":"object","required":["type"],"discriminator":{"propertyName":"type"},"oneOf":[{"description":"線。運ぶ物を載せて送る側から受ける側へ走る","type":"object","additionalProperties":false,"required":["type","from","to","carry"],"properties":{"type":{"const":"edge"},"from":{"$ref":"#/definitions/id"},"to":{"$ref":"#/definitions/id"},"label":{"$ref":"#/definitions/text"},"carry":{"$ref":"#/definitions/carry"},"labelSide":{"description":"線の名前を置く側 (寄せの指示)","enum":["above","below","left","right"]}}},{"description":"箱の中の処理","type":"object","additionalProperties":false,"required":["type","box","label"],"properties":{"type":{"const":"action"},"box":{"$ref":"#/definitions/id"},"label":{"$ref":"#/definitions/text"}}},{"description":"箱の下の小さな字の書き換え","type":"object","additionalProperties":false,"required":["type","box","text"],"properties":{"type":{"const":"swap"},"box":{"$ref":"#/definitions/id"},"text":{"$ref":"#/definitions/text"}}},{"description":"中身の帯の欄の値と札","type":"object","additionalProperties":false,"required":["type","field"],"anyOf":[{"required":["value"]},{"required":["tag"]}],"properties":{"type":{"const":"strip"},"field":{"$ref":"#/definitions/text"},"value":{"$ref":"#/definitions/text"},"tag":{"$ref":"#/definitions/text"}}}]},"carry":{"description":"線の上を走る物。封筒 (メッセージや要求)、札 (名前のある値)、硬貨 (価値)、無し","type":"object","additionalProperties":false,"required":["kind"],"properties":{"kind":{"enum":["envelope","tag","coin","none"]},"text":{"$ref":"#/definitions/text"}},"if":{"required":["kind"],"properties":{"kind":{"const":"tag"}}},"then":{"required":["text"]},"else":{"not":{"required":["text"]}}},"sequence":{"description":"時系列図の種類の欄。生存線を左から並べる順","type":"object","additionalProperties":false,"required":["lifelines"],"properties":{"lifelines":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/id"}}}}}};const schema12 = {"type":"string","minLength":1};const func2 = Object.prototype.hasOwnProperty;const func3 = ucs2length;const schema13 = {"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"$ref":"#/definitions/id"},"name":{"$ref":"#/definitions/text"},"note":{"$ref":"#/definitions/text"},"color":{"$ref":"#/definitions/color"},"icon":{"$ref":"#/definitions/text"}}};const schema14 = {"type":"string","pattern":"^[^\\s\\[\\]「」=:]+$"};const schema17 = {"enum":["blue","amber","green","violet","rose","slate","coin"]};const pattern0 = new RegExp("^[^\\s\\[\\]「」=:]+$", "u");function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.id === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.name === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!(((((key0 === "id") || (key0 === "name")) || (key0 === "note")) || (key0 === "color")) || (key0 === "icon"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.id !== undefined){let data0 = data.id;if(typeof data0 === "string"){if(!pattern0.test(data0)){const err3 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.name !== undefined){let data1 = data.name;if(typeof data1 === "string"){if(func3(data1) < 1){const err5 = {instancePath:instancePath+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.note !== undefined){let data2 = data.note;if(typeof data2 === "string"){if(func3(data2) < 1){const err7 = {instancePath:instancePath+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}else {const err8 = {instancePath:instancePath+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.color !== undefined){let data3 = data.color;if(!(((((((data3 === "blue") || (data3 === "amber")) || (data3 === "green")) || (data3 === "violet")) || (data3 === "rose")) || (data3 === "slate")) || (data3 === "coin"))){const err9 = {instancePath:instancePath+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues: schema17.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.icon !== undefined){let data4 = data.icon;if(typeof data4 === "string"){if(func3(data4) < 1){const err10 = {instancePath:instancePath+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}}else {const err12 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}validate11.errors = vErrors;return errors === 0;}const schema19 = {"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"$ref":"#/definitions/id"},"name":{"$ref":"#/definitions/text"},"sub":{"$ref":"#/definitions/text"},"color":{"$ref":"#/definitions/color"},"icon":{"$ref":"#/definitions/text"},"region":{"$ref":"#/definitions/id"}}};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.id === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.name === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((((((key0 === "id") || (key0 === "name")) || (key0 === "sub")) || (key0 === "color")) || (key0 === "icon")) || (key0 === "region"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.id !== undefined){let data0 = data.id;if(typeof data0 === "string"){if(!pattern0.test(data0)){const err3 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.name !== undefined){let data1 = data.name;if(typeof data1 === "string"){if(func3(data1) < 1){const err5 = {instancePath:instancePath+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.sub !== undefined){let data2 = data.sub;if(typeof data2 === "string"){if(func3(data2) < 1){const err7 = {instancePath:instancePath+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}else {const err8 = {instancePath:instancePath+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.color !== undefined){let data3 = data.color;if(!(((((((data3 === "blue") || (data3 === "amber")) || (data3 === "green")) || (data3 === "violet")) || (data3 === "rose")) || (data3 === "slate")) || (data3 === "coin"))){const err9 = {instancePath:instancePath+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues: schema17.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.icon !== undefined){let data4 = data.icon;if(typeof data4 === "string"){if(func3(data4) < 1){const err10 = {instancePath:instancePath+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.region !== undefined){let data5 = data.region;if(typeof data5 === "string"){if(!pattern0.test(data5)){const err12 = {instancePath:instancePath+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}else {const err14 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}validate13.errors = vErrors;return errors === 0;}const schema26 = {"type":"object","additionalProperties":false,"required":["title","fields"],"properties":{"title":{"$ref":"#/definitions/text"},"fields":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/text"}}}};function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.title === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.fields === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "fields"},message:"must have required property '"+"fields"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((key0 === "title") || (key0 === "fields"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.title !== undefined){let data0 = data.title;if(typeof data0 === "string"){if(func3(data0) < 1){const err3 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.fields !== undefined){let data1 = data.fields;if(Array.isArray(data1)){if(data1.length < 1){const err5 = {instancePath:instancePath+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}const len0 = data1.length;for(let i0=0; i0<len0; i0++){let data2 = data1[i0];if(typeof data2 === "string"){if(func3(data2) < 1){const err6 = {instancePath:instancePath+"/fields/" + i0,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/fields/" + i0,schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}}else {const err8 = {instancePath:instancePath+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}}else {const err9 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}validate15.errors = vErrors;return errors === 0;}const schema29 = {"type":"object","additionalProperties":false,"required":["title","body","events"],"properties":{"title":{"$ref":"#/definitions/text"},"body":{"$ref":"#/definitions/text"},"code":{"$ref":"#/definitions/text"},"events":{"type":"array","items":{"$ref":"#/definitions/event"}}}};const schema33 = {"description":"段の中で起きること。起きる順に並べる","type":"object","required":["type"],"discriminator":{"propertyName":"type"},"oneOf":[{"description":"線。運ぶ物を載せて送る側から受ける側へ走る","type":"object","additionalProperties":false,"required":["type","from","to","carry"],"properties":{"type":{"const":"edge"},"from":{"$ref":"#/definitions/id"},"to":{"$ref":"#/definitions/id"},"label":{"$ref":"#/definitions/text"},"carry":{"$ref":"#/definitions/carry"},"labelSide":{"description":"線の名前を置く側 (寄せの指示)","enum":["above","below","left","right"]}}},{"description":"箱の中の処理","type":"object","additionalProperties":false,"required":["type","box","label"],"properties":{"type":{"const":"action"},"box":{"$ref":"#/definitions/id"},"label":{"$ref":"#/definitions/text"}}},{"description":"箱の下の小さな字の書き換え","type":"object","additionalProperties":false,"required":["type","box","text"],"properties":{"type":{"const":"swap"},"box":{"$ref":"#/definitions/id"},"text":{"$ref":"#/definitions/text"}}},{"description":"中身の帯の欄の値と札","type":"object","additionalProperties":false,"required":["type","field"],"anyOf":[{"required":["value"]},{"required":["tag"]}],"properties":{"type":{"const":"strip"},"field":{"$ref":"#/definitions/text"},"value":{"$ref":"#/definitions/text"},"tag":{"$ref":"#/definitions/text"}}}]};const schema37 = {"description":"線の上を走る物。封筒 (メッセージや要求)、札 (名前のある値)、硬貨 (価値)、無し","type":"object","additionalProperties":false,"required":["kind"],"properties":{"kind":{"enum":["envelope","tag","coin","none"]},"text":{"$ref":"#/definitions/text"}},"if":{"required":["kind"],"properties":{"kind":{"const":"tag"}}},"then":{"required":["text"]},"else":{"not":{"required":["text"]}}};function validate19(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs1 = errors;let valid0 = true;const _errs2 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.kind === undefined) && (missing0 = "kind")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.kind !== undefined){if("tag" !== data.kind){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs2 === errors;errors = _errs1;if(vErrors !== null){if(_errs1){vErrors.length = _errs1;}else {vErrors = null;}}let ifClause0;if(_valid0){const _errs4 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.text === undefined){const err2 = {instancePath,schemaPath:"#/then/required",keyword:"required",params:{missingProperty: "text"},message:"must have required property '"+"text"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}var _valid0 = _errs4 === errors;valid0 = _valid0;ifClause0 = "then";}else {const _errs5 = errors;const _errs6 = errors;const _errs7 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if((data.text === undefined) && (missing1 = "text")){const err3 = {};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}var valid2 = _errs7 === errors;if(valid2){const err4 = {instancePath,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}else {errors = _errs6;if(vErrors !== null){if(_errs6){vErrors.length = _errs6;}else {vErrors = null;}}}var _valid0 = _errs5 === errors;valid0 = _valid0;ifClause0 = "else";}if(!valid0){const err5 = {instancePath,schemaPath:"#/if",keyword:"if",params:{failingKeyword: ifClause0},message:"must match \""+ifClause0+"\" schema"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.kind === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}for(const key0 in data){if(!((key0 === "kind") || (key0 === "text"))){const err7 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.kind !== undefined){let data1 = data.kind;if(!((((data1 === "envelope") || (data1 === "tag")) || (data1 === "coin")) || (data1 === "none"))){const err8 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema37.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.text !== undefined){let data2 = data.text;if(typeof data2 === "string"){if(func3(data2) < 1){const err9 = {instancePath:instancePath+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}}else {const err11 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}validate19.errors = vErrors;return errors === 0;}function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.type === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const tag0 = data.type;if(typeof tag0 == "string"){if(tag0 === "edge"){if(data && typeof data == "object" && !Array.isArray(data)){if(data.type === undefined){const err1 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.from === undefined){const err2 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.to === undefined){const err3 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.carry === undefined){const err4 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: "carry"},message:"must have required property '"+"carry"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((key0 === "type") || (key0 === "from")) || (key0 === "to")) || (key0 === "label")) || (key0 === "carry")) || (key0 === "labelSide"))){const err5 = {instancePath,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.type !== undefined){if("edge" !== data.type){const err6 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue: "edge"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.from !== undefined){let data1 = data.from;if(typeof data1 === "string"){if(!pattern0.test(data1)){const err7 = {instancePath:instancePath+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}else {const err8 = {instancePath:instancePath+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.to !== undefined){let data2 = data.to;if(typeof data2 === "string"){if(!pattern0.test(data2)){const err9 = {instancePath:instancePath+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.label !== undefined){let data3 = data.label;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.carry !== undefined){if(!(validate19(data.carry, {instancePath:instancePath+"/carry",parentData:data,parentDataProperty:"carry",rootData}))){vErrors = vErrors === null ? validate19.errors : vErrors.concat(validate19.errors);errors = vErrors.length;}}if(data.labelSide !== undefined){let data5 = data.labelSide;if(!((((data5 === "above") || (data5 === "below")) || (data5 === "left")) || (data5 === "right"))){const err13 = {instancePath:instancePath+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues: schema33.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}else {const err14 = {instancePath,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else if(tag0 === "action"){if(data && typeof data == "object" && !Array.isArray(data)){if(data.type === undefined){const err15 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data.box === undefined){const err16 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "box"},message:"must have required property '"+"box"+"'"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(data.label === undefined){const err17 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}for(const key1 in data){if(!(((key1 === "type") || (key1 === "box")) || (key1 === "label"))){const err18 = {instancePath,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.type !== undefined){if("action" !== data.type){const err19 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue: "action"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.box !== undefined){let data7 = data.box;if(typeof data7 === "string"){if(!pattern0.test(data7)){const err20 = {instancePath:instancePath+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}else {const err21 = {instancePath:instancePath+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.label !== undefined){let data8 = data.label;if(typeof data8 === "string"){if(func3(data8) < 1){const err22 = {instancePath:instancePath+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}else {const err23 = {instancePath:instancePath+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}else {const err24 = {instancePath,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}else if(tag0 === "swap"){if(data && typeof data == "object" && !Array.isArray(data)){if(data.type === undefined){const err25 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(data.box === undefined){const err26 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "box"},message:"must have required property '"+"box"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(data.text === undefined){const err27 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "text"},message:"must have required property '"+"text"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}for(const key2 in data){if(!(((key2 === "type") || (key2 === "box")) || (key2 === "text"))){const err28 = {instancePath,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data.type !== undefined){if("swap" !== data.type){const err29 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue: "swap"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.box !== undefined){let data10 = data.box;if(typeof data10 === "string"){if(!pattern0.test(data10)){const err30 = {instancePath:instancePath+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}else {const err31 = {instancePath:instancePath+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data.text !== undefined){let data11 = data.text;if(typeof data11 === "string"){if(func3(data11) < 1){const err32 = {instancePath:instancePath+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}else {const err34 = {instancePath,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}else if(tag0 === "strip"){const _errs39 = errors;let valid15 = false;const _errs40 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.value === undefined){const err35 = {instancePath,schemaPath:"#/oneOf/3/anyOf/0/required",keyword:"required",params:{missingProperty: "value"},message:"must have required property '"+"value"+"'"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}var _valid0 = _errs40 === errors;valid15 = valid15 || _valid0;if(!valid15){const _errs41 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.tag === undefined){const err36 = {instancePath,schemaPath:"#/oneOf/3/anyOf/1/required",keyword:"required",params:{missingProperty: "tag"},message:"must have required property '"+"tag"+"'"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var _valid0 = _errs41 === errors;valid15 = valid15 || _valid0;}if(!valid15){const err37 = {instancePath,schemaPath:"#/oneOf/3/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs39;if(vErrors !== null){if(_errs39){vErrors.length = _errs39;}else {vErrors = null;}}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.type === undefined){const err38 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(data.field === undefined){const err39 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "field"},message:"must have required property '"+"field"+"'"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}for(const key3 in data){if(!((((key3 === "type") || (key3 === "field")) || (key3 === "value")) || (key3 === "tag"))){const err40 = {instancePath,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data.type !== undefined){if("strip" !== data.type){const err41 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue: "strip"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data.field !== undefined){let data13 = data.field;if(typeof data13 === "string"){if(func3(data13) < 1){const err42 = {instancePath:instancePath+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}else {const err43 = {instancePath:instancePath+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data.value !== undefined){let data14 = data.value;if(typeof data14 === "string"){if(func3(data14) < 1){const err44 = {instancePath:instancePath+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}else {const err45 = {instancePath:instancePath+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data.tag !== undefined){let data15 = data.tag;if(typeof data15 === "string"){if(func3(data15) < 1){const err46 = {instancePath:instancePath+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}}else {const err48 = {instancePath,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}else {const err49 = {instancePath,schemaPath:"#/discriminator",keyword:"discriminator",params:{error: "mapping", tag: "type", tagValue: tag0},message:"value of tag \"type\" must be in oneOf"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath,schemaPath:"#/discriminator",keyword:"discriminator",params:{error: "tag", tag: "type", tagValue: tag0},message:"tag \"type\" must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}else {const err51 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}validate18.errors = vErrors;return errors === 0;}function validate17(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.title === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.body === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "body"},message:"must have required property '"+"body"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.events === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "events"},message:"must have required property '"+"events"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}for(const key0 in data){if(!((((key0 === "title") || (key0 === "body")) || (key0 === "code")) || (key0 === "events"))){const err3 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data.title !== undefined){let data0 = data.title;if(typeof data0 === "string"){if(func3(data0) < 1){const err4 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}else {const err5 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.body !== undefined){let data1 = data.body;if(typeof data1 === "string"){if(func3(data1) < 1){const err6 = {instancePath:instancePath+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.code !== undefined){let data2 = data.code;if(typeof data2 === "string"){if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.events !== undefined){let data3 = data.events;if(Array.isArray(data3)){const len0 = data3.length;for(let i0=0; i0<len0; i0++){if(!(validate18(data3[i0], {instancePath:instancePath+"/events/" + i0,parentData:data3,parentDataProperty:i0,rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}}}else {const err10 = {instancePath:instancePath+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}}else {const err11 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}validate17.errors = vErrors;return errors === 0;}const schema46 = {"description":"時系列図の種類の欄。生存線を左から並べる順","type":"object","additionalProperties":false,"required":["lifelines"],"properties":{"lifelines":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/id"}}}};function validate23(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.lifelines === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lifelines"},message:"must have required property '"+"lifelines"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}for(const key0 in data){if(!(key0 === "lifelines")){const err1 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}if(data.lifelines !== undefined){let data0 = data.lifelines;if(Array.isArray(data0)){if(data0.length < 1){const err2 = {instancePath:instancePath+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}const len0 = data0.length;for(let i0=0; i0<len0; i0++){let data1 = data0[i0];if(typeof data1 === "string"){if(!pattern0.test(data1)){const err3 = {instancePath:instancePath+"/lifelines/" + i0,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern: "^[^\\s\\[\\]「」=:]+$"},message:"must match pattern \""+"^[^\\s\\[\\]「」=:]+$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/lifelines/" + i0,schemaPath:"#/definitions/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}}else {const err5 = {instancePath:instancePath+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}}else {const err6 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}validate23.errors = vErrors;return errors === 0;}function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs1 = errors;let valid0 = true;const _errs2 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.kind === undefined) && (missing0 = "kind")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.kind !== undefined){if("sequence" !== data.kind){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs2 === errors;errors = _errs1;if(vErrors !== null){if(_errs1){vErrors.length = _errs1;}else {vErrors = null;}}let ifClause0;if(_valid0){const _errs4 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.sequence === undefined){const err2 = {instancePath,schemaPath:"#/then/required",keyword:"required",params:{missingProperty: "sequence"},message:"must have required property '"+"sequence"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}var _valid0 = _errs4 === errors;valid0 = _valid0;ifClause0 = "then";}else {const _errs5 = errors;const _errs6 = errors;const _errs7 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if((data.sequence === undefined) && (missing1 = "sequence")){const err3 = {};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}var valid2 = _errs7 === errors;if(valid2){const err4 = {instancePath,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}else {errors = _errs6;if(vErrors !== null){if(_errs6){vErrors.length = _errs6;}else {vErrors = null;}}}var _valid0 = _errs5 === errors;valid0 = _valid0;ifClause0 = "else";}if(!valid0){const err5 = {instancePath,schemaPath:"#/if",keyword:"if",params:{failingKeyword: ifClause0},message:"must match \""+ifClause0+"\" schema"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.version === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.kind === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.title === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.boxes === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "boxes"},message:"must have required property '"+"boxes"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.steps === undefined){const err10 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steps"},message:"must have required property '"+"steps"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}for(const key0 in data){if(!(func2.call(schema11.properties, key0))){const err11 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.version !== undefined){let data1 = data.version;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){const err12 = {instancePath:instancePath+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if((typeof data1 == "number") && (isFinite(data1))){if(data1 < 1 || isNaN(data1)){const err13 = {instancePath:instancePath+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}if(data.kind !== undefined){let data2 = data.kind;if(!((data2 === "sequence") || (data2 === "architecture"))){const err14 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema11.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.title !== undefined){let data3 = data.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err15 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.view !== undefined){let data4 = data.view;if(!((data4 === "fixed") || (data4 === "follow"))){const err17 = {instancePath:instancePath+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues: schema11.properties.view.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.regions !== undefined){let data5 = data.regions;if(Array.isArray(data5)){const len0 = data5.length;for(let i0=0; i0<len0; i0++){if(!(validate11(data5[i0], {instancePath:instancePath+"/regions/" + i0,parentData:data5,parentDataProperty:i0,rootData}))){vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);errors = vErrors.length;}}}else {const err18 = {instancePath:instancePath+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.boxes !== undefined){let data7 = data.boxes;if(Array.isArray(data7)){if(data7.length < 1){const err19 = {instancePath:instancePath+"/boxes",schemaPath:"#/properties/boxes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}const len1 = data7.length;for(let i1=0; i1<len1; i1++){if(!(validate13(data7[i1], {instancePath:instancePath+"/boxes/" + i1,parentData:data7,parentDataProperty:i1,rootData}))){vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);errors = vErrors.length;}}}else {const err20 = {instancePath:instancePath+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.strip !== undefined){if(!(validate15(data.strip, {instancePath:instancePath+"/strip",parentData:data,parentDataProperty:"strip",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}}if(data.steps !== undefined){let data10 = data.steps;if(Array.isArray(data10)){if(data10.length < 1){const err21 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}const len2 = data10.length;for(let i2=0; i2<len2; i2++){if(!(validate17(data10[i2], {instancePath:instancePath+"/steps/" + i2,parentData:data10,parentDataProperty:i2,rootData}))){vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);errors = vErrors.length;}}}else {const err22 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.sequence !== undefined){if(!(validate23(data.sequence, {instancePath:instancePath+"/sequence",parentData:data,parentDataProperty:"sequence",rootData}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}}}else {const err23 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}validate10.errors = vErrors;return errors === 0;}
|