Skip to content

Commit

Permalink
Merge pull request #1034 from InteropIO/1033-correct-appd-schema-error
Browse files Browse the repository at this point in the history
Correct issue in appd details field's schema, error in example and improve test
  • Loading branch information
kriswest authored Jul 25, 2023
2 parents 23f9a8e + 01f9c6d commit 51ab6ec
Show file tree
Hide file tree
Showing 7 changed files with 362 additions and 143 deletions.
6 changes: 3 additions & 3 deletions src/app-directory/specification/appd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ components:
The type specific launch details of the application. These details are intended to be
vendor-agnostic and MAY be duplicated or overridden by details provided in the hostManifests
object for a specific host.
oneOf:
anyOf:
- $ref: '#/components/schemas/WebAppDetails'
- $ref: '#/components/schemas/NativeAppDetails'
- $ref: '#/components/schemas/CitrixAppDetails'
Expand Down Expand Up @@ -1209,8 +1209,8 @@ components:
screenshots:
- src: https://fdc3.finos.org/docs/assets/fdc3-logo.png,
label: FDC3 logo
contactEmail: fdc3@finos.org,
supportEmail: fdc3-maintainers@finos.org,
contactEmail: fdc3@finos.org
supportEmail: fdc3-maintainers@finos.org
publisher: FDC3,
type: web
details:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,28 @@
"name": "fdc3-workbench",
"title": "FDC3 Workbench",
"description": "Development and test tool for FDC3 desktop agents and apps",
"categories": [
"developer tools",
"training"
],
"version": "1.0.0",
"tooltip": "FDC3 Workbench",
"lang": "en-US",
"icons": [
{
"src": "http://fdc3.finos.org/toolbox/fdc3-workbench/fdc3-icon-256.png"
}
],
"images": [
"screenshots": [
{
"url": "https://fdc3.finos.org/docs/assets/fdc3-logo.png",
"tooltip": "FDC3 logo"
"src": "https://fdc3.finos.org/docs/assets/fdc3-logo.png",
"label": "FDC3 logo"
}
],
"contactEmail": "fdc3@finos.org",
"supportEmail": "fdc3-maintainers@finos.org",
"publisher": "FDC3",
"intents": [
{
"name": "ViewChart",
"displayName": "View Chart",
"contexts": [
"fdc3.instrument"
]
}
],
"type": "browser",
"publisher": "FDC3,",
"type": "web",
"details": {
"url": "https://fdc3.finos.org/toolbox/fdc3-workbench/"
},
Expand Down Expand Up @@ -81,5 +77,11 @@
}
},
"Web App Manifest": "https://example.com/fdc3-workbench.json"
},
"localizedVersions": {
"fr-FR": {
"title": "FDC3 Table de travail",
"description": "Outil de développement et de test pour les desktop agents et applications FDC3"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"appId": "my-application",
"name": "my-application",
"title": "My Application",
"description": "An example application that uses FDC3 and fully describes itself in an AppD record.",
"categories": [
"market data",
"research",
"news"
],
"version": "1.0.0",
"tooltip": "My example application definition",
"lang": "en-US",
"icons": [
{
"src": "http://example.domain.com/assets/my-app-icon.png",
"size": "256x256",
"type": "image/png"
}
],
"screenshots": [
{
"src": "http://example.domain.com/assets/my-app-screenshot-1.png",
"label": "The first screenshot of my example app",
"type": "image/png",
"size": "800x600"
},
{
"src": "http://example.domain.com/assets/my-app-screenshot-2.png",
"label": "The second screenshot of my example app",
"type": "image/png",
"size": "800x600"
}
],
"contactEmail": "fdc3@finos.org",
"supportEmail": "fdc3-maintainers@finos.org",
"moreInfo": "http://example.domain.com/",
"publisher": "Example App, Inc.",
"type": "web",
"details": {
"url": "http://example.domain.com/app.html"
},
"hostManifests": {
"Finsemble": {
"window": {
"left": 120,
"top": 120,
"width": 600,
"height": 800,
"options": {
"minWidth": 75
}
},
"foreign": {
"components": {
"App Launcher": {
"launchableByUser": true
},
"Window Manager": {
"FSBLHeader": true,
"persistWindowState": true
}
}
},
"interop": {
"autoConnect": true
}
},
"Glue42": {
"type": "window",
"details": {
"height": 800,
"width": 600,
"left": 120,
"top": 120,
"mode": "tab",
"allowChannels": true,
"loader": {
"enabled": true,
"hideOnLoad": true
}
},
"customProperties": {
"folder": "FDC3 Toolbox"
}
},
"Web App Manifest": "http://example.domain.com/my-app.json"
},
"interop": {
"intents": {
"listensFor": {
"ViewChart": {
"displayName": "View Chart",
"contexts": [
"fdc3.instrument"
]
},
"myApp.GetPrice": {
"displayName": "Get Price",
"contexts": [
"fdc3.instrument"
],
"resultType": "myApp.quote"
}
},
"raises": {
"ViewOrders": [
"fdc3.instrument",
"fdc3.organization"
],
"StartEmail": [
"fdc3.email"
]
}
},
"userChannels": {
"broadcasts": [
"fdc3.instrument",
"fdc3.organization"
],
"listensFor": [
"fdc3.instrument",
"fdc3.organization"
]
},
"appChannels": [
{
"id": "myApp.quotes,",
"description": "Used to share a stream of quotes for currently displayed instrument and may be used to change the currently displayed symbol,",
"broadcasts": [
"myApp.quote"
],
"listensFor": [
"fdc3.instrument"
]
}
]
},
"localizedVersions": {
"fr-FR": {
"title": "Mon application,",
"description": "Un exemple d'application qui utilise FDC3 et se décrit entièrement dans un enregistrement AppD."
}
}
}
25 changes: 20 additions & 5 deletions src/app-directory/specification/test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const SwaggerParser = require('@apidevtools/swagger-parser');
const { Validator } = require('jsonschema');
const assert = require('assert');
const exampleApplication = require('../examples/application/fdc3-workbench.json');
const exampleApplication1 = require('../examples/application/myApplication.json');
const exampleApplication2 = require('../examples/application/fdc3-workbench.json');

(async () => {
try {
Expand All @@ -11,16 +12,30 @@ const exampleApplication = require('../examples/application/fdc3-workbench.json'

const applicationSchema = api.components.schemas.Application;

console.log("Setting up the validator...");
const v = new Validator();

const validatorResult = v.validate(exampleApplication, applicationSchema);

console.log("\nValidating the first example: myApplication.json");
const validatorResult1 = v.validate(exampleApplication1, applicationSchema);

assert(
validatorResult.valid,
`The example application definition does not comply with the Application schema: ${validatorResult.errors}`
validatorResult1.valid,
`The example application definition does not comply with the Application schema: ${validatorResult1.errors}`
);

console.log('Successfully validated the specification and the example application definition!');
console.log('Successfully validated the specification and the first example application definition!');

console.log("\nValidating the second example: fdc3-workbench.json");
const validatorResult2 = v.validate(exampleApplication2, applicationSchema);

assert(
validatorResult2.valid,
`The example application definition does not comply with the Application schema: ${validatorResult2.errors}`
);

console.log('Successfully validated the specification and the second example application definition!');

} catch (error) {
console.log(error.message || error);
}
Expand Down
Loading

0 comments on commit 51ab6ec

Please sign in to comment.