diff --git a/lib/src/jgfSchemaV2.json b/lib/src/jgfSchemaV2.json new file mode 100644 index 0000000..e167e5b --- /dev/null +++ b/lib/src/jgfSchemaV2.json @@ -0,0 +1,100 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://jsongraphformat.info/v2.0/json-graph-schema.json", + "title": "JSON Graph Schema", + "oneOf": [ + { + "type": "object", + "properties": { + "graph": { + "$ref": "#/definitions/graph" + } + }, + "additionalProperties": false, + "required": ["graph"] + }, + { + "type": "object", + "properties": { + "graphs": { + "type": "array", + "items": { + "$ref": "#/definitions/graph" + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "graph": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "directed": { + "type": ["boolean"], + "default": true + }, + "type": { + "type": "string" + }, + "metadata": { + "type": ["object"] + }, + "nodes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "metadata": { + "type": "object" + } + }, + "additionalProperties": false + } + }, + "edges": { + "type": ["array"], + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "source": { + "type": "string" + }, + "target": { + "type": "string" + }, + "relation": { + "type": "string" + }, + "directed": { + "type": ["boolean"], + "default": true + }, + "label": { + "type": "string" + }, + "metadata": { + "type": ["object"] + } + }, + "required": ["source", "target"] + } + } + } + } + } +} diff --git a/tsconfig.json b/tsconfig.json index fcf9a99..b9c6fc6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ + "resolveJsonModule": true /* Enable importing .json files. */, // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ @@ -100,5 +100,5 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, - "include": ["src", "index.ts"] + "include": ["src", "index.ts", "src/jgfSchemaV2.json"] }