Skip to content

Commit

Permalink
Migrating docs to schemas for another 10 context types + adjusting in…
Browse files Browse the repository at this point in the history
…strument's format
  • Loading branch information
kriswest committed Jul 26, 2023
1 parent 0d2fffd commit 370565f
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 202 deletions.
15 changes: 7 additions & 8 deletions docs/context/ref/Action.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ hide_title: true
---
# `Action`

A representation of an FDC3 Action (specified via a Context or Context & Intent) that can be inserted inside another object,
for example a chat message.
A representation of an FDC3 Action (specified via a Context or Context & Intent) that can be inserted inside another object, for example a chat message.

The action may be completed by calling `fdc3.raiseIntent()` with the specified Intent and Context, or, if only a context is specified, by calling `fdc3.raiseIntentForContext()` (which the Desktop Agent will resolve by presenting the user with a list of available Intents for the Context).

Accepts an optional `app` parameter in order to specify a certain app.
Accepts an optional `app` parameter in order to specify a specific app.

## Type

`fdc3.action`

## Schema

https://fdc3.finos.org/schemas/next/action.schema.json
<https://fdc3.finos.org/schemas/next/action.schema.json>

## Details

Expand All @@ -33,8 +32,6 @@ https://fdc3.finos.org/schemas/next/action.schema.json
| `app.appId` | string | Yes | `'app1'` |
| `app.instanceId` | string | No | `'instance1'` |



## Example

```js
Expand Down Expand Up @@ -69,7 +66,9 @@ const action = {
## See Also

Other Types
* [Message](Message)

- [Message](Message)

Intents
* [StartChat](../../intents/ref/StartChat)

- [StartChat](../../intents/ref/StartChat)
2 changes: 1 addition & 1 deletion docs/context/ref/ChatInitSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const initSettings = {
isPublic: false, // private chat room
allowHistoryBrowsing: true,
allowMessageCopy: true
}
},
message: {
type: 'fdc3.message',
text: {
Expand Down
2 changes: 1 addition & 1 deletion docs/context/ref/ChatMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A context representing a chat message. Typically used to send the message or to

## Schema

- https://fdc3.finos.org/schemas/next/chatMessage.schema.json
<https://fdc3.finos.org/schemas/next/chatMessage.schema.json>

## Details

Expand Down
4 changes: 2 additions & 2 deletions docs/context/ref/ChatRoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ hide_title: true
---
# `ChatRoom`

Reference to the chat room(s) (which could be used later to send a message to the room(s)).
Reference to the chat room, which could be used later to send a message to the room.

## Type

`fdc3.chat.room`

## Schema

https://fdc3.finos.org/schemas/next/chatRoom.schema.json
<https://fdc3.finos.org/schemas/next/chatRoom.schema.json>

## Details

Expand Down
80 changes: 56 additions & 24 deletions src/context/schemas/action.schema.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,67 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/action.schema.json",
"type": "object",
"title": "Action",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.action" },
"title": {
"type": "string"
},
"intent": {
"type": "string",
"$comment": "Should reference an intent type name, such as those defined in the FDC3 Standard'"
},
"context": {
"type": "object",
"$ref": "context.schema.json#"
},
"app": {
"description": "A representation of an FDC3 Action (specified via a Context or Context & Intent) that can be inserted inside another object, for example a chat message.\n\nThe action may be completed by calling `fdc3.raiseIntent()` with the specified Intent and Context, or, if only a context is specified, by calling `fdc3.raiseIntentForContext()` (which the Desktop Agent will resolve by presenting the user with a list of available Intents for the Context).\n\nAccepts an optional `app` parameter in order to specify a specific app.",
"allOf": [{
"type": "object",
"properties": {
"appId": { "type": "string" },
"instanceId": { "type": "string" }
"type": { "const": "fdc3.action" },
"title": {
"title": "Title",
"description": "A human readable display name for the action",
"type": "string"
},
"intent": {
"title": "Action Intent",
"description": "Optional Intent to raise to perform the actions. Should reference an intent type name, such as those defined in the FDC3 Standard. If intent is not set then `fdc3.raiseIntentForContext` should be used to perform the action as this will usually allow the user to choose the intent to raise.",
"type": "string"
},
"context": {
"title": "Action Context",
"description": "A context object with which the action will be performed",
"$ref": "context.schema.json#"
},
"app": {
"title": "Target App",
"description": "An optional target application identifier that should perform the action",
"allOf": [
{ "$ref": "../api/AppIdentifier.schema.json" }
]
}
},
"required": ["appId"]
"required": [
"title", "context"
]
},
"customConfig": {
"type": "object"
{ "$ref": "context.schema.json#" }
],
"examples": [
{
"type": "fdc3.action",
"title": "Click to view Chart",
"intent": "ViewChart",
"context" {
"type": "fdc3.chart",
"instruments": [
{
"type": "fdc3.instrument",
"id": {
"ticker": "EURUSD"
}
}
],
"range": {
"type": "fdc3.dateRange",
"starttime": "2020-09-01T08:00:00.000Z",
"endtime": "2020-10-31T08:00:00.000Z"
},
"style": "candle"
},
"app" {
"appId": "MyChartViewingApp",
"instanceId": "instance1"
}
}
},
"required": [
"title", "context"
]
}
103 changes: 80 additions & 23 deletions src/context/schemas/chart.schema.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,87 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chart.schema.json",
"type": "object",
"title": "Chart",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chart" },
"instruments": {
"type": "array",
"items": {
"$ref": "instrument.schema.json#"
}
"description": "A context type representing details of a Chart, which may be used to request plotting of a particular chart or to otherwise share details of its composition, such as:\n\n- A list of instruments for comparison\n- The time period to plot the chart over\n- The style of chart (line, bar, mountain, candle etc.)\n- Other settings such as indicators to calculate, or data representing drawings and annotations.\n\nIn addition to handling requests to plot charts, a charting application may use this type to output a representation of what it is currently displaying so that it can be recorded by another application.",
"allOf": [{
"type": "object",
"properties": {
"type": { "const": "fdc3.chart" },
"instruments": {
"title": "Instruments to plot",
"description": "An array of instrument contexts whose data should be plotted.",
"type": "array",
"items": {
"$ref": "instrument.schema.json#"
}
},
"range": {
"title": "Time Range",
"description": "The time range that should be plotted",
"allOf": [{
"$ref": "timerange.schema.json#"
}]
},
"style": {
"title": "Chart style",
"description": "The type of chart that should be plotted",
"type": "string",
"enum": [ "line", "bar", "stacked-bar", "mountain", "candle", "pie", "scatter", "histogram", "heatmap", "custom"]
},
"otherConfig": {
"title": "Other configuration",
"description": "It is common for charts to support other configuration, such as indicators, annotations etc., which do not have standardized formats, but may be included in the `otherConfig` array as context objects.",
"type": "array",
"items": {
"$ref": "context.schema.json#"
}
}
},
"required": ["instruments"]
},
"range": {
"$ref": "timerange.schema.json#"
},
"style": {
"type": "string",
"enum": [ "line", "bar", "stacked-bar", "mountain", "candle", "pie", "scatter", "histogram", "heatmap", "custom"]
},
"otherConfig": {
"type": "array",
"items": {
"$ref": "context.schema.json#"
}
{ "$ref": "context.schema.json#" }
],
"examples": [
{
"type": "fdc3.chart",
"instruments": [
{
"type": "fdc3.instrument",
"id": {
"ticker": "AAPL"
}
},
{
"type": "fdc3.instrument",
"id": {
"ticker": "GOOG"
}
}
],
"range": {
"type": "fdc3.timeRange",
"startTime": "2020-09-01T08:00:00.000Z",
"endTime": "2020-10-31T08:00:00.000Z"
},
"style": "line",
"otherConfig": [
{
"type": "somevendor.someproduct.indicator",
"name": "stddev",
"parameters": {
"period": 10,
"matype": "exponential"
}
},
{
"type": "someothervendor.someotherproduct.formula",
"formula": "standard-deviation",
"fields": {
"lookback": 10,
"type": "ema"
}
}
]
}
},
"required": ["instruments"]
]
}
Loading

0 comments on commit 370565f

Please sign in to comment.