Skip to content

Commit

Permalink
Update the Application schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeorgievx committed Aug 2, 2021
1 parent 0f240e8 commit 4ae6e31
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 30 deletions.
71 changes: 41 additions & 30 deletions src/app-directory/specification/appd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,6 @@ paths:
The same appName could occur in other directories. We are not
currently specifying app name conventions in the document.
- in: query
name: manifest
schema:
type: string
required: false
description: >
URI or full JSON of the application manifest providing all details related to launch
and use requirements as described by the vendor.
The format of this manifest is vendor specific, but can be identified by
the manifestType attribute.
- in: query
name: version
schema:
Expand Down Expand Up @@ -204,7 +193,7 @@ paths:
$ref: '#/components/schemas/ErrorDTO'
tags:
- Application

servers:
- url: /appd
components:
Expand All @@ -227,14 +216,13 @@ components:
Defines an application retrieved from an FDC3 App Directory, which can
then be launched.
Launching typically means running for a user on a desktop.
Launching typically means running for a user on a desktop.
The details around 'launching' including who or what might do it, and how the launch action is initiated are
discussed elsewhere in the FDC3 App Directory spec.
required:
required: # details are not required as the host type applications use the hostsManifests mapping instead
- appId
- name
- manifest
- manifestType
- type
properties:
appId:
type: string
Expand All @@ -252,19 +240,14 @@ components:
The same appName could occur in other directories. We are not
currently specifying app name conventions in the document.
manifest:
type: string
description: >
URI or full JSON of the application manifest providing all details related to launch
and use requirements as described by the vendor.
The format of this manifest is vendor specific, but can be identified by
the manifestType attribute.
manifestType:
type: string
description: >
The manifest type which relates to the format and structure of the manifest content.
The definition is based on the vendor specific format and definition outside of this specification.
type:
$ref: '#/components/schemas/Type'
details:
description: >-
The type specific details of the application. Currently only the browser application type is officially supported.
Host type applications should use the hostManifests object for all application details.
oneOf:
- $ref: '#/components/schemas/BrowserDetails'
version:
type: string
description: >-
Expand Down Expand Up @@ -323,6 +306,8 @@ components:
https://github.com/FDC3/Intents/blob/master/src/Intent.yaml
items:
$ref: '#/components/schemas/Intent'
hostManifests:
$ref: '#/components/schemas/HostManifest'
ApplicationSearchResponse:
properties:
applications:
Expand Down Expand Up @@ -380,10 +365,36 @@ components:
items:
type: string
description: >-
A comma sepaarted list of the types of contexts the intent offered by the application can process.
A comma sepaarted list of the types of contexts the intent offered by the application can process.
where the first part of the context type is the namespace e.g."fdc3.contact, org.symphony.contact"
customConfig:
type: object
description: >-
Custom configuration for the intent that may be required for a
particular desktop agent.
Type:
type: string
description: >-
Enumeration describing the supported application types. Currently only the browser application type is officially supported.
The host application type allows for host specific application types (e.g. exe, workspaces, citrix, etc.).
enum:
- browser
- host
BrowserDetails:
description: Common properties toq all browser applications.
required:
- url
properties:
url:
type: string
description: Application URL.
additionalProperties: false
HostManifest:
type: object
description: >-
A mapping from host string to host specific application manifest object or URI
providing all details related to launch and use requirements as described by the host..
additionalProperties:
oneOf:
- type: string # URI pointing to a JSON containing all host specific properties
- type: object # object containing all host specific properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
appId: 'fdc3-tradingview-chart-orig',
name: 'FDC3 TradingView Chart (orig)',
type: 'browser',
details: {
url: 'https://appd.kolbito.com/demos/tradingview-chart/index.html'
},
hostManifests: {
Glue42: {
type: 'window',
icon: 'https://fdc3.finos.org/docs/assets/fdc3-logo.png',
details: {
height: 640,
width: 560,
left: 120,
top: 120,
mode: 'tab',
allowChannels: true,
loader: {
enabled: true,
hideOnLoad: true
}
},
customProperties: {
folder: 'FDC3 Orig'
}
}
},
intents: [
{
name: 'fdc3.ViewChart',
displayName: 'View Chart',
contexts: [
'fdc3.instrument'
]
}
]
};
25 changes: 25 additions & 0 deletions src/app-directory/specification/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const SwaggerParser = require('@apidevtools/swagger-parser');
const { Validator } = require('jsonschema');
const assert = require('assert');
const exampleApplication = require('../examples/application/fdc3-tradingview-chart-orig');

(async () => {
try {
const api = await SwaggerParser.validate('../appd.yaml');

console.log(`API name: ${api.info.title}, Version: ${api.info.version}`);

const applicationSchema = api.components.schemas.Application;

const v = new Validator();

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

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

console.log('Successfully validated the specification and example application definition!');
}
catch (error) {
console.log(error.message || error);
}
})();
Loading

0 comments on commit 4ae6e31

Please sign in to comment.