refactor: make schema root-level object
This commit is contained in:
@@ -1,39 +1,52 @@
|
|||||||
export const extractedFactSchema = {
|
export const extractedFactSchema = {
|
||||||
type: "array",
|
type: "object",
|
||||||
items: {
|
additionalProperties: false,
|
||||||
type: "object",
|
properties: {
|
||||||
additionalProperties: false,
|
items: {
|
||||||
properties: {
|
type: "array",
|
||||||
statement: { type: "string" },
|
items: {
|
||||||
summary: { type: "string" },
|
type: "object",
|
||||||
source: { type: "string" },
|
additionalProperties: false,
|
||||||
confidence: { type: "number" },
|
properties: {
|
||||||
metadata: { type: "object", additionalProperties: false },
|
statement: { type: "string" },
|
||||||
topics: {
|
summary: { type: "string" },
|
||||||
type: "array",
|
source: { type: "string" },
|
||||||
items: {
|
confidence: { type: "number" },
|
||||||
type: "object",
|
metadata: { type: "object", additionalProperties: false },
|
||||||
additionalProperties: false,
|
topics: {
|
||||||
properties: {
|
type: "array",
|
||||||
name: { type: "string" },
|
items: {
|
||||||
category: {
|
type: "object",
|
||||||
type: "string",
|
additionalProperties: false,
|
||||||
enum: ["entity", "concept", "temporal", "custom"],
|
properties: {
|
||||||
|
name: { type: "string" },
|
||||||
|
category: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["entity", "concept", "temporal", "custom"],
|
||||||
|
},
|
||||||
|
granularity: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["abstract", "concrete", "mixed"],
|
||||||
|
},
|
||||||
|
role: { type: "string" },
|
||||||
|
description: { type: "string" },
|
||||||
|
metadata: { type: "object", additionalProperties: false },
|
||||||
|
},
|
||||||
|
required: [
|
||||||
|
"name",
|
||||||
|
"category",
|
||||||
|
"granularity",
|
||||||
|
"role",
|
||||||
|
"description",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
granularity: {
|
|
||||||
type: "string",
|
|
||||||
enum: ["abstract", "concrete", "mixed"],
|
|
||||||
},
|
|
||||||
role: { type: "string" },
|
|
||||||
description: { type: "string" },
|
|
||||||
metadata: { type: "object", additionalProperties: false },
|
|
||||||
},
|
},
|
||||||
required: ["name", "category", "granularity", "role", "description"],
|
|
||||||
},
|
},
|
||||||
|
required: ["statement", "summary", "source", "confidence", "topics"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: ["statement", "summary", "source", "confidence", "topics"],
|
|
||||||
},
|
},
|
||||||
|
required: ["items"],
|
||||||
};
|
};
|
||||||
|
|
||||||
const timeString = {
|
const timeString = {
|
||||||
@@ -70,33 +83,50 @@ export const dailyScheduleSchema = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const monthlyScheduleSchema = {
|
export const monthlyScheduleSchema = {
|
||||||
type: "array",
|
type: "object",
|
||||||
minItems: 28,
|
additionalProperties: false,
|
||||||
maxItems: 31,
|
properties: {
|
||||||
items: {
|
items: {
|
||||||
type: "object",
|
type: "array",
|
||||||
additionalProperties: false,
|
minItems: 28,
|
||||||
properties: {
|
maxItems: 31,
|
||||||
day: { type: "integer", minimum: 1, maximum: 31 },
|
items: {
|
||||||
summary: { type: "string" },
|
type: "object",
|
||||||
|
additionalProperties: false,
|
||||||
|
properties: {
|
||||||
|
day: { type: "integer", minimum: 1, maximum: 31 },
|
||||||
|
summary: { type: "string" },
|
||||||
|
},
|
||||||
|
required: ["day", "summary"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: ["day", "summary"],
|
|
||||||
},
|
},
|
||||||
|
required: ["items"],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const availabilitySchema = {
|
export const availabilitySchema = {
|
||||||
type: "array",
|
type: "object",
|
||||||
minItems: 1,
|
additionalProperties: false,
|
||||||
items: {
|
properties: {
|
||||||
type: "object",
|
items: {
|
||||||
additionalProperties: false,
|
type: "array",
|
||||||
properties: {
|
minItems: 1,
|
||||||
start: timeString,
|
items: {
|
||||||
end: endTimeString,
|
type: "object",
|
||||||
status: { type: "string", enum: ["online", "do-not-disturb", "offline"] },
|
additionalProperties: false,
|
||||||
|
properties: {
|
||||||
|
start: timeString,
|
||||||
|
end: endTimeString,
|
||||||
|
status: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["online", "do-not-disturb", "offline"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["start", "end", "status"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: ["start", "end", "status"],
|
|
||||||
},
|
},
|
||||||
|
required: ["items"],
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user