From ffef5a2270b80f47c1f1b998969ea942a3a73ec3 Mon Sep 17 00:00:00 2001 From: Riko Eksteen Date: Sun, 9 Feb 2020 20:10:48 +0000 Subject: [PATCH] #128 - copy schemas as static website files as part of build - Copy to schemas/next folder with npm command - Make part of website pre-publish script during build - Update links in context schema spec to point to published schemas --- .travis.yml | 2 +- docs/context/spec.md | 16 ++++---- website/package.json | 6 ++- .../static/schemas/next/contact.schema.json | 17 ++++++++ .../schemas/next/contactList.schema.json | 14 +++++++ .../static/schemas/next/context.schema.json | 14 +++++++ .../static/schemas/next/country.schema.json | 17 ++++++++ .../schemas/next/instrument.schema.json | 24 +++++++++++ .../schemas/next/instrumentList.schema.json | 14 +++++++ .../schemas/next/organization.schema.json | 18 ++++++++ .../static/schemas/next/portfolio.schema.json | 14 +++++++ .../static/schemas/next/position.schema.json | 12 ++++++ website/yarn.lock | 41 +++++++++++++++++-- 13 files changed, 196 insertions(+), 13 deletions(-) create mode 100644 website/static/schemas/next/contact.schema.json create mode 100644 website/static/schemas/next/contactList.schema.json create mode 100644 website/static/schemas/next/context.schema.json create mode 100644 website/static/schemas/next/country.schema.json create mode 100644 website/static/schemas/next/instrument.schema.json create mode 100644 website/static/schemas/next/instrumentList.schema.json create mode 100644 website/static/schemas/next/organization.schema.json create mode 100644 website/static/schemas/next/portfolio.schema.json create mode 100644 website/static/schemas/next/position.schema.json diff --git a/.travis.yml b/.travis.yml index 56efade21..c6a649a2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ script: - git config --global user.name "${GH_NAME}" - git config --global user.email "${GH_EMAIL}" - echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc - - cd website && yarn install && yarn run redoc-appd && GIT_USER="${GH_NAME}" yarn run publish-gh-pages \ No newline at end of file + - cd website && yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages \ No newline at end of file diff --git a/docs/context/spec.md b/docs/context/spec.md index 31f146777..b679bf99f 100644 --- a/docs/context/spec.md +++ b/docs/context/spec.md @@ -86,34 +86,34 @@ The following are standard FDC3 context types. - __fdc3.contact__ - A person contact that can be engaged with through email, calling, messaging, CMS, etc. - [Financial Objects Specification](https://fo.finos.org/docs/objects/contact) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/contact.schema) + - [schema](/schemas/next/contact.schema.json) - __fd3.contactList__ - A collection of contacts. - [Financial Objects Specification](https://fo.finos.org/docs/objects/contactlist) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/contactList.schema) + - [schema](/schemas/next/contactList.schema.json) - __fdc3.country__ - A standard country entity. - [Financial Objects Specification](https://fo.finos.org/docs/objects/country) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/country.schema) + - [schema](/schemas/next/country.schema.json) - __fdc3.instrument__ - A financial instrument from any asset class. - [Financial Objects Specification](https://fo.finos.org/docs/objects/instrument) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/instrument.schema) + - [schema](/schemas/next/instrument.schema.json) - __fdc3.instrumentList__ - A collection of instruments. - [Financial Objects Specification](https://fo.finos.org/docs/objects/instrumentList) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/instrumentList.schema) + - [schema](/schemas/next/instrumentList.schema.json) - __fdd3.organization__ - A standard organization entity. - [Financial Objects Specification](https://fo.finos.org/docs/objects/organization) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/organization.schema) + - [schema](/schemas/next/organization.schema.json) - __fdc3.portfolio__ - A collection of positions. - [Financial Objects Specification](https://fo.finos.org/docs/objects/portfolio) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/portfolio.schema) + - [schema](/schemas/next/portfolio.schema.json) - __fdc3.position__ - [Financial Objects Specification](https://fo.finos.org/docs/objects/position) - - [schema](https://github.com/finos/FDC3/blob/master/src/context/schemas/position.schema) + - [schema](/schemas/next/position.schema.json) __Note:__ The below examples show how the base context data interface can be used to define specific context data objects. It is not the purpose of the specification at this stage to define standard representations for objects. It establishes the framework in which such definitions could be created. diff --git a/website/package.json b/website/package.json index a4f475e4f..2aedab288 100644 --- a/website/package.json +++ b/website/package.json @@ -2,14 +2,18 @@ "scripts": { "examples": "docusaurus-examples", "start": "docusaurus-start", + "prebuild": "yarn run redoc-appd && yarn run copy-schemas", "build": "docusaurus-build", + "prepublish-gh-pages": "yarn run redoc-appd && yarn run copy-schemas", "publish-gh-pages": "docusaurus-publish", "write-translations": "docusaurus-write-translations", "version": "docusaurus-version", "rename-version": "docusaurus-rename-version", - "redoc-appd": "redoc-cli bundle --output pages/appd-spec.html ../src/app-directory/specification/appd.yaml" + "redoc-appd": "redoc-cli bundle --output pages/appd-spec.html ../src/app-directory/specification/appd.yaml", + "copy-schemas": "copyfiles -f ../src/context/schemas/*.schema.json static/schemas/next" }, "devDependencies": { + "copyfiles": "2.2.0", "docusaurus": "1.12.0", "redoc-cli": "0.8.5" }, diff --git a/website/static/schemas/next/contact.schema.json b/website/static/schemas/next/contact.schema.json new file mode 100644 index 000000000..7749d37da --- /dev/null +++ b/website/static/schemas/next/contact.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/contact.schema.json", + "type": "object", + "allOf": [{ "$ref": "context.schema.json#/" }], + "properties": { + "type": { "const": "fdc3.contact" }, + "id": { + "type": "object", + "properties": { + "email": { "type": "string" }, + "FDS_ID": { "type": "string" } + } + } + }, + "required": ["id"] +} diff --git a/website/static/schemas/next/contactList.schema.json b/website/static/schemas/next/contactList.schema.json new file mode 100644 index 000000000..48d78ab75 --- /dev/null +++ b/website/static/schemas/next/contactList.schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/contactList.schema.json", + "type": "object", + "allOf": [{ "$ref": "context.schema.json#/" }], + "properties": { + "type": { "const": "fdc3.contactList" }, + "contacts": { + "type": "array", + "items": { "$ref": "contact.schema#/" } + } + }, + "required": ["contacts"] +} diff --git a/website/static/schemas/next/context.schema.json b/website/static/schemas/next/context.schema.json new file mode 100644 index 000000000..2c2edfeb8 --- /dev/null +++ b/website/static/schemas/next/context.schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/context.schema.json", + "type": "object", + "properties": { + "type": { "type": "string" }, + "name": { "type": "string" }, + "id": { + "type": "object", + "additionalProperties": { "type": "string" } + } + }, + "required": ["type"] +} diff --git a/website/static/schemas/next/country.schema.json b/website/static/schemas/next/country.schema.json new file mode 100644 index 000000000..9920b1ccb --- /dev/null +++ b/website/static/schemas/next/country.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/country.schema.json", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.country" }, + "id": { + "type": "object", + "properties": { + "ISOALPHA2": { "type": "string" }, + "ISOALPHA3": { "type": "string" } + } + } + }, + "required": ["id"] +} diff --git a/website/static/schemas/next/instrument.schema.json b/website/static/schemas/next/instrument.schema.json new file mode 100644 index 000000000..abc5bf737 --- /dev/null +++ b/website/static/schemas/next/instrument.schema.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/instrument.schema", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.instrument" }, + "id": { + "type": "object", + "properties": { + "BBG": { "type": "string" }, + "CUSIP": { "type": "string" }, + "FDS_ID": { "type": "string" }, + "FIGI": { "type": "string" }, + "ISIN": { "type": "string" }, + "PERMID": { "type": "string" }, + "RIC": { "type": "string" }, + "SEDOL": { "type": "string" }, + "ticker": { "type": "string" } + } + } + }, + "required": ["id"] +} diff --git a/website/static/schemas/next/instrumentList.schema.json b/website/static/schemas/next/instrumentList.schema.json new file mode 100644 index 000000000..91215fecb --- /dev/null +++ b/website/static/schemas/next/instrumentList.schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/instrumentList.schema", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.instrumentList" }, + "instruments": { + "type": "array", + "items": { "$ref": "instrument.schema#/" } + } + }, + "required": ["instruments"] +} diff --git a/website/static/schemas/next/organization.schema.json b/website/static/schemas/next/organization.schema.json new file mode 100644 index 000000000..a5de6d17a --- /dev/null +++ b/website/static/schemas/next/organization.schema.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/organization.schema", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.organization" }, + "id": { + "type": "object", + "properties": { + "LEI": { "type": "string" }, + "PERMID": { "type": "string" }, + "FDS_ID": { "type": "string" } + } + } + }, + "required": ["id"] +} diff --git a/website/static/schemas/next/portfolio.schema.json b/website/static/schemas/next/portfolio.schema.json new file mode 100644 index 000000000..3b66dfcb1 --- /dev/null +++ b/website/static/schemas/next/portfolio.schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/portfolio.schema", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.portfolio" }, + "positions": { + "type": "array", + "items": { "$ref": "position.schema#/" } + } + }, + "required": ["positions"] +} diff --git a/website/static/schemas/next/position.schema.json b/website/static/schemas/next/position.schema.json new file mode 100644 index 000000000..7068189bd --- /dev/null +++ b/website/static/schemas/next/position.schema.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/position.schema", + "type": "object", + "allOf": [{ "$ref": "context.schema#/" }], + "properties": { + "type": { "const": "fdc3.position" }, + "instrument": { "$ref": "instrument.schema#/" }, + "holding": { "type": "number", "minimum": 0 } + }, + "required": ["instrument"] +} \ No newline at end of file diff --git a/website/yarn.lock b/website/yarn.lock index 2d314db0f..fd7698b24 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -1907,6 +1907,18 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +copyfiles@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.2.0.tgz#d9fc6c06f299337fb7eeb7ea5887e9d7188d9d47" + integrity sha512-iJbHJI+8OKqsq+4JF0rqgRkZzo++jqO6Wf4FUU1JM41cJF6JcY5968XyF4tm3Kkm7ZOMrqlljdm8N9oyY5raGw== + dependencies: + glob "^7.0.5" + minimatch "^3.0.3" + mkdirp "^0.5.1" + noms "0.0.0" + through2 "^2.0.1" + yargs "^13.2.4" + core-js-compat@^3.1.1: version "3.4.7" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.7.tgz#39f8080b1d92a524d6d90505c42b9c5c1eb90611" @@ -4186,6 +4198,11 @@ is2@2.0.1: ip-regex "^2.1.0" is-url "^1.2.2" +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -4879,7 +4896,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@3.0.4, minimatch@^3.0.4, minimatch@~3.0.2: +minimatch@3.0.4, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5085,6 +5102,14 @@ node-releases@^1.1.29, node-releases@^1.1.41: dependencies: semver "^6.3.0" +noms@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859" + integrity sha1-2o69nzr51nYJGbJ9nNyAkqczKFk= + dependencies: + inherits "^2.0.1" + readable-stream "~1.0.31" + nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" @@ -6343,6 +6368,16 @@ readable-stream@^3.1.1: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@~1.0.31: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + readdirp@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" @@ -7165,7 +7200,7 @@ string.prototype.trimright@^2.1.0: define-properties "^1.1.3" function-bind "^1.1.1" -string_decoder@0.10: +string_decoder@0.10, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= @@ -7398,7 +7433,7 @@ text-table@0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -through2@^2.0.0: +through2@^2.0.0, through2@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==