source: trip-planner-front/node_modules/ajv/dist/refs/jtd-schema.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.8 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const shared = (root) => {
4 const sch = {
5 nullable: { type: "boolean" },
6 metadata: {
7 optionalProperties: {
8 union: { elements: { ref: "schema" } },
9 },
10 additionalProperties: true,
11 },
12 };
13 if (root)
14 sch.definitions = { values: { ref: "schema" } };
15 return sch;
16};
17const emptyForm = (root) => ({
18 optionalProperties: shared(root),
19});
20const refForm = (root) => ({
21 properties: {
22 ref: { type: "string" },
23 },
24 optionalProperties: shared(root),
25});
26const typeForm = (root) => ({
27 properties: {
28 type: {
29 enum: [
30 "boolean",
31 "timestamp",
32 "string",
33 "float32",
34 "float64",
35 "int8",
36 "uint8",
37 "int16",
38 "uint16",
39 "int32",
40 "uint32",
41 ],
42 },
43 },
44 optionalProperties: shared(root),
45});
46const enumForm = (root) => ({
47 properties: {
48 enum: { elements: { type: "string" } },
49 },
50 optionalProperties: shared(root),
51});
52const elementsForm = (root) => ({
53 properties: {
54 elements: { ref: "schema" },
55 },
56 optionalProperties: shared(root),
57});
58const propertiesForm = (root) => ({
59 properties: {
60 properties: { values: { ref: "schema" } },
61 },
62 optionalProperties: {
63 optionalProperties: { values: { ref: "schema" } },
64 additionalProperties: { type: "boolean" },
65 ...shared(root),
66 },
67});
68const optionalPropertiesForm = (root) => ({
69 properties: {
70 optionalProperties: { values: { ref: "schema" } },
71 },
72 optionalProperties: {
73 additionalProperties: { type: "boolean" },
74 ...shared(root),
75 },
76});
77const discriminatorForm = (root) => ({
78 properties: {
79 discriminator: { type: "string" },
80 mapping: {
81 values: {
82 metadata: {
83 union: [propertiesForm(false), optionalPropertiesForm(false)],
84 },
85 },
86 },
87 },
88 optionalProperties: shared(root),
89});
90const valuesForm = (root) => ({
91 properties: {
92 values: { ref: "schema" },
93 },
94 optionalProperties: shared(root),
95});
96const schema = (root) => ({
97 metadata: {
98 union: [
99 emptyForm,
100 refForm,
101 typeForm,
102 enumForm,
103 elementsForm,
104 propertiesForm,
105 optionalPropertiesForm,
106 discriminatorForm,
107 valuesForm,
108 ].map((s) => s(root)),
109 },
110});
111const jtdMetaSchema = {
112 definitions: {
113 schema: schema(false),
114 },
115 ...schema(true),
116};
117exports.default = jtdMetaSchema;
118//# sourceMappingURL=jtd-schema.js.map
Note: See TracBrowser for help on using the repository browser.