diff --git a/docs/api-bridging/spec.md b/docs/api-bridging/spec.md index 87cd830d8..b8744b915 100644 --- a/docs/api-bridging/spec.md +++ b/docs/api-bridging/spec.md @@ -476,6 +476,7 @@ Response messages will be differentiated from requests by the presence of a `met * to the bridge before the timeout or because an error occurred. * Should be the same length as the `errorSources` array and ordered the * same. May be omitted if all sources responded. */ + errorDetails?: string[] } } diff --git a/docs/api/ref/Metadata.md b/docs/api/ref/Metadata.md index 48d778d97..637454b40 100644 --- a/docs/api/ref/Metadata.md +++ b/docs/api/ref/Metadata.md @@ -279,6 +279,9 @@ interface ImplementationMetadata { * `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by * the Desktop Agent.*/ "UserChannelMembershipAPIs": boolean; + /** Used to indicate whether the experimental Desktop Agent Bridging + * feature is implemented by the Desktop Agent.*/ + DesktopAgentBridging: boolean; }; /** The calling application instance's own metadata, according to the diff --git a/package-lock.json b/package-lock.json index 25760cb56..d4f6cd8d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@finos/fdc3", - "version": "2.0.0-beta.5", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@finos/fdc3", - "version": "2.0.0-beta.5", + "version": "2.0.0", "license": "Apache-2.0", "devDependencies": { "husky": "^4.3.0", diff --git a/package.json b/package.json index af65b08da..c6bc4b5c7 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,14 @@ }, "scripts": { "start": "tsdx watch", + "prebuild": "npm run typegen && npm run typegen-bridging", "build": "tsdx build", "test": "tsdx test --verbose", "lint": "tsdx lint src/api test", + "preprepare": "npm run typegen && npm run typegen-bridging", "prepare": "tsdx build", - "typegen": "node quicktypeUtil.js src/context/schemas src/context/ContextTypes.ts && tsdx lint src/context --fix" + "typegen": "node quicktypeUtil.js schemas/context src/context/ContextTypes.ts && tsdx lint src/context/ --fix", + "typegen-bridging": "node quicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix" }, "peerDependencies": {}, "husky": { diff --git a/quicktypeUtil.js b/quicktypeUtil.js index 735918780..e8c9e073a 100644 --- a/quicktypeUtil.js +++ b/quicktypeUtil.js @@ -1,37 +1,51 @@ -/** Utility for preparing arguments to quicktype, which workaround a specific - * quicktype bug in command line argument handling (where a directory is used +/** Utility for preparing arguments to quicktype, which workaround a specific + * quicktype bug in command line argument handling (where a directory is used * as input the source language argument is ignored which causes our schemas * to be interpreted as JSON input, rather than JSONSchema). - * Bug issue: + * Bug issue: * */ const path = require('path'); const fs = require('fs'); const exec = require('child_process').exec; -const args = process.argv; -const inputFolder = args[2] -const outputFile = args[3]; +const args = process.argv.slice(2); +const outputFile = args.pop(); +const inputs = args; -console.log("Input folder argument: " + inputFolder); -console.log("Output file argument: " + outputFile); +console.log('Inputs: ' + inputs.join(' | ')); +console.log('Output file argument: ' + outputFile); -let srcs = ""; -fs.readdirSync(inputFolder).forEach(file => { - srcs += `--src ${path.join(inputFolder, file)} `; -}); +let sources = ''; + +let dirIndex = 0; + +while (dirIndex < inputs.length) { + if (inputs[dirIndex].endsWith('.schema.json')) { + sources += `--src ${path.join(inputs[dirIndex])} `; + } else { + fs.readdirSync(inputs[dirIndex], { withFileTypes: true }).forEach(file => { + if (file.isDirectory()) { + inputs.push(path.join(inputs[dirIndex], file.name)); + } else { + sources += `--src ${path.join(inputs[dirIndex], file.name)} `; + } + }); + } + dirIndex++; +} // Normalise path to local quicktype executable. const quicktypeExec = ['.', 'node_modules', '.bin', 'quicktype'].join(path.sep); -const command = `${quicktypeExec} -s schema -o ${outputFile} ${srcs}`; -console.log("command to run: " + command); +const command = `${quicktypeExec} -s schema -o ${outputFile} ${sources}`; +console.log('command to run: ' + command); exec(command, function(error, stdout, stderr) { - if (stdout) { - console.log(stdout); - } - if (stderr) { - console.log(stderr); - } + if (stdout) { + console.log(stdout); + } + if (stderr) { + console.log(stderr); + } }); diff --git a/src/api/schemas/appIdentifier.schema.json b/schemas/api/appIdentifier.schema.json similarity index 71% rename from src/api/schemas/appIdentifier.schema.json rename to schemas/api/appIdentifier.schema.json index f23f2c941..29ef4c7d0 100644 --- a/src/api/schemas/appIdentifier.schema.json +++ b/schemas/api/appIdentifier.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/appIdentifier.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/appIdentifier.schema.json", "title": "AppIdentifier", "description": "Identifies an application, or instance of an application, and is used to target FDC3 API calls at specific applications.", "type": "object", @@ -10,10 +10,13 @@ }, "instanceId": { "type": "string" + }, + "desktopAgent": { + "type": "string" } }, "required": [ "appId" ], - "additionalProperties": false + "unevaluatedProperties": false } \ No newline at end of file diff --git a/src/api/schemas/appIntent.schema.json b/schemas/api/appIntent.schema.json similarity index 63% rename from src/api/schemas/appIntent.schema.json rename to schemas/api/appIntent.schema.json index 41a68cf89..1f2315d37 100644 --- a/src/api/schemas/appIntent.schema.json +++ b/schemas/api/appIntent.schema.json @@ -1,17 +1,17 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/appIntent.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/appIntent.schema.json", "title": "AppIntent", "description": "Represents the binding of an intent to apps", "type": "object", "properties": { "intent": { - "$ref": "https://fdc3.finos.org/schemas/next/intentMetadata.schema.json" + "$ref": "intentMetadata.schema.json" }, "apps": { "type": "array", "items": { - "$ref": "https://fdc3.finos.org/schemas/next/appMetadata.schema.json" + "$ref": "appMetadata.schema.json" } } }, diff --git a/src/api/schemas/appMetadata.schema.json b/schemas/api/appMetadata.schema.json similarity index 68% rename from src/api/schemas/appMetadata.schema.json rename to schemas/api/appMetadata.schema.json index 6b76a2376..14bfc1a8f 100644 --- a/src/api/schemas/appMetadata.schema.json +++ b/schemas/api/appMetadata.schema.json @@ -1,16 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/appMetadata.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/appMetadata.schema.json", "title": "AppMetadata", "description": "Extends an AppIdentifier, describing an application or instance of an application.", "type": "object", + "allOf": [ + { + "$ref": "appIdentifier.schema.json" + } + ], "properties": { - "appId": { - "type": "string" - }, - "instanceId": { - "type": "string" - }, + "appId": true, + "instanceId": true, + "desktopAgent": true, "name": { "type": "string" }, @@ -32,13 +34,13 @@ "icons": { "type": "array", "items": { - "$ref": "https://fdc3.finos.org/schemas/next/icon.schema.json" + "$ref": "icon.schema.json" } }, "screenshots": { "type": "array", "items": { - "$ref": "https://fdc3.finos.org/schemas/next/image.schema.json" + "$ref": "image.schema.json" } }, "resultType": { @@ -48,8 +50,5 @@ ] } }, - "additionalProperties": false, - "required": [ - "appId" - ] + "additionalProperties": false } \ No newline at end of file diff --git a/src/api/schemas/channel.schema.json b/schemas/api/channel.schema.json similarity index 78% rename from src/api/schemas/channel.schema.json rename to schemas/api/channel.schema.json index 9c18e46f8..76c80ce80 100644 --- a/src/api/schemas/channel.schema.json +++ b/schemas/api/channel.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/channel.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/channel.schema.json", "title": "Channel", "description": "Represents a context channel that applications can join to share context data.", "type": "object", @@ -17,7 +17,7 @@ ] }, "displayMetadata": { - "$ref": "https://fdc3.finos.org/schemas/next/displayMetadata.schema.json" + "$ref": "displayMetadata.schema.json" } }, "required": [ diff --git a/src/api/schemas/contextMetadata.schema.json b/schemas/api/contextMetadata.schema.json similarity index 70% rename from src/api/schemas/contextMetadata.schema.json rename to schemas/api/contextMetadata.schema.json index ce5b80102..29dd86436 100644 --- a/src/api/schemas/contextMetadata.schema.json +++ b/schemas/api/contextMetadata.schema.json @@ -1,12 +1,12 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/contextMetadata.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/contextMetadata.schema.json", "title": "ContextMetadata", "description": "Metadata relating to a context or intent & context received through the addContextListener and addIntentListener functions.", "type": "object", "properties": { "source": { - "$ref": "https://fdc3.finos.org/schemas/next/appIdentifier.schema.json" + "$ref": "appIdentifier.schema.json" } }, "required": [ diff --git a/schemas/api/desktopAgentIdentifier.schema.json b/schemas/api/desktopAgentIdentifier.schema.json new file mode 100644 index 000000000..c07c0d341 --- /dev/null +++ b/schemas/api/desktopAgentIdentifier.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/desktopAgentIdentifier.schema.json", + "title": "DesktopAgentIdentifier", + "description": "Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the source or destination of a message which was produced by or should be processed by the Desktop Agent itself rather than a specific application. Often added to messages by the Desktop Agent Bridge.", + "type": "object", + "properties": { + "desktopAgent": { + "type": "string" + } + }, + "required": [ + "desktopAgent" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/api/schemas/displayMetadata.schema.json b/schemas/api/displayMetadata.schema.json similarity index 87% rename from src/api/schemas/displayMetadata.schema.json rename to schemas/api/displayMetadata.schema.json index dd266653c..a83f5ef9a 100644 --- a/src/api/schemas/displayMetadata.schema.json +++ b/schemas/api/displayMetadata.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/displayMetadata.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/displayMetadata.schema.json", "title": "DisplayMetadata", "description": "A desktop agent (typically for user channels) may want to provide additional information about how a channel can be represented in a UI. A common use case is for color linking.", "type": "object", diff --git a/src/api/schemas/errors.schema.json b/schemas/api/errors.schema.json similarity index 74% rename from src/api/schemas/errors.schema.json rename to schemas/api/errors.schema.json index dc1215ea0..2c50b00b1 100644 --- a/src/api/schemas/errors.schema.json +++ b/schemas/api/errors.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/errors.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/errors.schema.json", "definitions": { "OpenError": { "type": "string", @@ -9,7 +9,8 @@ "AppNotFound", "ErrorOnLaunch", "AppTimeout", - "ResolverUnavailable" + "ResolverUnavailable", + "DesktopAgentNotFound" ] }, "ResolveError": { @@ -22,7 +23,8 @@ "ResolverTimeout", "TargetAppUnavailable", "TargetInstanceUnavailable", - "IntentDeliveryFailed" + "IntentDeliveryFailed", + "DesktopAgentNotFound" ] }, "ResultError": { @@ -41,6 +43,15 @@ "AccessDenied", "CreationFailed" ] + }, + "BridgingError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered by Desktop Agents when exchanging bridging messages.", + "enum": [ + "ResponseToBridgeTimedOut", + "AgentDisconnected", + "NotConnectedToBridge" + ] } } } \ No newline at end of file diff --git a/src/api/schemas/icon.schema.json b/schemas/api/icon.schema.json similarity index 87% rename from src/api/schemas/icon.schema.json rename to schemas/api/icon.schema.json index 064cc5bae..951356324 100644 --- a/src/api/schemas/icon.schema.json +++ b/schemas/api/icon.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/icon.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/icon.schema.json", "title": "Icon", "description": "Metadata relating to a single icon image at a remote URL, used to represent an application in a user interface.", "type": "object", diff --git a/src/api/schemas/image.schema.json b/schemas/api/image.schema.json similarity index 88% rename from src/api/schemas/image.schema.json rename to schemas/api/image.schema.json index 6640bdc8a..1f962a601 100644 --- a/src/api/schemas/image.schema.json +++ b/schemas/api/image.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/image.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/image.schema.json", "title": "Image", "description": "Metadata relating to a single image at a remote URL, used to represent screenshot images.", "type": "object", diff --git a/schemas/api/implementationMetadata.schema.json b/schemas/api/implementationMetadata.schema.json new file mode 100644 index 000000000..b09a040ed --- /dev/null +++ b/schemas/api/implementationMetadata.schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/implementationMetadata.schema.json", + "title": "ImplementationMetadata", + "description": "Metadata relating to the FDC3 DesktopAgent object and its provider", + "type": "object", + "properties": { + "fdc3Version": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "providerVersion": { + "type": "string" + }, + "optionalFeatures": { + "type": "object", + "properties": { + "OriginatingAppMetadata": { + "type": "boolean" + }, + "UserChannelMembershipAPIs": { + "type": "boolean" + }, + "DesktopAgentBridging": { + "type": "boolean" + } + }, + "required": [ + "OriginatingAppMetadata", + "UserChannelMembershipAPIs" + ], + "additionalProperties": false + }, + "appMetadata": { + "$ref": "appMetadata.schema.json" + } + }, + "required": [ + "fdc3Version", + "provider", + "optionalFeatures", + "appMetadata" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/api/schemas/intentMetadata.schema.json b/schemas/api/intentMetadata.schema.json similarity index 82% rename from src/api/schemas/intentMetadata.schema.json rename to schemas/api/intentMetadata.schema.json index 98b2ba64f..61cba896c 100644 --- a/src/api/schemas/intentMetadata.schema.json +++ b/schemas/api/intentMetadata.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/intentMetadata.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/intentMetadata.schema.json", "title": "IntentMetadata", "description": "The interface used to describe an intent within the platform.", "type": "object", @@ -13,7 +13,6 @@ } }, "required": [ - "name", "displayName" ], "additionalProperties": false diff --git a/src/api/schemas/intentResolution.schema.json b/schemas/api/intentResolution.schema.json similarity index 75% rename from src/api/schemas/intentResolution.schema.json rename to schemas/api/intentResolution.schema.json index 9f98e7c84..65a6138ed 100644 --- a/src/api/schemas/intentResolution.schema.json +++ b/schemas/api/intentResolution.schema.json @@ -1,12 +1,12 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/intentResolution.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/intentResolution.schema.json", "title": "IntentResolution", "description": "IntentResolution provides a standard format for data returned upon resolving an intent.", "type": "object", "properties": { "source": { - "$ref": "https://fdc3.finos.org/schemas/next/appIdentifier.schema.json" + "$ref": "appIdentifier.schema.json" }, "intent": { "type": "string" diff --git a/src/api/schemas/intentResult.schema.json b/schemas/api/intentResult.schema.json similarity index 57% rename from src/api/schemas/intentResult.schema.json rename to schemas/api/intentResult.schema.json index 12dd01f40..4d8d89ea9 100644 --- a/src/api/schemas/intentResult.schema.json +++ b/schemas/api/intentResult.schema.json @@ -1,15 +1,15 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/intentResult.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/intentResult.schema.json", "title": "IntentResult", "description": "Describes results that an Intent handler may optionally return that should be communicated back to the app that raised the intent, via the IntentResolution.", "type": "object", - "anyOf": [ + "oneOf": [ { - "$ref": "https://fdc3.finos.org/schemas/next/context.schema.json" + "$ref": "../context/context.schema.json" }, { - "$ref": "https://fdc3.finos.org/schemas/next/channel.schema.json" + "$ref": "channel.schema.json" } ] } \ No newline at end of file diff --git a/schemas/bridging/bridgeRequest.schema.json b/schemas/bridging/bridgeRequest.schema.json new file mode 100644 index 000000000..6115cbaa0 --- /dev/null +++ b/schemas/bridging/bridgeRequest.schema.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/bridgeRequest.schema.json", + "title": "BridgeRequest", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Identifies the type of the message and it is typically set to the FDC3 function name that the message relates to, e.g. 'findIntent', with 'Request' appended." + }, + "payload": { + "type": "object", + "description": "The message payload typically contains the arguments to FDC3 API functions." + }, + "meta": { + "$ref": "#/$defs/RequestMeta" + } + }, + "required": ["type", "payload", "meta"], + "additionalProperties": false, + "$defs": { + "RequestMeta": { + "type": "object", + "properties": { + "requestGuid": { + "type": "string", + "description": "Unique GUID for the request" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp at which request or response was generated" + }, + "source": { + "description": "Field that represents the source application that the request was received from.", + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "destination": { + "description": "Optional field that represents the destination that the request should be routed to. Must be set by the Desktop Agent for API calls that include a target app parameter and must include the name of the Desktop Agent hosting the target application.", + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ], + "additionalProperties": false + } + }, + "required": ["requestGuid", "timestamp", "source"] + } + } +} diff --git a/schemas/bridging/bridgeResponse.schema.json b/schemas/bridging/bridgeResponse.schema.json new file mode 100644 index 000000000..62b332855 --- /dev/null +++ b/schemas/bridging/bridgeResponse.schema.json @@ -0,0 +1,79 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/bridgeResponse.schema.json", + "title": "BridgeResponse", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Identifies the type of the message and it is typically set to the FDC3 function name that the message relates to, e.g. 'findIntent', with 'Response' appended." + }, + "payload": { + "type": "object", + "description": "The message payload typically contains return values for FDC3 API functions." + }, + "meta": { + "$ref": "#/$defs/ResponseMeta" + } + }, + "additionalProperties": false, + "required": ["type", "payload", "meta"], + "$defs": { + "ResponseMeta": { + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json#/$defs/RequestMeta" + }, + { + "type": "object", + "properties": { + "requestGuid": true, + "timestamp": true, + "responseGuid": { + "type": "string", + "description": "Unique GUID for the response" + }, + "sources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "description": "Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated responses to the request. Will contain a single value for individual responses and multiple values for responses that were collated by the bridge. May be omitted if all sources errored." + }, + "errorSources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "description": "Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned to the bridge before the timeout or because an error occurred. May be omitted if all sources responded without errors." + }, + "errorDetails": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of error message strings for responses that were not returned to the bridge before the timeout or because an error occurred. Should be the same length as the `errorSources` array and ordered the same. May be omitted if all sources responded without errors." + } + }, + "required": ["requestGuid", "responseGuid", "timestamp"], + "additionalProperties": false + } + ] + } + } +} diff --git a/schemas/bridging/broadcastRequest.schema.json b/schemas/bridging/broadcastRequest.schema.json new file mode 100644 index 000000000..058539666 --- /dev/null +++ b/schemas/bridging/broadcastRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/broadcastRequest.schema.json", + "title": "BroadcastRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type":"object", + "properties": { + "type": { + "const": "broadcastRequest" + }, + "payload": { + "type": "object", + "properties": { + "channel": { + "$ref": "../api/channel.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "additionalProperties": false, + "required": ["channel", "context"] + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties":false + } + ] +} diff --git a/schemas/bridging/findInstancesRequest.schema.json b/schemas/bridging/findInstancesRequest.schema.json new file mode 100644 index 000000000..1af8e5420 --- /dev/null +++ b/schemas/bridging/findInstancesRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findInstancesRequest.schema.json", + "title": "FindInstancesRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findInstancesRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/findInstancesResponse.schema.json b/schemas/bridging/findInstancesResponse.schema.json new file mode 100644 index 000000000..801c35645 --- /dev/null +++ b/schemas/bridging/findInstancesResponse.schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findInstancesResponse.schema.json", + "title": "findInstancesResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findInstancesResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIdentifiers": { + "type": "array", + "items": { + "$ref": "../api/appMetadata.schema.json" + } + } + }, + "required": ["appIdentifiers"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/findIntentRequest.schema.json b/schemas/bridging/findIntentRequest.schema.json new file mode 100644 index 000000000..53bc7a2c0 --- /dev/null +++ b/schemas/bridging/findIntentRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentRequest.schema.json", + "title": "FindIntentRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentRequest" + }, + "payload": { + "type": "object", + "properties": { + "intent": { + "type": "string" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["intent", "context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/findIntentResponse.schema.json b/schemas/bridging/findIntentResponse.schema.json new file mode 100644 index 000000000..9e6318bd0 --- /dev/null +++ b/schemas/bridging/findIntentResponse.schema.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentResponse.schema.json", + "title": "FindIntentResponse", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIntent": { + "$ref": "../api/appIntent.schema.json" + } + }, + "required": ["appIntent"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/findIntentsForContextRequest.schema.json b/schemas/bridging/findIntentsForContextRequest.schema.json new file mode 100644 index 000000000..e2444f4c7 --- /dev/null +++ b/schemas/bridging/findIntentsForContextRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentsForContextRequest.schema.json", + "title": "FindIntentsForContextRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentsForContextRequest" + }, + "payload": { + "type": "object", + "properties": { + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/findIntentsForContextResponse.schema.json b/schemas/bridging/findIntentsForContextResponse.schema.json new file mode 100644 index 000000000..2bcb1073d --- /dev/null +++ b/schemas/bridging/findIntentsForContextResponse.schema.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentsForContextResponse.schema.json", + "title": "FindIntentsForContextResponse", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "properties": { + "type": { + "const": "findIntentsForContextResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIntents": { + "type": "array", + "items": { + "$ref": "../api/appIntent.schema.json" + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": ["appIntents"] + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/getAppMetadataRequest.schema.json b/schemas/bridging/getAppMetadataRequest.schema.json new file mode 100644 index 000000000..8f4b551ce --- /dev/null +++ b/schemas/bridging/getAppMetadataRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/getAppMetadataRequest.schema.json", + "title": "GetAppMetadataRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "getAppMetadataRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/getAppMetadataResponse.schema.json b/schemas/bridging/getAppMetadataResponse.schema.json new file mode 100644 index 000000000..26d2dc468 --- /dev/null +++ b/schemas/bridging/getAppMetadataResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/getAppMetadataResponse.schema.json", + "title": "GetAppMetadataResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "getAppMetadataResponse" + }, + "payload": { + "type": "object", + "properties": { + "appMetadata": { + "$ref": "../api/appMetadata.schema.json" + } + }, + "required": ["appMetadata"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/openRequest.schema.json b/schemas/bridging/openRequest.schema.json new file mode 100644 index 000000000..578c49c6a --- /dev/null +++ b/schemas/bridging/openRequest.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/openRequest.schema.json", + "title": "openRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "openRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/openResponse.schema.json b/schemas/bridging/openResponse.schema.json new file mode 100644 index 000000000..9c6c80dd9 --- /dev/null +++ b/schemas/bridging/openResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/openResponse.schema.json", + "title": "OpenResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "openResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIdentifier": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["appIdentifier"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/raiseIntentRequest.schema.json b/schemas/bridging/raiseIntentRequest.schema.json new file mode 100644 index 000000000..b8d1b9449 --- /dev/null +++ b/schemas/bridging/raiseIntentRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentRequest.schema.json", + "title": "RaiseIntentRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["app", "context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/schemas/bridging/raiseIntentResponse.schema.json b/schemas/bridging/raiseIntentResponse.schema.json new file mode 100644 index 000000000..82398d3c3 --- /dev/null +++ b/schemas/bridging/raiseIntentResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentResponse.schema.json", + "title": "RaiseIntentResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentResponse" + }, + "payload": { + "type": "object", + "properties": { + "intentResolution": { + "$ref": "../api/intentResolution.schema.json" + } + }, + "required": ["intentResolution"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + } + ] +} diff --git a/schemas/bridging/raiseIntentResultResponse.schema.json b/schemas/bridging/raiseIntentResultResponse.schema.json new file mode 100644 index 000000000..bcd88e3d4 --- /dev/null +++ b/schemas/bridging/raiseIntentResultResponse.schema.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentResultResponse.schema.json", + "title": "RaiseIntentResultResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentResultResponse" + }, + "payload": { + "type": "object", + "properties": { + "intentResult": { + "oneOf": [ + { + "type": "object", + "properties": { + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["context"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "channel": { + "$ref": "../api/channel.schema.json" + } + }, + "required": ["channel"], + "additionalProperties": false + } + ] + } + }, + "required": ["intentResult"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/appIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/src/context/schemas/chart.schema.json b/schemas/context/chart.schema.json similarity index 89% rename from src/context/schemas/chart.schema.json rename to schemas/context/chart.schema.json index ab541e70c..d5b493a7d 100644 --- a/src/context/schemas/chart.schema.json +++ b/schemas/context/chart.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/chart.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/chart.schema.json", "type": "object", "title": "Chart", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/chatInitSettings.schema.json b/schemas/context/chatInitSettings.schema.json similarity index 88% rename from src/context/schemas/chatInitSettings.schema.json rename to schemas/context/chatInitSettings.schema.json index 044068dbd..249fb7e76 100644 --- a/src/context/schemas/chatInitSettings.schema.json +++ b/schemas/context/chatInitSettings.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/chatInitSettings.schema.json", "type": "object", "title": "ChatInitSettings", "properties": { diff --git a/website/static/schemas/next/contact.schema.json b/schemas/context/contact.schema.json similarity index 83% rename from website/static/schemas/next/contact.schema.json rename to schemas/context/contact.schema.json index 154ed146f..6aef5f52e 100644 --- a/website/static/schemas/next/contact.schema.json +++ b/schemas/context/contact.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/contact.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/contact.schema.json", "type": "object", "title": "Contact", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/contactList.schema.json b/schemas/context/contactList.schema.json similarity index 81% rename from website/static/schemas/next/contactList.schema.json rename to schemas/context/contactList.schema.json index f09080f5c..57bf2a532 100644 --- a/website/static/schemas/next/contactList.schema.json +++ b/schemas/context/contactList.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/contactList.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/contactList.schema.json", "type": "object", "title": "ContactList", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/context.schema.json b/schemas/context/context.schema.json similarity index 75% rename from src/context/schemas/context.schema.json rename to schemas/context/context.schema.json index 2f0d9e0e6..b14861b52 100644 --- a/src/context/schemas/context.schema.json +++ b/schemas/context/context.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/context.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/context.schema.json", "type": "object", "title": "Context", "properties": { @@ -11,5 +11,6 @@ "unevaluatedProperties": { "type": "string" } } }, + "additionalItems": true, "required": ["type"] } diff --git a/website/static/schemas/next/country.schema.json b/schemas/context/country.schema.json similarity index 86% rename from website/static/schemas/next/country.schema.json rename to schemas/context/country.schema.json index f29ae7611..2a0a6a763 100644 --- a/website/static/schemas/next/country.schema.json +++ b/schemas/context/country.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/country.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/country.schema.json", "type": "object", "title": "Country", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/currency.schema.json b/schemas/context/currency.schema.json similarity index 84% rename from src/context/schemas/currency.schema.json rename to schemas/context/currency.schema.json index 8d87f517a..aa0c08455 100644 --- a/src/context/schemas/currency.schema.json +++ b/schemas/context/currency.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/currency.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/currency.schema.json", "type": "object", "title": "Currency", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/email.schema.json b/schemas/context/email.schema.json similarity index 86% rename from website/static/schemas/next/email.schema.json rename to schemas/context/email.schema.json index a885680d9..4ec814dcf 100644 --- a/website/static/schemas/next/email.schema.json +++ b/schemas/context/email.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/email.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/email.schema.json", "type": "object", "title": "Email", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/instrument.schema.json b/schemas/context/instrument.schema.json similarity index 92% rename from src/context/schemas/instrument.schema.json rename to schemas/context/instrument.schema.json index ed25d4274..eee0f800f 100644 --- a/src/context/schemas/instrument.schema.json +++ b/schemas/context/instrument.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/instrument.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/instrument.schema.json", "type": "object", "title": "Instrument", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/instrumentList.schema.json b/schemas/context/instrumentList.schema.json similarity index 81% rename from website/static/schemas/next/instrumentList.schema.json rename to schemas/context/instrumentList.schema.json index 6aa927fd1..ceca78935 100644 --- a/website/static/schemas/next/instrumentList.schema.json +++ b/schemas/context/instrumentList.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/instrumentList.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/instrumentList.schema.json", "type": "object", "title": "InstrumentList", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/nothing.schema.json b/schemas/context/nothing.schema.json similarity index 73% rename from website/static/schemas/next/nothing.schema.json rename to schemas/context/nothing.schema.json index d13c3f05e..a7d67095e 100644 --- a/website/static/schemas/next/nothing.schema.json +++ b/schemas/context/nothing.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/nothing.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/nothing.schema.json", "type": "object", "title": "Nothing", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/organization.schema.json b/schemas/context/organization.schema.json similarity index 84% rename from website/static/schemas/next/organization.schema.json rename to schemas/context/organization.schema.json index 986eb9c96..7a791496e 100644 --- a/website/static/schemas/next/organization.schema.json +++ b/schemas/context/organization.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/organization.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/organization.schema.json", "type": "object", "title": "Organization", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/portfolio.schema.json b/schemas/context/portfolio.schema.json similarity index 81% rename from src/context/schemas/portfolio.schema.json rename to schemas/context/portfolio.schema.json index 69ee04e81..64202e02f 100644 --- a/src/context/schemas/portfolio.schema.json +++ b/schemas/context/portfolio.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/portfolio.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/portfolio.schema.json", "type": "object", "title": "Portfolio", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/position.schema.json b/schemas/context/position.schema.json similarity index 82% rename from website/static/schemas/next/position.schema.json rename to schemas/context/position.schema.json index 262cbbc95..e2a948aee 100644 --- a/website/static/schemas/next/position.schema.json +++ b/schemas/context/position.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/position.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/position.schema.json", "type": "object", "title": "Position", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/timerange.schema.json b/schemas/context/timerange.schema.json similarity index 86% rename from src/context/schemas/timerange.schema.json rename to schemas/context/timerange.schema.json index a17c5fbff..5b6b326f5 100644 --- a/src/context/schemas/timerange.schema.json +++ b/schemas/context/timerange.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/timerange.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/timerange.schema.json", "type": "object", "title": "TimeRange", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/valuation.schema.json b/schemas/context/valuation.schema.json similarity index 87% rename from src/context/schemas/valuation.schema.json rename to schemas/context/valuation.schema.json index e9a2f57ba..7ad55be71 100644 --- a/src/context/schemas/valuation.schema.json +++ b/schemas/context/valuation.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/valuation.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/valuation.schema.json", "type": "object", "title": "Valuation", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/api/ImplementationMetadata.ts b/src/api/ImplementationMetadata.ts index 3f428e787..72a5c3021 100644 --- a/src/api/ImplementationMetadata.ts +++ b/src/api/ImplementationMetadata.ts @@ -31,6 +31,9 @@ export interface ImplementationMetadata { * `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by * the Desktop Agent.*/ UserChannelMembershipAPIs: boolean; + /** Used to indicate whether the experimental Desktop Agent Bridging + * feature is implemented by the Desktop Agent.*/ + DesktopAgentBridging: boolean; }; /** The calling application instance's own metadata, according to the Desktop Agent (MUST include at least the `appId` and `instanceId`). */ diff --git a/src/bridging/BridgingTypes.ts b/src/bridging/BridgingTypes.ts new file mode 100644 index 000000000..7708d1852 --- /dev/null +++ b/src/bridging/BridgingTypes.ts @@ -0,0 +1,2126 @@ +// To parse this data: +// +// import { Convert, AppIdentifier, AppIntent, AppMetadata, Channel, ContextMetadata, DesktopAgentIdentifier, DisplayMetadata, Icon, Image, ImplementationMetadata, IntentMetadata, IntentResolution, IntentResult, BridgeRequest, BridgeResponse, BroadcastRequest, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsForContextRequest, FindIntentsForContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, OpenRequest, OpenResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse, Context } from "./file"; +// +// const appIdentifier = Convert.toAppIdentifier(json); +// const appIntent = Convert.toAppIntent(json); +// const appMetadata = Convert.toAppMetadata(json); +// const channel = Convert.toChannel(json); +// const contextMetadata = Convert.toContextMetadata(json); +// const desktopAgentIdentifier = Convert.toDesktopAgentIdentifier(json); +// const displayMetadata = Convert.toDisplayMetadata(json); +// const schemasAPIErrorsSchema = Convert.toSchemasAPIErrorsSchema(json); +// const icon = Convert.toIcon(json); +// const image = Convert.toImage(json); +// const implementationMetadata = Convert.toImplementationMetadata(json); +// const intentMetadata = Convert.toIntentMetadata(json); +// const intentResolution = Convert.toIntentResolution(json); +// const intentResult = Convert.toIntentResult(json); +// const bridgeRequest = Convert.toBridgeRequest(json); +// const bridgeResponse = Convert.toBridgeResponse(json); +// const broadcastRequest = Convert.toBroadcastRequest(json); +// const findInstancesRequest = Convert.toFindInstancesRequest(json); +// const findInstancesResponse = Convert.toFindInstancesResponse(json); +// const findIntentRequest = Convert.toFindIntentRequest(json); +// const findIntentResponse = Convert.toFindIntentResponse(json); +// const findIntentsForContextRequest = Convert.toFindIntentsForContextRequest(json); +// const findIntentsForContextResponse = Convert.toFindIntentsForContextResponse(json); +// const getAppMetadataRequest = Convert.toGetAppMetadataRequest(json); +// const getAppMetadataResponse = Convert.toGetAppMetadataResponse(json); +// const openRequest = Convert.toOpenRequest(json); +// const openResponse = Convert.toOpenResponse(json); +// const raiseIntentRequest = Convert.toRaiseIntentRequest(json); +// const raiseIntentResponse = Convert.toRaiseIntentResponse(json); +// const raiseIntentResultResponse = Convert.toRaiseIntentResultResponse(json); +// const context = Convert.toContext(json); +// +// These functions will throw an error if the JSON doesn't +// match the expected interface, even if the JSON is valid. + +/** + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + */ +export interface AppIdentifier { + appId: string; + desktopAgent?: string; + instanceId?: string; + [property: string]: any; +} + +/** + * Represents the binding of an intent to apps + */ +export interface AppIntent { + apps: AppMetadataElement[]; + intent: IntentClass; +} + +/** + * Extends an AppIdentifier, describing an application or instance of an application. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + */ +export interface AppMetadataElement { + appId: string; + description?: string; + desktopAgent?: string; + icons?: IconElement[]; + instanceId?: string; + instanceMetadata?: { [key: string]: any }; + name?: string; + resultType?: null | string; + screenshots?: ScreenshotElement[]; + title?: string; + tooltip?: string; + version?: string; +} + +/** + * Metadata relating to a single icon image at a remote URL, used to represent an + * application in a user interface. + */ +export interface IconElement { + size?: string; + src: string; + type?: string; +} + +/** + * Metadata relating to a single image at a remote URL, used to represent screenshot images. + */ +export interface ScreenshotElement { + label?: string; + size?: string; + src: string; + type?: string; +} + +/** + * The interface used to describe an intent within the platform. + */ +export interface IntentClass { + displayName: string; + name?: string; +} + +/** + * Extends an AppIdentifier, describing an application or instance of an application. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + */ +export interface AppMetadata { + appId: string; + description?: string; + desktopAgent?: string; + icons?: IconElement[]; + instanceId?: string; + instanceMetadata?: { [key: string]: any }; + name?: string; + resultType?: null | string; + screenshots?: ScreenshotElement[]; + title?: string; + tooltip?: string; + version?: string; +} + +/** + * Represents a context channel that applications can join to share context data. + */ +export interface Channel { + displayMetadata?: DisplayMetadataClass; + id: string; + type: Type; +} + +/** + * A desktop agent (typically for user channels) may want to provide additional information + * about how a channel can be represented in a UI. A common use case is for color linking. + */ +export interface DisplayMetadataClass { + color?: string; + glyph?: string; + name?: string; +} + +export enum Type { + App = 'app', + Private = 'private', + User = 'user', +} + +/** + * Metadata relating to a context or intent & context received through the + * addContextListener and addIntentListener functions. + */ +export interface ContextMetadata { + source: SourceElement; +} + +/** + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + */ +export interface SourceElement { + appId: string; + desktopAgent?: string; + instanceId?: string; + [property: string]: any; +} + +/** + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface DesktopAgentIdentifier { + desktopAgent: string; +} + +/** + * A desktop agent (typically for user channels) may want to provide additional information + * about how a channel can be represented in a UI. A common use case is for color linking. + */ +export interface DisplayMetadata { + color?: string; + glyph?: string; + name?: string; +} + +/** + * Metadata relating to a single icon image at a remote URL, used to represent an + * application in a user interface. + */ +export interface Icon { + size?: string; + src: string; + type?: string; +} + +/** + * Metadata relating to a single image at a remote URL, used to represent screenshot images. + */ +export interface Image { + label?: string; + size?: string; + src: string; + type?: string; +} + +/** + * Metadata relating to the FDC3 DesktopAgent object and its provider + */ +export interface ImplementationMetadata { + appMetadata: AppMetadataElement; + fdc3Version: string; + optionalFeatures: OptionalFeatures; + provider: string; + providerVersion?: string; +} + +export interface OptionalFeatures { + DesktopAgentBridging?: boolean; + OriginatingAppMetadata: boolean; + UserChannelMembershipAPIs: boolean; +} + +/** + * The interface used to describe an intent within the platform. + */ +export interface IntentMetadata { + displayName: string; + name?: string; +} + +/** + * IntentResolution provides a standard format for data returned upon resolving an intent. + */ +export interface IntentResolution { + intent: string; + source: SourceElement; + version?: string; +} + +/** + * Describes results that an Intent handler may optionally return that should be + * communicated back to the app that raised the intent, via the IntentResolution. + * + * Represents a context channel that applications can join to share context data. + */ +export interface IntentResult { + id?: { [key: string]: any } | string; + name?: string; + type: string; + displayMetadata?: DisplayMetadataClass; + [property: string]: any; +} + +export interface BridgeRequest { + meta: MetaObject; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface MetaObject { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: ErrorSourceElement; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + [property: string]: any; +} + +/** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + * + * Field that represents the source application that the request was received from. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + * + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface Destination {} + +/** + * Field that represents the source application that the request was received from. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + * + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface ErrorSourceElement { + appId?: string; + desktopAgent?: string; + instanceId?: string; + [property: string]: any; +} + +export interface BridgeResponse { + meta: BridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface BridgeResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: ErrorSourceElement[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: ErrorSourceElement[]; +} + +export interface BroadcastRequest { + meta: BroadcastRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: BroadcastRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface BroadcastRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * Field that represents the source application that the request was received from. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + * + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface PurpleIdentifier { + appId: string; + desktopAgent?: string; + instanceId?: string; + [property: string]: any; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface BroadcastRequestPayload { + channel: ChannelClass; + context: ContextObject; +} + +/** + * Represents a context channel that applications can join to share context data. + */ +export interface ChannelClass { + displayMetadata?: DisplayMetadataClass; + id: string; + type: Type; +} + +export interface ContextObject { + id?: { [key: string]: any }; + name?: string; + type: string; + [property: string]: any; +} + +export interface FindInstancesRequest { + meta: FindInstancesRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface FindInstancesRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface FindInstancesRequestPayload { + app: SourceElement; +} + +export interface FindInstancesResponse { + meta: FindInstancesResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindInstancesResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface FindInstancesResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: ErrorSourceElement[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface SourceClass { + desktopAgent: string; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface FindInstancesResponsePayload { + appIdentifiers: AppMetadataElement[]; +} + +export interface FindIntentRequest { + meta: FindIntentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface FindIntentRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface FindIntentRequestPayload { + context: ContextObject; + intent: string; +} + +export interface FindIntentResponse { + meta: FindIntentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface FindIntentResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: SourceClass[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface FindIntentResponsePayload { + appIntent: AppIntentElement; +} + +/** + * Represents the binding of an intent to apps + */ +export interface AppIntentElement { + apps: AppMetadataElement[]; + intent: IntentClass; +} + +export interface FindIntentsForContextRequest { + meta: FindIntentsForContextRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentsForContextRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface FindIntentsForContextRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface FindIntentsForContextRequestPayload { + context: ContextObject; +} + +export interface FindIntentsForContextResponse { + meta: FindIntentsForContextResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentsForContextResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface FindIntentsForContextResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: SourceClass[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface FindIntentsForContextResponsePayload { + appIntents: AppIntentElement[]; +} + +export interface GetAppMetadataRequest { + meta: GetAppMetadataRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: GetAppMetadataRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface GetAppMetadataRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface GetAppMetadataRequestPayload { + app: SourceElement; +} + +export interface GetAppMetadataResponse { + meta: GetAppMetadataResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: GetAppMetadataResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface GetAppMetadataResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: SourceClass[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface GetAppMetadataResponsePayload { + appMetadata: AppMetadataElement; +} + +export interface OpenRequest { + meta: OpenRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: OpenRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface OpenRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationClass; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + * + * Field that represents the source application that the request was received from. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls at specific applications. + * + * Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the + * source or destination of a message which was produced by or should be processed by the + * Desktop Agent itself rather than a specific application. Often added to messages by the + * Desktop Agent Bridge. + */ +export interface DestinationClass {} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface OpenRequestPayload { + app: SourceElement; + context?: ContextObject; +} + +export interface OpenResponse { + meta: OpenResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: OpenResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface OpenResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: SourceClass[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface OpenResponsePayload { + appIdentifier: SourceElement; +} + +export interface RaiseIntentRequest { + meta: RaiseIntentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: RaiseIntentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; +} + +export interface RaiseIntentRequestMeta { + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: Destination; + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Field that represents the source application that the request was received from. + */ + source: PurpleIdentifier; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface RaiseIntentRequestPayload { + app: SourceElement; + context: ContextObject; +} + +export interface RaiseIntentResponse { + meta: RaiseIntentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface RaiseIntentResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: ErrorSourceElement[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceClass[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface RaiseIntentResponsePayload { + intentResolution: IntentResolutionClass; +} + +/** + * IntentResolution provides a standard format for data returned upon resolving an intent. + */ +export interface IntentResolutionClass { + intent: string; + source: SourceElement; + version?: string; +} + +export interface RaiseIntentResultResponse { + meta: RaiseIntentResultResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResultResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; +} + +export interface RaiseIntentResultResponseMeta { + /** + * Unique GUID for the request + */ + requestGuid: string; + /** + * Timestamp at which request or response was generated + */ + timestamp: Date; + /** + * Array of error message strings for responses that were not returned to the bridge before + * the timeout or because an error occurred. Should be the same length as the `errorSources` + * array and ordered the same. May be omitted if all sources responded without errors. + */ + errorDetails?: string[]; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned + * to the bridge before the timeout or because an error occurred. May be omitted if all + * sources responded without errors. + */ + errorSources?: ErrorSourceElement[]; + /** + * Unique GUID for the response + */ + responseGuid: string; + /** + * Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated + * responses to the request. Will contain a single value for individual responses and + * multiple values for responses that were collated by the bridge. May be omitted if all + * sources errored. + */ + sources?: SourceElement[]; +} + +/** + * The message payload typically contains return values for FDC3 API functions. + */ +export interface RaiseIntentResultResponsePayload { + intentResult: IntentResultClass; +} + +export interface IntentResultClass { + context?: ContextObject; + channel?: ChannelClass; +} + +export interface Context { + id?: { [key: string]: any }; + name?: string; + type: string; + [property: string]: any; +} + +// Converts JSON strings to/from your types +// and asserts the results of JSON.parse at runtime +export class Convert { + public static toAppIdentifier(json: string): AppIdentifier { + return cast(JSON.parse(json), r('AppIdentifier')); + } + + public static appIdentifierToJson(value: AppIdentifier): string { + return JSON.stringify(uncast(value, r('AppIdentifier')), null, 2); + } + + public static toAppIntent(json: string): AppIntent { + return cast(JSON.parse(json), r('AppIntent')); + } + + public static appIntentToJson(value: AppIntent): string { + return JSON.stringify(uncast(value, r('AppIntent')), null, 2); + } + + public static toAppMetadata(json: string): AppMetadata { + return cast(JSON.parse(json), r('AppMetadata')); + } + + public static appMetadataToJson(value: AppMetadata): string { + return JSON.stringify(uncast(value, r('AppMetadata')), null, 2); + } + + public static toChannel(json: string): Channel { + return cast(JSON.parse(json), r('Channel')); + } + + public static channelToJson(value: Channel): string { + return JSON.stringify(uncast(value, r('Channel')), null, 2); + } + + public static toContextMetadata(json: string): ContextMetadata { + return cast(JSON.parse(json), r('ContextMetadata')); + } + + public static contextMetadataToJson(value: ContextMetadata): string { + return JSON.stringify(uncast(value, r('ContextMetadata')), null, 2); + } + + public static toDesktopAgentIdentifier(json: string): DesktopAgentIdentifier { + return cast(JSON.parse(json), r('DesktopAgentIdentifier')); + } + + public static desktopAgentIdentifierToJson(value: DesktopAgentIdentifier): string { + return JSON.stringify(uncast(value, r('DesktopAgentIdentifier')), null, 2); + } + + public static toDisplayMetadata(json: string): DisplayMetadata { + return cast(JSON.parse(json), r('DisplayMetadata')); + } + + public static displayMetadataToJson(value: DisplayMetadata): string { + return JSON.stringify(uncast(value, r('DisplayMetadata')), null, 2); + } + + public static toSchemasAPIErrorsSchema(json: string): any { + return cast(JSON.parse(json), 'any'); + } + + public static schemasAPIErrorsSchemaToJson(value: any): string { + return JSON.stringify(uncast(value, 'any'), null, 2); + } + + public static toIcon(json: string): Icon { + return cast(JSON.parse(json), r('Icon')); + } + + public static iconToJson(value: Icon): string { + return JSON.stringify(uncast(value, r('Icon')), null, 2); + } + + public static toImage(json: string): Image { + return cast(JSON.parse(json), r('Image')); + } + + public static imageToJson(value: Image): string { + return JSON.stringify(uncast(value, r('Image')), null, 2); + } + + public static toImplementationMetadata(json: string): ImplementationMetadata { + return cast(JSON.parse(json), r('ImplementationMetadata')); + } + + public static implementationMetadataToJson(value: ImplementationMetadata): string { + return JSON.stringify(uncast(value, r('ImplementationMetadata')), null, 2); + } + + public static toIntentMetadata(json: string): IntentMetadata { + return cast(JSON.parse(json), r('IntentMetadata')); + } + + public static intentMetadataToJson(value: IntentMetadata): string { + return JSON.stringify(uncast(value, r('IntentMetadata')), null, 2); + } + + public static toIntentResolution(json: string): IntentResolution { + return cast(JSON.parse(json), r('IntentResolution')); + } + + public static intentResolutionToJson(value: IntentResolution): string { + return JSON.stringify(uncast(value, r('IntentResolution')), null, 2); + } + + public static toIntentResult(json: string): IntentResult { + return cast(JSON.parse(json), r('IntentResult')); + } + + public static intentResultToJson(value: IntentResult): string { + return JSON.stringify(uncast(value, r('IntentResult')), null, 2); + } + + public static toBridgeRequest(json: string): BridgeRequest { + return cast(JSON.parse(json), r('BridgeRequest')); + } + + public static bridgeRequestToJson(value: BridgeRequest): string { + return JSON.stringify(uncast(value, r('BridgeRequest')), null, 2); + } + + public static toBridgeResponse(json: string): BridgeResponse { + return cast(JSON.parse(json), r('BridgeResponse')); + } + + public static bridgeResponseToJson(value: BridgeResponse): string { + return JSON.stringify(uncast(value, r('BridgeResponse')), null, 2); + } + + public static toBroadcastRequest(json: string): BroadcastRequest { + return cast(JSON.parse(json), r('BroadcastRequest')); + } + + public static broadcastRequestToJson(value: BroadcastRequest): string { + return JSON.stringify(uncast(value, r('BroadcastRequest')), null, 2); + } + + public static toFindInstancesRequest(json: string): FindInstancesRequest { + return cast(JSON.parse(json), r('FindInstancesRequest')); + } + + public static findInstancesRequestToJson(value: FindInstancesRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesRequest')), null, 2); + } + + public static toFindInstancesResponse(json: string): FindInstancesResponse { + return cast(JSON.parse(json), r('FindInstancesResponse')); + } + + public static findInstancesResponseToJson(value: FindInstancesResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesResponse')), null, 2); + } + + public static toFindIntentRequest(json: string): FindIntentRequest { + return cast(JSON.parse(json), r('FindIntentRequest')); + } + + public static findIntentRequestToJson(value: FindIntentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentRequest')), null, 2); + } + + public static toFindIntentResponse(json: string): FindIntentResponse { + return cast(JSON.parse(json), r('FindIntentResponse')); + } + + public static findIntentResponseToJson(value: FindIntentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentResponse')), null, 2); + } + + public static toFindIntentsForContextRequest(json: string): FindIntentsForContextRequest { + return cast(JSON.parse(json), r('FindIntentsForContextRequest')); + } + + public static findIntentsForContextRequestToJson(value: FindIntentsForContextRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsForContextRequest')), null, 2); + } + + public static toFindIntentsForContextResponse(json: string): FindIntentsForContextResponse { + return cast(JSON.parse(json), r('FindIntentsForContextResponse')); + } + + public static findIntentsForContextResponseToJson(value: FindIntentsForContextResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsForContextResponse')), null, 2); + } + + public static toGetAppMetadataRequest(json: string): GetAppMetadataRequest { + return cast(JSON.parse(json), r('GetAppMetadataRequest')); + } + + public static getAppMetadataRequestToJson(value: GetAppMetadataRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataRequest')), null, 2); + } + + public static toGetAppMetadataResponse(json: string): GetAppMetadataResponse { + return cast(JSON.parse(json), r('GetAppMetadataResponse')); + } + + public static getAppMetadataResponseToJson(value: GetAppMetadataResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataResponse')), null, 2); + } + + public static toOpenRequest(json: string): OpenRequest { + return cast(JSON.parse(json), r('OpenRequest')); + } + + public static openRequestToJson(value: OpenRequest): string { + return JSON.stringify(uncast(value, r('OpenRequest')), null, 2); + } + + public static toOpenResponse(json: string): OpenResponse { + return cast(JSON.parse(json), r('OpenResponse')); + } + + public static openResponseToJson(value: OpenResponse): string { + return JSON.stringify(uncast(value, r('OpenResponse')), null, 2); + } + + public static toRaiseIntentRequest(json: string): RaiseIntentRequest { + return cast(JSON.parse(json), r('RaiseIntentRequest')); + } + + public static raiseIntentRequestToJson(value: RaiseIntentRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentRequest')), null, 2); + } + + public static toRaiseIntentResponse(json: string): RaiseIntentResponse { + return cast(JSON.parse(json), r('RaiseIntentResponse')); + } + + public static raiseIntentResponseToJson(value: RaiseIntentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResponse')), null, 2); + } + + public static toRaiseIntentResultResponse(json: string): RaiseIntentResultResponse { + return cast(JSON.parse(json), r('RaiseIntentResultResponse')); + } + + public static raiseIntentResultResponseToJson(value: RaiseIntentResultResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultResponse')), null, 2); + } + + public static toContext(json: string): Context { + return cast(JSON.parse(json), r('Context')); + } + + public static contextToJson(value: Context): string { + return JSON.stringify(uncast(value, r('Context')), null, 2); + } +} + +function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); +} + +function prettyTypeName(typ: any): string { + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; + } else { + return `one of [${typ + .map(a => { + return prettyTypeName(a); + }) + .join(', ')}]`; + } + } else if (typeof typ === 'object' && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } +} + +function jsonToJSProps(typ: any): any { + if (typ.jsonToJS === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.json] = { key: p.js, typ: p.typ })); + typ.jsonToJS = map; + } + return typ.jsonToJS; +} + +function jsToJSONProps(typ: any): any { + if (typ.jsToJSON === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.js] = { key: p.json, typ: p.typ })); + typ.jsToJSON = map; + } + return typ.jsToJSON; +} + +function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { + function transformPrimitive(typ: string, val: any): any { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs: any[], val: any): any { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases: string[], val: any): any { + if (cases.indexOf(val) !== -1) return val; + return invalidValue( + cases.map(a => { + return l(a); + }), + val, + key, + parent + ); + } + + function transformArray(typ: any, val: any): any { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l('array'), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val: any): any { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l('Date'), val, key, parent); + } + return d; + } + + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { + if (val === null || typeof val !== 'object' || Array.isArray(val)) { + return invalidValue(l(ref || 'object'), val, key, parent); + } + const result: any = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); +} + +function cast(val: any, typ: any): T { + return transform(val, typ, jsonToJSProps); +} + +function uncast(val: T, typ: any): any { + return transform(val, typ, jsToJSONProps); +} + +function l(typ: any) { + return { literal: typ }; +} + +function a(typ: any) { + return { arrayItems: typ }; +} + +function u(...typs: any[]) { + return { unionMembers: typs }; +} + +function o(props: any[], additional: any) { + return { props, additional }; +} + +function m(additional: any) { + return { props: [], additional }; +} + +function r(name: string) { + return { ref: name }; +} + +const typeMap: any = { + AppIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + AppIntent: o( + [ + { json: 'apps', js: 'apps', typ: a(r('AppMetadataElement')) }, + { json: 'intent', js: 'intent', typ: r('IntentClass') }, + ], + false + ), + AppMetadataElement: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'description', js: 'description', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'icons', js: 'icons', typ: u(undefined, a(r('IconElement'))) }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) }, + { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('ScreenshotElement'))) }, + { json: 'title', js: 'title', typ: u(undefined, '') }, + { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') }, + { json: 'version', js: 'version', typ: u(undefined, '') }, + ], + false + ), + IconElement: o( + [ + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), + ScreenshotElement: o( + [ + { json: 'label', js: 'label', typ: u(undefined, '') }, + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), + IntentClass: o( + [ + { json: 'displayName', js: 'displayName', typ: '' }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + false + ), + AppMetadata: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'description', js: 'description', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'icons', js: 'icons', typ: u(undefined, a(r('IconElement'))) }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) }, + { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('ScreenshotElement'))) }, + { json: 'title', js: 'title', typ: u(undefined, '') }, + { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') }, + { json: 'version', js: 'version', typ: u(undefined, '') }, + ], + false + ), + Channel: o( + [ + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadataClass')) }, + { json: 'id', js: 'id', typ: '' }, + { json: 'type', js: 'type', typ: r('Type') }, + ], + false + ), + DisplayMetadataClass: o( + [ + { json: 'color', js: 'color', typ: u(undefined, '') }, + { json: 'glyph', js: 'glyph', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + false + ), + ContextMetadata: o([{ json: 'source', js: 'source', typ: r('SourceElement') }], false), + SourceElement: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + DesktopAgentIdentifier: o([{ json: 'desktopAgent', js: 'desktopAgent', typ: '' }], false), + DisplayMetadata: o( + [ + { json: 'color', js: 'color', typ: u(undefined, '') }, + { json: 'glyph', js: 'glyph', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + false + ), + Icon: o( + [ + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), + Image: o( + [ + { json: 'label', js: 'label', typ: u(undefined, '') }, + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), + ImplementationMetadata: o( + [ + { json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadataElement') }, + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') }, + { json: 'provider', js: 'provider', typ: '' }, + { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') }, + ], + false + ), + OptionalFeatures: o( + [ + { json: 'DesktopAgentBridging', js: 'DesktopAgentBridging', typ: u(undefined, true) }, + { json: 'OriginatingAppMetadata', js: 'OriginatingAppMetadata', typ: true }, + { json: 'UserChannelMembershipAPIs', js: 'UserChannelMembershipAPIs', typ: true }, + ], + false + ), + IntentMetadata: o( + [ + { json: 'displayName', js: 'displayName', typ: '' }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + false + ), + IntentResolution: o( + [ + { json: 'intent', js: 'intent', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceElement') }, + { json: 'version', js: 'version', typ: u(undefined, '') }, + ], + false + ), + IntentResult: o( + [ + { json: 'id', js: 'id', typ: u(undefined, u(m('any'), '')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadataClass')) }, + ], + 'any' + ), + BridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('MetaObject') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + MetaObject: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('ErrorSourceElement') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + 'any' + ), + Destination: o([], false), + ErrorSourceElement: o( + [ + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('ErrorSourceElement'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('ErrorSourceElement'))) }, + ], + false + ), + BroadcastRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BroadcastRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PurpleIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BroadcastRequestPayload: o( + [ + { json: 'channel', js: 'channel', typ: r('ChannelClass') }, + { json: 'context', js: 'context', typ: r('ContextObject') }, + ], + false + ), + ChannelClass: o( + [ + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadataClass')) }, + { json: 'id', js: 'id', typ: '' }, + { json: 'type', js: 'type', typ: r('Type') }, + ], + false + ), + ContextObject: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + FindInstancesRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindInstancesRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindInstancesRequestPayload: o([{ json: 'app', js: 'app', typ: r('SourceElement') }], false), + FindInstancesResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindInstancesResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('ErrorSourceElement'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + SourceClass: o([{ json: 'desktopAgent', js: 'desktopAgent', typ: '' }], false), + FindInstancesResponsePayload: o( + [{ json: 'appIdentifiers', js: 'appIdentifiers', typ: a(r('AppMetadataElement')) }], + false + ), + FindIntentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindIntentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('ContextObject') }, + { json: 'intent', js: 'intent', typ: '' }, + ], + false + ), + FindIntentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindIntentResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('SourceClass'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + FindIntentResponsePayload: o([{ json: 'appIntent', js: 'appIntent', typ: r('AppIntentElement') }], false), + AppIntentElement: o( + [ + { json: 'apps', js: 'apps', typ: a(r('AppMetadataElement')) }, + { json: 'intent', js: 'intent', typ: r('IntentClass') }, + ], + false + ), + FindIntentsForContextRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsForContextRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsForContextRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindIntentsForContextRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsForContextRequestPayload: o([{ json: 'context', js: 'context', typ: r('ContextObject') }], false), + FindIntentsForContextResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsForContextResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsForContextResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + FindIntentsForContextResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('SourceClass'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + FindIntentsForContextResponsePayload: o( + [{ json: 'appIntents', js: 'appIntents', typ: a(r('AppIntentElement')) }], + false + ), + GetAppMetadataRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + GetAppMetadataRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataRequestPayload: o([{ json: 'app', js: 'app', typ: r('SourceElement') }], false), + GetAppMetadataResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + GetAppMetadataResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('SourceClass'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + GetAppMetadataResponsePayload: o([{ json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadataElement') }], false), + OpenRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + OpenRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationClass')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + DestinationClass: o([], false), + OpenRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('SourceElement') }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextObject')) }, + ], + false + ), + OpenResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + OpenResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('SourceClass'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + OpenResponsePayload: o([{ json: 'appIdentifier', js: 'appIdentifier', typ: r('SourceElement') }], false), + RaiseIntentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentRequestPayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + RaiseIntentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('Destination')) }, + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'source', js: 'source', typ: r('PurpleIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('SourceElement') }, + { json: 'context', js: 'context', typ: r('ContextObject') }, + ], + false + ), + RaiseIntentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + RaiseIntentResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('ErrorSourceElement'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceClass'))) }, + ], + false + ), + RaiseIntentResponsePayload: o( + [{ json: 'intentResolution', js: 'intentResolution', typ: r('IntentResolutionClass') }], + false + ), + IntentResolutionClass: o( + [ + { json: 'intent', js: 'intent', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceElement') }, + { json: 'version', js: 'version', typ: u(undefined, '') }, + ], + false + ), + RaiseIntentResultResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultResponsePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + RaiseIntentResultResponseMeta: o( + [ + { json: 'requestGuid', js: 'requestGuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a('')) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('ErrorSourceElement'))) }, + { json: 'responseGuid', js: 'responseGuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('SourceElement'))) }, + ], + false + ), + RaiseIntentResultResponsePayload: o( + [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResultClass') }], + false + ), + IntentResultClass: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('ContextObject')) }, + { json: 'channel', js: 'channel', typ: u(undefined, r('ChannelClass')) }, + ], + false + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + Type: ['app', 'private', 'user'], +}; diff --git a/src/context/README.md b/src/context/README.md index 4212bf479..94736706a 100644 --- a/src/context/README.md +++ b/src/context/README.md @@ -6,11 +6,11 @@ Please note that these definitions are provided to help developers working in Ty It is not always possible to perfectly replicate a type/interface defined in JSONSchema via TypeScript. Hence, in the event of any disagreement between the definitions, the JSONSchema should be assumed to be correct, rather than the Typescript. For example, JSONSchema may define optional fields on an object + a restriction on the type of additional properties (via `"additionalProperties": { "type": "string"}`), which will result in an index signature `[property: string]: string;` in generated TypeScript. That signature, is incompatible with with an optional properties (including string properties) as they have type `string | undefined`. A similar problem may occur in JSON Schema if the schema is used to create a subtype via composition as `additionalProperties` is not aware of teh subschema's definitions. Both issues can be worked around by using `unevaluatedProperties` in the schema, which will defer to the declared type of the optional property in the subschema, but is also currently ignored by quicktype - resulting in a type that will compile, but doesn't restrict the type of optional property values as defined in the schema. -Further, quicktype doesn't always perfectly replicate polymorphic fields specified with `oneOf` in JSONSchema as it will usually merge the different objects into a single type (where fields not in one of the constitutent schemas become optional) rather than creating a union type. In such situations, the type produced is usuable (has all the necessary fields) but may allow the construction of invalid instances which are missing required properties or include properties from the multiple schemas combined, which are not possible/valid according to JSONSchema. +Further, quicktype doesn't always perfectly replicate polymorphic fields specified with `oneOf` in JSONSchema as it will usually merge the different objects into a single type (where fields not in one of the constituent schemas become optional) rather than creating a union type. In such situations, the type produced is usable (has all the necessary fields) but may allow the construction of invalid instances which are missing required properties or include properties from the multiple schemas combined, which are not possible/valid according to JSONSchema. Hence, the Types provided here can be used to provide valid Context objects and to read/write their JSON encodings, but may not detect or prevent a limited set of invalid objects that would be identified by JSONSchema. -Finally, quicktype will generate types or interfaces representing subunits of the schema, which are then referenced in the main interface definition. These often do not have unique names (e.g. fields of the `id` object in the Context schema, defined for a specific context type such as fdc3.instrument). Quicktype will generate a random name for such an interface, to use to reference it, and as it is randomly generated it may appear oddly named (e.g. PurpleId, FluffyMarket, TentacledIdentifer etc.). Please ignore such names as these types/interfaces will not normally be used outside of the composition of the main type, e.g.: +Finally, quicktype will generate types or interfaces representing subunits of the schema, which are then referenced in the main interface definition. These often do not have unique names (e.g. fields of the `id` object in the Context schema, defined for a specific context type such as fdc3.instrument). Quicktype will generate a random name for such an interface, to use to reference it, and as it is randomly generated it may appear oddly named (e.g. `PurpleId`, `FluffyMarket`, `TentacledIdentifier` etc.). Please ignore such names as these types/interfaces will not normally be used outside of the composition of the main type, e.g.: ```TypeScript export interface Instrument { @@ -47,6 +47,6 @@ and should not be considered a planned part of the type structure (which should Finally, please note that the latest version of quicktype (at the time of writing `23.0.19`) has a number of bugs that must be worked around: -- Using a directory or .schema.json files as a source will cause the input type argument `-s schema` to be ignored, causing the files to be interpretted as JSON rather than JSON Schema. +- Using a directory or .schema.json files as a source will cause the input type argument `-s schema` to be ignored, causing the files to be interpreted as JSON rather than JSON Schema. - A utility is provided in this repository (_../../quicktypeUtil.js_) to work around this bug by listing directories and constructing a call to quicktype where each file is provided as an individual source. - Setting the `--nice-property-names` TypeScript output option will crash the generator and can't be used. diff --git a/src/context/schemas.json b/src/context/schemas.json deleted file mode 100644 index 4310f348d..000000000 --- a/src/context/schemas.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "Context": ["https://fdc3.finos.org/schemas/next/context.schema.json"], - "Chart": ["https://fdc3.finos.org/schemas/next/chart.schema.json"], - "ChatInitSettings": ["https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json"], - "Contact": ["https://fdc3.finos.org/schemas/next/contact.schema.json"], - "ContactList": ["https://fdc3.finos.org/schemas/next/contactList.schema.json"], - "Country": ["https://fdc3.finos.org/schemas/next/country.schema.json"], - "Currency": ["https://fdc3.finos.org/schemas/next/currency.schema.json"], - "Email": ["https://fdc3.finos.org/schemas/next/email.schema.json"], - "Instrument": ["https://fdc3.finos.org/schemas/next/instrument.schema.json"], - "InstrumentList": ["https://fdc3.finos.org/schemas/next/instrumentList.schema.json"], - "Nothing": ["https://fdc3.finos.org/schemas/next/nothing.schema.json"], - "Organization": ["https://fdc3.finos.org/schemas/next/organization.schema.json"], - "Portfolio": ["https://fdc3.finos.org/schemas/next/portfolio.schema.json"], - "Position": ["https://fdc3.finos.org/schemas/next/position.schema.json"], - "TimeRange": ["https://fdc3.finos.org/schemas/next/timerange.schema.json"], - "Valuation": ["https://fdc3.finos.org/schemas/next/valuation.schema.json"] -} diff --git a/website/package.json b/website/package.json index a16b08fe0..68f4799b4 100644 --- a/website/package.json +++ b/website/package.json @@ -4,7 +4,7 @@ "start": "docusaurus start", "prebuild": "npm run copy-appd && npm run copy-schemas && npm run copy-workbench && npm run copy-explained", "build": "docusaurus build", - "copy-schemas": "cpy \"../src/context/schemas/*.json\" \"static/schemas/next/\"", + "copy-schemas": "del-cli static/schemas/next/*/ && cpy \"../schemas/**\" static/schemas/next/", "copy-appd": "cpy \"../src/app-directory/specification/*.yaml\" \"static/schemas/next/\" --rename app-directory.yaml", "build-workbench": "cd ../toolbox/fdc3-workbench && npm install && npm run build", "copy-workbench": "del-cli static/toolbox/fdc3-workbench && npm run build-workbench && cpy \"../toolbox/fdc3-workbench/build/**\" static/toolbox/fdc3-workbench", diff --git a/website/static/schemas/next/api/appIdentifier.schema.json b/website/static/schemas/next/api/appIdentifier.schema.json new file mode 100644 index 000000000..29ef4c7d0 --- /dev/null +++ b/website/static/schemas/next/api/appIdentifier.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/appIdentifier.schema.json", + "title": "AppIdentifier", + "description": "Identifies an application, or instance of an application, and is used to target FDC3 API calls at specific applications.", + "type": "object", + "properties": { + "appId": { + "type": "string" + }, + "instanceId": { + "type": "string" + }, + "desktopAgent": { + "type": "string" + } + }, + "required": [ + "appId" + ], + "unevaluatedProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/appIntent.schema.json b/website/static/schemas/next/api/appIntent.schema.json new file mode 100644 index 000000000..1f2315d37 --- /dev/null +++ b/website/static/schemas/next/api/appIntent.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/appIntent.schema.json", + "title": "AppIntent", + "description": "Represents the binding of an intent to apps", + "type": "object", + "properties": { + "intent": { + "$ref": "intentMetadata.schema.json" + }, + "apps": { + "type": "array", + "items": { + "$ref": "appMetadata.schema.json" + } + } + }, + "required": [ + "intent", + "apps" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/appMetadata.schema.json b/website/static/schemas/next/api/appMetadata.schema.json new file mode 100644 index 000000000..14bfc1a8f --- /dev/null +++ b/website/static/schemas/next/api/appMetadata.schema.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/appMetadata.schema.json", + "title": "AppMetadata", + "description": "Extends an AppIdentifier, describing an application or instance of an application.", + "type": "object", + "allOf": [ + { + "$ref": "appIdentifier.schema.json" + } + ], + "properties": { + "appId": true, + "instanceId": true, + "desktopAgent": true, + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "instanceMetadata": { + "type": "object" + }, + "title": { + "type": "string" + }, + "tooltip": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icons": { + "type": "array", + "items": { + "$ref": "icon.schema.json" + } + }, + "screenshots": { + "type": "array", + "items": { + "$ref": "image.schema.json" + } + }, + "resultType": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/channel.schema.json b/website/static/schemas/next/api/channel.schema.json new file mode 100644 index 000000000..76c80ce80 --- /dev/null +++ b/website/static/schemas/next/api/channel.schema.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/channel.schema.json", + "title": "Channel", + "description": "Represents a context channel that applications can join to share context data.", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "user", + "app", + "private" + ] + }, + "displayMetadata": { + "$ref": "displayMetadata.schema.json" + } + }, + "required": [ + "id", + "type" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/contextMetadata.schema.json b/website/static/schemas/next/api/contextMetadata.schema.json new file mode 100644 index 000000000..29dd86436 --- /dev/null +++ b/website/static/schemas/next/api/contextMetadata.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/contextMetadata.schema.json", + "title": "ContextMetadata", + "description": "Metadata relating to a context or intent & context received through the addContextListener and addIntentListener functions.", + "type": "object", + "properties": { + "source": { + "$ref": "appIdentifier.schema.json" + } + }, + "required": [ + "source" + ], + "additionalProperties": false +} diff --git a/website/static/schemas/next/api/desktopAgentIdentifier.schema.json b/website/static/schemas/next/api/desktopAgentIdentifier.schema.json new file mode 100644 index 000000000..c07c0d341 --- /dev/null +++ b/website/static/schemas/next/api/desktopAgentIdentifier.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/desktopAgentIdentifier.schema.json", + "title": "DesktopAgentIdentifier", + "description": "Identifies a particular Desktop Agent. Used by Desktop Agent Bridging to indicate the source or destination of a message which was produced by or should be processed by the Desktop Agent itself rather than a specific application. Often added to messages by the Desktop Agent Bridge.", + "type": "object", + "properties": { + "desktopAgent": { + "type": "string" + } + }, + "required": [ + "desktopAgent" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/displayMetadata.schema.json b/website/static/schemas/next/api/displayMetadata.schema.json new file mode 100644 index 000000000..a83f5ef9a --- /dev/null +++ b/website/static/schemas/next/api/displayMetadata.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/displayMetadata.schema.json", + "title": "DisplayMetadata", + "description": "A desktop agent (typically for user channels) may want to provide additional information about how a channel can be represented in a UI. A common use case is for color linking.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "color": { + "type": "string" + }, + "glyph": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/errors.schema.json b/website/static/schemas/next/api/errors.schema.json new file mode 100644 index 000000000..2c50b00b1 --- /dev/null +++ b/website/static/schemas/next/api/errors.schema.json @@ -0,0 +1,57 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/errors.schema.json", + "definitions": { + "OpenError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered when calling the open method on the DesktopAgent object.", + "enum": [ + "AppNotFound", + "ErrorOnLaunch", + "AppTimeout", + "ResolverUnavailable", + "DesktopAgentNotFound" + ] + }, + "ResolveError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered when calling the findIntent, findIntentsByContext, raiseIntent or raiseIntentForContext methods on the DesktopAgent.", + "enum": [ + "NoAppsFound", + "ResolverUnavailable", + "UserCancelledResolution", + "ResolverTimeout", + "TargetAppUnavailable", + "TargetInstanceUnavailable", + "IntentDeliveryFailed", + "DesktopAgentNotFound" + ] + }, + "ResultError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered when calling the getResult method on the IntentResolution Object.", + "enum": [ + "NoResultReturned", + "IntentHandlerRejected" + ] + }, + "ChannelError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered when calling channels using the joinUserChannel or getOrCreateChannel methods, or the getCurrentContext, broadcast or addContextListener methods on the Channel object.", + "enum": [ + "NoChannelFound", + "AccessDenied", + "CreationFailed" + ] + }, + "BridgingError": { + "type": "string", + "description": "Contains constants representing the errors that can be encountered by Desktop Agents when exchanging bridging messages.", + "enum": [ + "ResponseToBridgeTimedOut", + "AgentDisconnected", + "NotConnectedToBridge" + ] + } + } +} \ No newline at end of file diff --git a/website/static/schemas/next/api/icon.schema.json b/website/static/schemas/next/api/icon.schema.json new file mode 100644 index 000000000..951356324 --- /dev/null +++ b/website/static/schemas/next/api/icon.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/icon.schema.json", + "title": "Icon", + "description": "Metadata relating to a single icon image at a remote URL, used to represent an application in a user interface.", + "type": "object", + "properties": { + "src": { + "type": "string" + }, + "size": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "src" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/image.schema.json b/website/static/schemas/next/api/image.schema.json new file mode 100644 index 000000000..1f962a601 --- /dev/null +++ b/website/static/schemas/next/api/image.schema.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/image.schema.json", + "title": "Image", + "description": "Metadata relating to a single image at a remote URL, used to represent screenshot images.", + "type": "object", + "properties": { + "src": { + "type": "string" + }, + "size": { + "type": "string" + }, + "type": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "src" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/api/schemas/implementationMetadata.schema.json b/website/static/schemas/next/api/implementationMetadata.schema.json similarity index 86% rename from src/api/schemas/implementationMetadata.schema.json rename to website/static/schemas/next/api/implementationMetadata.schema.json index 0e8f5172b..6f0b53bed 100644 --- a/src/api/schemas/implementationMetadata.schema.json +++ b/website/static/schemas/next/api/implementationMetadata.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/implementationMetadata.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/api/implementationMetadata.schema.json", "title": "ImplementationMetadata", "description": "Metadata relating to the FDC3 DesktopAgent object and its provider", "type": "object", @@ -31,7 +31,7 @@ "additionalProperties": false }, "appMetadata": { - "$ref": "https://fdc3.finos.org/schemas/next/appMetadata.schema.json" + "$ref": "appMetadata.schema.json" } }, "required": [ diff --git a/website/static/schemas/next/api/intentMetadata.schema.json b/website/static/schemas/next/api/intentMetadata.schema.json new file mode 100644 index 000000000..61cba896c --- /dev/null +++ b/website/static/schemas/next/api/intentMetadata.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/intentMetadata.schema.json", + "title": "IntentMetadata", + "description": "The interface used to describe an intent within the platform.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "displayName": { + "type": "string" + } + }, + "required": [ + "displayName" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/intentResolution.schema.json b/website/static/schemas/next/api/intentResolution.schema.json new file mode 100644 index 000000000..65a6138ed --- /dev/null +++ b/website/static/schemas/next/api/intentResolution.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/intentResolution.schema.json", + "title": "IntentResolution", + "description": "IntentResolution provides a standard format for data returned upon resolving an intent.", + "type": "object", + "properties": { + "source": { + "$ref": "appIdentifier.schema.json" + }, + "intent": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "source", + "intent" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/website/static/schemas/next/api/intentResult.schema.json b/website/static/schemas/next/api/intentResult.schema.json new file mode 100644 index 000000000..4d8d89ea9 --- /dev/null +++ b/website/static/schemas/next/api/intentResult.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/api/intentResult.schema.json", + "title": "IntentResult", + "description": "Describes results that an Intent handler may optionally return that should be communicated back to the app that raised the intent, via the IntentResolution.", + "type": "object", + "oneOf": [ + { + "$ref": "../context/context.schema.json" + }, + { + "$ref": "channel.schema.json" + } + ] +} \ No newline at end of file diff --git a/website/static/schemas/next/bridging/bridgeRequest.schema.json b/website/static/schemas/next/bridging/bridgeRequest.schema.json new file mode 100644 index 000000000..7053f76e2 --- /dev/null +++ b/website/static/schemas/next/bridging/bridgeRequest.schema.json @@ -0,0 +1,60 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/bridgeRequest.schema.json", + "title": "BridgeRequest", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Identifies the type of the message and it is typically set to the FDC3 function name that the message relates to, e.g. 'findIntent', with 'Request' appended." + }, + "payload": { + "type": "object", + "description": "The message payload typically contains the arguments to FDC3 API functions." + }, + "meta": { + "$ref": "#/$defs/RequestMeta" + } + }, + "required": ["type", "payload", "meta"], + "additionalProperties": false, + "$defs": { + "RequestMeta": { + "type": "object", + "properties": { + "requestGuid": { + "type": "string", + "description": "Unique GUID for the request" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp at which request or response was generated" + }, + "source": { + "description": "Field that represents the source application that the request was received from.", + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "destination": { + "description": "Optional field that represents the destination that the request should be routed to. Must be set by the Desktop Agent for API calls that include a target app parameter and must include the name of the Desktop Agent hosting the target application.", + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + } + }, + "required": ["requestGuid", "timestamp", "source"] + } + } +} diff --git a/website/static/schemas/next/bridging/bridgeResponse.schema.json b/website/static/schemas/next/bridging/bridgeResponse.schema.json new file mode 100644 index 000000000..62b332855 --- /dev/null +++ b/website/static/schemas/next/bridging/bridgeResponse.schema.json @@ -0,0 +1,79 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/bridgeResponse.schema.json", + "title": "BridgeResponse", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Identifies the type of the message and it is typically set to the FDC3 function name that the message relates to, e.g. 'findIntent', with 'Response' appended." + }, + "payload": { + "type": "object", + "description": "The message payload typically contains return values for FDC3 API functions." + }, + "meta": { + "$ref": "#/$defs/ResponseMeta" + } + }, + "additionalProperties": false, + "required": ["type", "payload", "meta"], + "$defs": { + "ResponseMeta": { + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json#/$defs/RequestMeta" + }, + { + "type": "object", + "properties": { + "requestGuid": true, + "timestamp": true, + "responseGuid": { + "type": "string", + "description": "Unique GUID for the response" + }, + "sources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "description": "Array of AppIdentifiers or DesktopAgentIdentifiers for the sources that generated responses to the request. Will contain a single value for individual responses and multiple values for responses that were collated by the bridge. May be omitted if all sources errored." + }, + "errorSources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "../api/appIdentifier.schema.json" + }, + { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + ] + }, + "description": "Array of AppIdentifiers or DesktopAgentIdentifiers for responses that were not returned to the bridge before the timeout or because an error occurred. May be omitted if all sources responded without errors." + }, + "errorDetails": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of error message strings for responses that were not returned to the bridge before the timeout or because an error occurred. Should be the same length as the `errorSources` array and ordered the same. May be omitted if all sources responded without errors." + } + }, + "required": ["requestGuid", "responseGuid", "timestamp"], + "additionalProperties": false + } + ] + } + } +} diff --git a/website/static/schemas/next/bridging/broadcastRequest.schema.json b/website/static/schemas/next/bridging/broadcastRequest.schema.json new file mode 100644 index 000000000..058539666 --- /dev/null +++ b/website/static/schemas/next/bridging/broadcastRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/broadcastRequest.schema.json", + "title": "BroadcastRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type":"object", + "properties": { + "type": { + "const": "broadcastRequest" + }, + "payload": { + "type": "object", + "properties": { + "channel": { + "$ref": "../api/channel.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "additionalProperties": false, + "required": ["channel", "context"] + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties":false + } + ] +} diff --git a/website/static/schemas/next/bridging/findInstancesRequest.schema.json b/website/static/schemas/next/bridging/findInstancesRequest.schema.json new file mode 100644 index 000000000..1af8e5420 --- /dev/null +++ b/website/static/schemas/next/bridging/findInstancesRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findInstancesRequest.schema.json", + "title": "FindInstancesRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findInstancesRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/findInstancesResponse.schema.json b/website/static/schemas/next/bridging/findInstancesResponse.schema.json new file mode 100644 index 000000000..801c35645 --- /dev/null +++ b/website/static/schemas/next/bridging/findInstancesResponse.schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findInstancesResponse.schema.json", + "title": "findInstancesResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findInstancesResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIdentifiers": { + "type": "array", + "items": { + "$ref": "../api/appMetadata.schema.json" + } + } + }, + "required": ["appIdentifiers"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/findIntentRequest.schema.json b/website/static/schemas/next/bridging/findIntentRequest.schema.json new file mode 100644 index 000000000..53bc7a2c0 --- /dev/null +++ b/website/static/schemas/next/bridging/findIntentRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentRequest.schema.json", + "title": "FindIntentRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentRequest" + }, + "payload": { + "type": "object", + "properties": { + "intent": { + "type": "string" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["intent", "context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/findIntentResponse.schema.json b/website/static/schemas/next/bridging/findIntentResponse.schema.json new file mode 100644 index 000000000..9e6318bd0 --- /dev/null +++ b/website/static/schemas/next/bridging/findIntentResponse.schema.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentResponse.schema.json", + "title": "FindIntentResponse", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIntent": { + "$ref": "../api/appIntent.schema.json" + } + }, + "required": ["appIntent"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/findIntentsForContextRequest.schema.json b/website/static/schemas/next/bridging/findIntentsForContextRequest.schema.json new file mode 100644 index 000000000..e2444f4c7 --- /dev/null +++ b/website/static/schemas/next/bridging/findIntentsForContextRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentsForContextRequest.schema.json", + "title": "FindIntentsForContextRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "findIntentsForContextRequest" + }, + "payload": { + "type": "object", + "properties": { + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/findIntentsForContextResponse.schema.json b/website/static/schemas/next/bridging/findIntentsForContextResponse.schema.json new file mode 100644 index 000000000..2bcb1073d --- /dev/null +++ b/website/static/schemas/next/bridging/findIntentsForContextResponse.schema.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/findIntentsForContextResponse.schema.json", + "title": "FindIntentsForContextResponse", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "properties": { + "type": { + "const": "findIntentsForContextResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIntents": { + "type": "array", + "items": { + "$ref": "../api/appIntent.schema.json" + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": ["appIntents"] + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/getAppMetadataRequest.schema.json b/website/static/schemas/next/bridging/getAppMetadataRequest.schema.json new file mode 100644 index 000000000..8f4b551ce --- /dev/null +++ b/website/static/schemas/next/bridging/getAppMetadataRequest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/getAppMetadataRequest.schema.json", + "title": "GetAppMetadataRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "getAppMetadataRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/getAppMetadataResponse.schema.json b/website/static/schemas/next/bridging/getAppMetadataResponse.schema.json new file mode 100644 index 000000000..26d2dc468 --- /dev/null +++ b/website/static/schemas/next/bridging/getAppMetadataResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/getAppMetadataResponse.schema.json", + "title": "GetAppMetadataResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "getAppMetadataResponse" + }, + "payload": { + "type": "object", + "properties": { + "appMetadata": { + "$ref": "../api/appMetadata.schema.json" + } + }, + "required": ["appMetadata"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/openRequest.schema.json b/website/static/schemas/next/bridging/openRequest.schema.json new file mode 100644 index 000000000..578c49c6a --- /dev/null +++ b/website/static/schemas/next/bridging/openRequest.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/openRequest.schema.json", + "title": "openRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "openRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["app"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/openResponse.schema.json b/website/static/schemas/next/bridging/openResponse.schema.json new file mode 100644 index 000000000..9c6c80dd9 --- /dev/null +++ b/website/static/schemas/next/bridging/openResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/openResponse.schema.json", + "title": "OpenResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "openResponse" + }, + "payload": { + "type": "object", + "properties": { + "appIdentifier": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "required": ["appIdentifier"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/raiseIntentRequest.schema.json b/website/static/schemas/next/bridging/raiseIntentRequest.schema.json new file mode 100644 index 000000000..b8d1b9449 --- /dev/null +++ b/website/static/schemas/next/bridging/raiseIntentRequest.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentRequest.schema.json", + "title": "RaiseIntentRequest", + "type": "object", + "allOf": [ + { + "$ref": "bridgeRequest.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentRequest" + }, + "payload": { + "type": "object", + "properties": { + "app": { + "$ref": "../api/appIdentifier.schema.json" + }, + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["app", "context"], + "additionalProperties": false + }, + "meta": { + "properties": { + "requestGuid": true, + "timestamp": true, + "destination": true, + "source": { + "$ref": "../api/appIdentifier.schema.json" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/website/static/schemas/next/bridging/raiseIntentResponse.schema.json b/website/static/schemas/next/bridging/raiseIntentResponse.schema.json new file mode 100644 index 000000000..82398d3c3 --- /dev/null +++ b/website/static/schemas/next/bridging/raiseIntentResponse.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentResponse.schema.json", + "title": "RaiseIntentResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentResponse" + }, + "payload": { + "type": "object", + "properties": { + "intentResolution": { + "$ref": "../api/intentResolution.schema.json" + } + }, + "required": ["intentResolution"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + }, + "errorSources": { + "type": "array", + "items": { + "$ref": "../api/desktopAgentIdentifier.schema.json" + } + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/bridging/raiseIntentResultResponse.schema.json b/website/static/schemas/next/bridging/raiseIntentResultResponse.schema.json new file mode 100644 index 000000000..bcd88e3d4 --- /dev/null +++ b/website/static/schemas/next/bridging/raiseIntentResultResponse.schema.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/bridging/raiseIntentResultResponse.schema.json", + "title": "RaiseIntentResultResponse", + "type": "object", + "allOf": [ + { + "$ref": "bridgeResponse.schema.json" + }, + { + "type": "object", + "properties": { + "type": { + "const": "raiseIntentResultResponse" + }, + "payload": { + "type": "object", + "properties": { + "intentResult": { + "oneOf": [ + { + "type": "object", + "properties": { + "context": { + "$ref": "../context/context.schema.json" + } + }, + "required": ["context"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "channel": { + "$ref": "../api/channel.schema.json" + } + }, + "required": ["channel"], + "additionalProperties": false + } + ] + } + }, + "required": ["intentResult"], + "additionalProperties": false + }, + "meta": { + "type": "object", + "properties": { + "sources": { + "type": "array", + "items": { + "$ref": "../api/appIdentifier.schema.json" + } + } + } + } + } + } + ] +} diff --git a/website/static/schemas/next/chart.schema.json b/website/static/schemas/next/context/chart.schema.json similarity index 89% rename from website/static/schemas/next/chart.schema.json rename to website/static/schemas/next/context/chart.schema.json index ab541e70c..d5b493a7d 100644 --- a/website/static/schemas/next/chart.schema.json +++ b/website/static/schemas/next/context/chart.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/chart.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/chart.schema.json", "type": "object", "title": "Chart", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/chatInitSettings.schema.json b/website/static/schemas/next/context/chatInitSettings.schema.json similarity index 88% rename from website/static/schemas/next/chatInitSettings.schema.json rename to website/static/schemas/next/context/chatInitSettings.schema.json index 044068dbd..249fb7e76 100644 --- a/website/static/schemas/next/chatInitSettings.schema.json +++ b/website/static/schemas/next/context/chatInitSettings.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/chatInitSettings.schema.json", "type": "object", "title": "ChatInitSettings", "properties": { diff --git a/src/context/schemas/contact.schema.json b/website/static/schemas/next/context/contact.schema.json similarity index 83% rename from src/context/schemas/contact.schema.json rename to website/static/schemas/next/context/contact.schema.json index 154ed146f..6aef5f52e 100644 --- a/src/context/schemas/contact.schema.json +++ b/website/static/schemas/next/context/contact.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/contact.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/contact.schema.json", "type": "object", "title": "Contact", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/contactList.schema.json b/website/static/schemas/next/context/contactList.schema.json similarity index 81% rename from src/context/schemas/contactList.schema.json rename to website/static/schemas/next/context/contactList.schema.json index f09080f5c..57bf2a532 100644 --- a/src/context/schemas/contactList.schema.json +++ b/website/static/schemas/next/context/contactList.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/contactList.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/contactList.schema.json", "type": "object", "title": "ContactList", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/context.schema.json b/website/static/schemas/next/context/context.schema.json similarity index 62% rename from website/static/schemas/next/context.schema.json rename to website/static/schemas/next/context/context.schema.json index 8671df1a0..b14861b52 100644 --- a/website/static/schemas/next/context.schema.json +++ b/website/static/schemas/next/context/context.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/context.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/context.schema.json", "type": "object", "title": "Context", "properties": { @@ -8,8 +8,9 @@ "name": { "type": "string" }, "id": { "type": "object", - "additionalProperties": { "type": "string" } + "unevaluatedProperties": { "type": "string" } } }, + "additionalItems": true, "required": ["type"] } diff --git a/src/context/schemas/country.schema.json b/website/static/schemas/next/context/country.schema.json similarity index 86% rename from src/context/schemas/country.schema.json rename to website/static/schemas/next/context/country.schema.json index f29ae7611..2a0a6a763 100644 --- a/src/context/schemas/country.schema.json +++ b/website/static/schemas/next/context/country.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/country.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/country.schema.json", "type": "object", "title": "Country", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/currency.schema.json b/website/static/schemas/next/context/currency.schema.json similarity index 84% rename from website/static/schemas/next/currency.schema.json rename to website/static/schemas/next/context/currency.schema.json index 8d87f517a..aa0c08455 100644 --- a/website/static/schemas/next/currency.schema.json +++ b/website/static/schemas/next/context/currency.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/currency.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/currency.schema.json", "type": "object", "title": "Currency", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/email.schema.json b/website/static/schemas/next/context/email.schema.json similarity index 86% rename from src/context/schemas/email.schema.json rename to website/static/schemas/next/context/email.schema.json index a885680d9..4ec814dcf 100644 --- a/src/context/schemas/email.schema.json +++ b/website/static/schemas/next/context/email.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/email.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/email.schema.json", "type": "object", "title": "Email", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/instrument.schema.json b/website/static/schemas/next/context/instrument.schema.json similarity index 86% rename from website/static/schemas/next/instrument.schema.json rename to website/static/schemas/next/context/instrument.schema.json index 4127ed604..eee0f800f 100644 --- a/website/static/schemas/next/instrument.schema.json +++ b/website/static/schemas/next/context/instrument.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/instrument.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/instrument.schema.json", "type": "object", "title": "Instrument", "allOf": [{ "$ref": "context.schema.json#" }], @@ -27,8 +27,10 @@ "name": { "type": "string" }, "COUNTRY_ISOALPHA2": { "type": "string" }, "BBG": { "type": "string" } - } + }, + "unevaluatedProperties": { "type": "string" } } + }, "required": ["id"] } \ No newline at end of file diff --git a/src/context/schemas/instrumentList.schema.json b/website/static/schemas/next/context/instrumentList.schema.json similarity index 81% rename from src/context/schemas/instrumentList.schema.json rename to website/static/schemas/next/context/instrumentList.schema.json index 6aa927fd1..ceca78935 100644 --- a/src/context/schemas/instrumentList.schema.json +++ b/website/static/schemas/next/context/instrumentList.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/instrumentList.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/instrumentList.schema.json", "type": "object", "title": "InstrumentList", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/nothing.schema.json b/website/static/schemas/next/context/nothing.schema.json similarity index 73% rename from src/context/schemas/nothing.schema.json rename to website/static/schemas/next/context/nothing.schema.json index d13c3f05e..a7d67095e 100644 --- a/src/context/schemas/nothing.schema.json +++ b/website/static/schemas/next/context/nothing.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/nothing.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/nothing.schema.json", "type": "object", "title": "Nothing", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/organization.schema.json b/website/static/schemas/next/context/organization.schema.json similarity index 84% rename from src/context/schemas/organization.schema.json rename to website/static/schemas/next/context/organization.schema.json index 986eb9c96..7a791496e 100644 --- a/src/context/schemas/organization.schema.json +++ b/website/static/schemas/next/context/organization.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/organization.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/organization.schema.json", "type": "object", "title": "Organization", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/portfolio.schema.json b/website/static/schemas/next/context/portfolio.schema.json similarity index 81% rename from website/static/schemas/next/portfolio.schema.json rename to website/static/schemas/next/context/portfolio.schema.json index 69ee04e81..64202e02f 100644 --- a/website/static/schemas/next/portfolio.schema.json +++ b/website/static/schemas/next/context/portfolio.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/portfolio.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/portfolio.schema.json", "type": "object", "title": "Portfolio", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/src/context/schemas/position.schema.json b/website/static/schemas/next/context/position.schema.json similarity index 82% rename from src/context/schemas/position.schema.json rename to website/static/schemas/next/context/position.schema.json index 262cbbc95..e2a948aee 100644 --- a/src/context/schemas/position.schema.json +++ b/website/static/schemas/next/context/position.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/position.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/position.schema.json", "type": "object", "title": "Position", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/timerange.schema.json b/website/static/schemas/next/context/timerange.schema.json similarity index 86% rename from website/static/schemas/next/timerange.schema.json rename to website/static/schemas/next/context/timerange.schema.json index a17c5fbff..5b6b326f5 100644 --- a/website/static/schemas/next/timerange.schema.json +++ b/website/static/schemas/next/context/timerange.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/timerange.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/timerange.schema.json", "type": "object", "title": "TimeRange", "allOf": [{ "$ref": "context.schema.json#" }], diff --git a/website/static/schemas/next/valuation.schema.json b/website/static/schemas/next/context/valuation.schema.json similarity index 87% rename from website/static/schemas/next/valuation.schema.json rename to website/static/schemas/next/context/valuation.schema.json index e9a2f57ba..7ad55be71 100644 --- a/website/static/schemas/next/valuation.schema.json +++ b/website/static/schemas/next/context/valuation.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://fdc3.finos.org/schemas/next/valuation.schema.json", + "$id": "https://fdc3.finos.org/schemas/next/context/valuation.schema.json", "type": "object", "title": "Valuation", "allOf": [{ "$ref": "context.schema.json#" }],