From 1a6d70126e49818a35dceb2fcf0152721ce9cc54 Mon Sep 17 00:00:00 2001 From: mohit-s96 Date: Thu, 16 Feb 2023 22:40:22 +0530 Subject: [PATCH 1/5] #1: added initial schemas for DD and WebAPI configs --- certification/configs/dd/1.7/config.json | 101 ++++++++++++++- .../configs/web-api/2.0.0/config.json | 122 ++++++++++++++++++ 2 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 certification/configs/web-api/2.0.0/config.json diff --git a/certification/configs/dd/1.7/config.json b/certification/configs/dd/1.7/config.json index b9a7e56..0d524f7 100644 --- a/certification/configs/dd/1.7/config.json +++ b/certification/configs/dd/1.7/config.json @@ -1,4 +1,101 @@ { - "description": "RESO Data Dictionary Configuration Schema", - "version": "1.7" + "type": "object", + "properties": { + "version": { + "const": "1.7" + }, + "providerUoi": { + "$ref": "#/definitions/non-empty-string" + }, + "endorsement": { + "$ref": "#/definitions/non-empty-string" + }, + "config": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "description": { + "$ref": "#/definitions/non-empty-string" + }, + "serviceRootUri": { + "$ref": "#/definitions/non-empty-string" + }, + "recipientUoi": { + "$ref": "#/definitions/non-empty-string" + }, + "providerUsi": { + "$ref": "#/definitions/non-empty-string" + }, + "token": { + "$ref": "#/definitions/non-empty-string" + }, + "originatingSystemName": { + "$ref": "#/definitions/non-empty-string" + }, + "originatingSystemId": { + "$ref": "#/definitions/non-empty-string" + }, + "clientCredentials": { + "type": "object", + "properties": { + "tokenUri": { + "$ref": "#/definitions/non-empty-string" + }, + "clientId": { + "$ref": "#/definitions/non-empty-string" + }, + "clientSecret": { + "$ref": "#/definitions/non-empty-string" + }, + "scope": { + "$ref": "#/definitions/non-empty-string" + } + }, + "dependencies": { + "tokenUri": ["clientId", "clientSecret"], + "clientId": ["tokenUri", "clientSecret"], + "clientSecret": ["tokenUri", "clientId"], + "scope": { + "required": ["clientId", "clientSecret", "tokenUri"] + } + }, + "required": ["tokenUri", "clientId", "clientSecret"], + "additionalProperties": false + } + }, + "required": [ + "serviceRootUri", + "recipientUoi", + "providerUsi", + "description" + ], + "additionalProperties": false, + "if": { + "not": { + "required": ["token"] + } + }, + "then": { + "required": ["clientCredentials"] + }, + "dependencies": { + "token": { + "not": { + "required": ["clientCredentials"] + } + } + } + } + } + }, + "required": ["version", "providerUoi", "endorsement", "config"], + "additionalProperties": false, + "definitions": { + "non-empty-string": { + "type": "string", + "minLength": 1 + } + } } diff --git a/certification/configs/web-api/2.0.0/config.json b/certification/configs/web-api/2.0.0/config.json new file mode 100644 index 0000000..5797d5b --- /dev/null +++ b/certification/configs/web-api/2.0.0/config.json @@ -0,0 +1,122 @@ +{ + "type": "object", + "properties": { + "endorsement": { + "$ref": "#/definitions/non-empty-string" + }, + "version": { + "const": "2.0.0" + }, + "providerUoi": { + "$ref": "#/definitions/non-empty-string" + }, + "providerUsi": { + "$ref": "#/definitions/non-empty-string" + }, + "recipientUoi": { + "$ref": "#/definitions/non-empty-string" + }, + "recipientEmail": { + "$ref": "#/definitions/non-empty-string" + }, + "serviceRootUri": { + "$ref": "#/definitions/non-empty-string" + }, + "token": { + "$ref": "#/definitions/non-empty-string" + }, + "clientCredentials": { + "type": "object", + "properties": { + "tokenUri": { + "$ref": "#/definitions/non-empty-string" + }, + "clientId": { + "$ref": "#/definitions/non-empty-string" + }, + "clientSecret": { + "$ref": "#/definitions/non-empty-string" + }, + "scope": { + "$ref": "#/definitions/non-empty-string" + } + }, + "dependencies": { + "tokenUri": ["clientId", "clientSecret"], + "clientId": ["tokenUri", "clientSecret"], + "clientSecret": ["tokenUri", "clientId"], + "scope": { + "required": ["clientId", "clientSecret", "tokenUri"] + } + }, + "required": ["tokenUri", "clientId", "clientSecret"], + "additionalProperties": false + }, + "parameters": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "name": { + "$ref": "#/definitions/non-empty-string" + }, + "value": { + "$ref": "#/definitions/non-empty-string" + }, + "defaultValue": { + "$ref": "#/definitions/non-empty-string" + }, + "sampleValueLow": { + "type": "number" + }, + "sampleValueHigh": { + "type": "number" + }, + "sampleValueNotFound": { + "type": "number" + }, + "optionalLookupNamespace": { + "$ref": "#/definitions/non-empty-string" + }, + "sampleValue": { + "$ref": "#/definitions/non-empty-string" + } + }, + "required": ["name", "value", "defaultValue"] + } + } + }, + "dependencies": { + "token": { + "not": { + "required": ["clientCredentials"] + } + } + }, + "if": { + "not": { + "required": ["token"] + } + }, + "then": { + "required": ["clientCredentials"] + }, + "definitions": { + "non-empty-string": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "endorsement", + "version", + "providerUoi", + "providerUsi", + "recipientUoi", + "recipientEmail", + "serviceRootUri", + "parameters" + ], + "additionalProperties": false +} From 80968ef1908ff8768e33cdd38f5800cff8f7544b Mon Sep 17 00:00:00 2001 From: mohit-s96 Date: Tue, 7 Mar 2023 15:31:42 +0530 Subject: [PATCH 2/5] #1: added package.json and a barrel file for re-exporting the schemas --- index.js | 7 +++++++ package.json | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 index.js create mode 100644 package.json diff --git a/index.js b/index.js new file mode 100644 index 0000000..726f504 --- /dev/null +++ b/index.js @@ -0,0 +1,7 @@ +const webAPISchema = require("./certification/configs/web-api/2.0.0/config.json"); +const ddSchema = require("./certification/configs/dd/1.7/config.json"); + +module.exports = { + ddSchema, + webAPISchema, +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..ae099dc --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "@reso/schema-registry", + "version": "1.0.0", + "description": "Package containing schemas related to RESO Standards and Certification.", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/RESOStandards/schema-registry.git" + }, + "keywords": [ + "certification", + "schema" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/RESOStandards/schema-registry/issues" + }, + "homepage": "https://github.com/RESOStandards/schema-registry#readme" +} From 6f7de7855cdd0369975acb35bd85b7da88e00100 Mon Sep 17 00:00:00 2001 From: mohit-s96 Date: Mon, 13 Mar 2023 21:36:20 +0530 Subject: [PATCH 3/5] #1: updated web API config --- .../configs/web-api/2.0.0/config.json | 174 ++++++++++++++++-- 1 file changed, 154 insertions(+), 20 deletions(-) diff --git a/certification/configs/web-api/2.0.0/config.json b/certification/configs/web-api/2.0.0/config.json index 5797d5b..4d66208 100644 --- a/certification/configs/web-api/2.0.0/config.json +++ b/certification/configs/web-api/2.0.0/config.json @@ -56,34 +56,168 @@ "type": "array", "minItems": 1, "items": { - "type": "object", - "properties": { - "name": { - "$ref": "#/definitions/non-empty-string" + "oneOf": [ + { + "type": "object", + "required": ["name", "value"], + "properties": { + "name": { + "type": "string", + "const": "Resource" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue": { + "type": "string" + } + }, + "additionalProperties": false }, - "value": { - "$ref": "#/definitions/non-empty-string" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "const": "Key Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue": { + "type": "string" + } + }, + "required": ["name", "value"], + "additionalProperties": false }, - "defaultValue": { - "$ref": "#/definitions/non-empty-string" + { + "type": "object", + "required": ["name", "value"], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "const": "Integer Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValueLow": { + "type": "string", + "const": "1" + }, + "defaultValueHigh": { + "type": "string" + } + } }, - "sampleValueLow": { - "type": "number" + { + "type": "object", + "required": ["name", "value"], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "const": "Decimal Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValueLow": { + "type": "string" + }, + "defaultValueHigh": { + "type": "string" + } + } }, - "sampleValueHigh": { - "type": "number" + { + "type": "object", + "required": ["name", "value"], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "const": "Single Lookup Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue": { + "type": "string" + }, + "defaultNamespace": { + "type": "string" + } + } }, - "sampleValueNotFound": { - "type": "number" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "const": "Multiple Lookup Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue1": { + "type": "string" + }, + "defaultValue2": { + "type": "string" + }, + "defaultNamespace": { + "type": "string" + } + }, + "required": ["name", "value"], + "additionalProperties": false }, - "optionalLookupNamespace": { - "$ref": "#/definitions/non-empty-string" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "const": "Date Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue": { + "type": "string" + } + }, + "required": ["name", "value"], + "additionalProperties": false }, - "sampleValue": { - "$ref": "#/definitions/non-empty-string" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "const": "Timestamp Field" + }, + "value": { + "type": "string", + "minLength": 1 + }, + "defaultValue": { + "type": "string" + } + }, + "required": ["name", "value"], + "additionalProperties": false } - }, - "required": ["name", "value", "defaultValue"] + ] } } }, From 17046f9987122a69a725759b68106135221e2e7e Mon Sep 17 00:00:00 2001 From: mohit-s96 Date: Mon, 10 Apr 2023 16:48:41 +0530 Subject: [PATCH 4/5] #1: removed description from DD schema --- certification/configs/dd/1.7/config.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/certification/configs/dd/1.7/config.json b/certification/configs/dd/1.7/config.json index 0d524f7..36206eb 100644 --- a/certification/configs/dd/1.7/config.json +++ b/certification/configs/dd/1.7/config.json @@ -16,9 +16,6 @@ "items": { "type": "object", "properties": { - "description": { - "$ref": "#/definitions/non-empty-string" - }, "serviceRootUri": { "$ref": "#/definitions/non-empty-string" }, @@ -65,12 +62,7 @@ "additionalProperties": false } }, - "required": [ - "serviceRootUri", - "recipientUoi", - "providerUsi", - "description" - ], + "required": ["serviceRootUri", "recipientUoi", "providerUsi"], "additionalProperties": false, "if": { "not": { From 105cc002d18686ed49f7b510f6a7b22b32e3c33d Mon Sep 17 00:00:00 2001 From: mohit-s96 Date: Tue, 21 Nov 2023 15:45:03 +0530 Subject: [PATCH 5/5] #1: change config to configs --- certification/configs/dd/1.7/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/certification/configs/dd/1.7/config.json b/certification/configs/dd/1.7/config.json index 36206eb..5d2881a 100644 --- a/certification/configs/dd/1.7/config.json +++ b/certification/configs/dd/1.7/config.json @@ -10,7 +10,7 @@ "endorsement": { "$ref": "#/definitions/non-empty-string" }, - "config": { + "configs": { "type": "array", "minItems": 1, "items": { @@ -82,7 +82,7 @@ } } }, - "required": ["version", "providerUoi", "endorsement", "config"], + "required": ["version", "providerUoi", "endorsement", "configs"], "additionalProperties": false, "definitions": { "non-empty-string": {