Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1: schemas for DD and WebAPI configs #2

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 91 additions & 2 deletions certification/configs/dd/1.7/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,93 @@
{
"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"
},
"configs": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"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"],
"additionalProperties": false,
"if": {
"not": {
"required": ["token"]
}
},
"then": {
"required": ["clientCredentials"]
},
"dependencies": {
"token": {
"not": {
"required": ["clientCredentials"]
}
}
}
}
}
},
"required": ["version", "providerUoi", "endorsement", "configs"],
"additionalProperties": false,
"definitions": {
"non-empty-string": {
"type": "string",
"minLength": 1
}
}
}
256 changes: 256 additions & 0 deletions certification/configs/web-api/2.0.0/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
{
"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": {
"oneOf": [
{
"type": "object",
"required": ["name", "value"],
"properties": {
"name": {
"type": "string",
"const": "Resource"
},
"value": {
"type": "string",
"minLength": 1
},
"defaultValue": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"const": "Key Field"
},
"value": {
"type": "string",
"minLength": 1
},
"defaultValue": {
"type": "string"
}
},
"required": ["name", "value"],
"additionalProperties": false
},
{
"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"
}
}
},
{
"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"
}
}
},
{
"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"
}
}
},
{
"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
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"const": "Date Field"
},
"value": {
"type": "string",
"minLength": 1
},
"defaultValue": {
"type": "string"
}
},
"required": ["name", "value"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"const": "Timestamp Field"
},
"value": {
"type": "string",
"minLength": 1
},
"defaultValue": {
"type": "string"
}
},
"required": ["name", "value"],
"additionalProperties": false
}
]
}
}
},
"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
}
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -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,
};
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}