Skip to content

Commit

Permalink
Merge pull request #1252 from finos/1068-context-docs-generation
Browse files Browse the repository at this point in the history
1068 context docs generation
  • Loading branch information
kriswest authored Jul 22, 2024
2 parents aaa2a80 + 14c04ab commit dd90535
Show file tree
Hide file tree
Showing 60 changed files with 5,113 additions and 3,964 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
dist/
dist/
/website/schema2Markdown.js
117 changes: 67 additions & 50 deletions docs/context/ref/Action.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,91 @@
---
id: Action
sidebar_label: Action
title: Action
hide_title: true
sidebar_label: Action

---
# `Action`

# 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.

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 specific app.

## Schema

<https://fdc3.finos.org/schemas/next/context/action.schema.json> ([github](https://github.com/finos/FDC3/tree/main/schemas/context/action.schema.json))

## Type

`fdc3.action`

## Schema
## Properties

<https://fdc3.finos.org/schemas/next/context/action.schema.json>
<details>
<summary><code>title</code> <strong>(required)</strong></summary>

## Details
**type**: `string`

| Property | Type | Required | Example Value |
|-------------------|-------------------------------------------|----------|-------------------------|
| `type` | string | Yes | `'fdc3.action'` |
| `title` | string | Yes | `'Click to view Chart'` |
| `intent` | string | No | `'ViewChart'` |
| `context` | string | Yes | See Below |
| `app` | object | No | `'myApp'` |
| `app.appId` | string | Yes | `'app1'` |
| `app.instanceId` | string | No | `'instance1'` |
A human readable display name for the action

## Example
</details>

```js
const action = {
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'
}
}
```
<details>
<summary><code>intent</code></summary>

**type**: `string`

## See Also
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.

Other Types
</details>

- [Message](Message)
<details>
<summary><code>context</code> <strong>(required)</strong></summary>

Intents
**type**: [Context](/docs/next/context/spec#the-context-interface)

A context object with which the action will be performed

</details>

<details>
<summary><code>app</code></summary>

**type**: api/AppIdentifier

An optional target application identifier that should perform the action

</details>

## Example

```json
{
"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"
}
}
```

- [StartChat](../../intents/ref/StartChat)
32 changes: 32 additions & 0 deletions docs/context/ref/BaseContext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: BaseContext
sidebar_label: BaseContext

---

# BaseContext

## Schema

<https://github.com/finos/FDC3/tree/main/schemas/context/context.schema.json>

## Type

`undefined`

## Properties

<details>
<summary><code>name</code></summary>

**type**: `string`

</details>

<details>
<summary><code>id</code></summary>

**type**: `object`

</details>

174 changes: 104 additions & 70 deletions docs/context/ref/Chart.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,133 @@
---
id: Chart
sidebar_label: Chart
title: Chart
hide_title: true
sidebar_label: Chart

---
# `Chart`

# Chart

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:

- A list of instruments for comparison
- The time period to plot the chart over
- The style of chart (line, bar, mountain, candle etc.)
- Other settings such as indicators to calculate, or data representing drawings and annotations
- Other settings such as indicators to calculate, or data representing drawings and annotations.

In 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.

## Schema

<https://fdc3.finos.org/schemas/next/context/chart.schema.json> ([github](https://github.com/finos/FDC3/tree/main/schemas/context/chart.schema.json))

## Type

`fdc3.chart`

## Schema
## Properties

<https://fdc3.finos.org/schemas/next/context/chart.schema.json>
<details>
<summary><code>instruments</code> <strong>(required)</strong></summary>

## Details
**type**: `array`

| Property | Type | Required | Example Value |
|------------------|-----------------|----------|----------------------|
| `type` | string | Yes | `'fdc3.chart'` |
| `instruments` | Instrument[] | Yes | <pre>[<br/>&emsp;&emsp;{<br/>&emsp;&emsp;&emsp;&emsp;"type": "fdc3.instrument",<br/>&emsp;&emsp;&emsp;&emsp;"id": {<br/>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;"ticker": "AAPL"<br/>&emsp;&emsp;&emsp;&emsp;}<br/>&emsp;&emsp;},<br/>&emsp;&emsp;{<br/>&emsp;&emsp;&emsp;&emsp;"type": "fdc3.instrument",<br/>&emsp;&emsp;&emsp;&emsp;"id": {<br/>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;"ticker": "MSFT"<br/>&emsp;&emsp;&emsp;&emsp;}<br/>&emsp;&emsp;}<br/>]</pre> |
| `range` | TimeRange | No | <pre>{<br/>&emsp;&emsp;"type": "fdc3.timeRange",<br/>&emsp;&emsp;"startTime": "2022-03-30T15:44:44+00:00",<br/>&emsp;&emsp;"endTime": "2022-04-30T23:59:59+00:00"<br/>}</pre> |
| `style` | string | No | one of: `'line'`, `'bar'`, `'stacked-bar'`, `'mountain'`, `'candle'`, `'pie'`, `'scatter'`, `'histogram'`, `'heatmap'`, `'custom'` |
| `otherConfig`* | array | No | `[ {/* additional config context objects */} ]` |
<details>
<summary><code>Items</code></summary>

::: info
**type**: [Instrument](Instrument)

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.
</details>

:::
An array of instrument contexts whose data should be plotted.

## Example
</details>

```js
const chart = {
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"
}
}
]
};

fdc3.raiseIntent("ViewChart", chart);
```
<details>
<summary><code>range</code></summary>

**type**: [TimeRange](TimeRange)

The time range that should be plotted

</details>

## See Also
<details>
<summary><code>style</code></summary>

Other Types
**type**: `string` with values:
- `line`,
- `bar`,
- `stacked-bar`,
- `mountain`,
- `candle`,
- `pie`,
- `scatter`,
- `histogram`,
- `heatmap`,
- `custom`

- [Instrument](Instrument)
- [TimeRange](TimeRange)
The type of chart that should be plotted

Intents
</details>

<details>
<summary><code>otherConfig</code></summary>

**type**: `array`

<details>
<summary><code>Items</code></summary>

**type**: [Context](/docs/next/context/spec#the-context-interface)

</details>

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.

</details>

## Example

```json
{
"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"
}
}
]
}
```

- [ViewChart](../../intents/ref/ViewChart)
Loading

0 comments on commit dd90535

Please sign in to comment.