Skip to content

Commit 895d21e

Browse files
authored
feat: Adding Cloud Events to Miranum API docs (#19)
* Feat: Adding Cloud Events to our API Docu * Fix: Incorporate feedback from PR * feat: update cloud-events docu generation process in readme
1 parent 8abd88e commit 895d21e

36 files changed

+954
-288
lines changed

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,41 @@ We also want to ensure a unified naming of our product components. Hence, please
2424
### Local Development
2525
`npm run start`
2626

27-
### Troubleshooting checklist
27+
### Troubleshooting Checklist
2828
Have you pulled latest from `main`?
2929
Have you run npm install? When we update dependencies in the project, they don't automatically get updated in your environment.
3030
You'll need to run npm install occasionally to acquire dependency updates locally.
3131

32+
### Cloud Events Documentation
33+
We generate the cloud events documentation from the `schema.json` files stored in the [static folder](./docs/apis/static/schemas).
34+
For that purpose we use the [Docusaurus-JSON-Schema-Plugin](https://jy95.github.io/docusaurus-json-schema-plugin/). If you want to
35+
update a schema file you simply need to replace the outdated one. In case you want to add a new one, make sure to to create a new
36+
`.mdx` file in the [cloud-events](./docs/apis/cloud-events) folder of the API documentation besides of adding the `schema.json`.
37+
Import the new schema and add import the Docusaurus-JSON-Schema-Plugin via:
38+
39+
```
40+
import Schema from "../../static/schemas/bpmn/command/xyz.schema.json";
41+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
42+
43+
# <CommandName>
44+
<JSONSchemaViewer schema={ Schema } />
45+
46+
# Source:
47+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
48+
```
49+
50+
### Creating new files
51+
If you have created a new file for the documentation you always need to make sure that it contains a proper header:
52+
```
53+
---
54+
id: cloud-events-overview
55+
title: Cloud Events Overview
56+
sidebar_label: Overview
57+
description: "This section provides an overview of the different Cloud Event commands which are supported by Miranum Connect."
58+
---
59+
```
60+
If the page should show up in the sidebar it needs to be added to the [sidebar.js](./sidebars.js). By default, this should always be the case.
61+
3262
## Configuration
3363
This documentation is built using [Docusaurus 2](https://docusaurus.io), a modern static website generator.
3464
The framework is well documented and is used by many (open source) projects.

docs/apis/api-overview.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
---
22
id: api-overview
3-
title: Overview of the APIs
4-
sidebar_label: Overview APIs and Clients
3+
title: API Overview
4+
sidebar_label: APIs and Clients Overview
55
description: "This section contains information about the different APIs and Clients to use with Miranum."
66
---
77

8-
Coming Soon!
8+
This section contains all information about the different APIs and Clients which can be used with the **Miranum Connect**
9+
Framework.
10+
11+
In the subsections you will be able to find:
12+
* [Cloud Events Specifications](./cloud-events/cloud-events-overview.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
id: cloud-events-overview
3+
title: Cloud Events Overview
4+
sidebar_label: Overview
5+
description: "This section provides an overview of the different Cloud Event commands which are supported by Miranum Connect."
6+
---
7+
# Overview
8+
9+
:::::info
10+
CloudEvents is a [specification](https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md) for describing event
11+
data in a common way. CloudEvents seeks to dramatically simplify event declaration and delivery across services, platforms, and beyond!
12+
13+
CloudEvents is a new effort, and it's still under active development.
14+
However, its working group has received a surprising amount of industry interest, ranging from major cloud providers to
15+
popular SaaS companies. The specification is now under the [Cloud Native Computing Foundation](https://cncf.io/).
16+
:::::
17+
18+
**Miranum Connect** uses this standard to enable other software components to use its functionality / APIs.
19+
The schema of currently available cloud events is documented in the [Commands](./commands/ActivateJobsRequests) subsection.
20+
21+
:::note
22+
The gateway which will be able to consume the Cloud Events is still under development.
23+
:::
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/ActivateJobsRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# ActivateJobsRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/ActivateJobsResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# ActivateJobsResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CancelProcessInstanceRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CancelProcessInstanceRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CancelProcessInstanceResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CancelProcessInstanceResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CompleteJobRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CompleteJobRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CompleteJobResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CompleteJobResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CreateProcessInstanceRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CompleteProcessInstanceRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/CreateProcessInstanceResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# CreateProcessInstanceResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/DeployResourceRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# DeployResourceRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/DeployResourceResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# DeployResourceResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/FailJobRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# FailJobRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/FailJobResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# FailJobResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/PublishMessageRequest.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# PublishMessageRequest
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import CodeBlock from '@theme/CodeBlock';
2+
import Schema from "../../static/schemas/bpmn/command/PublishMessageResponse.schema.json";
3+
import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer";
4+
5+
# PublishMessageResponse
6+
7+
<JSONSchemaViewer schema={ Schema } />
8+
9+
# Source:
10+
11+
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$id": "io.miranum.bpmn.command.v1.ActivateJobsRequest",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"type": "object",
5+
"properties": {
6+
"type": {
7+
"description": "the job type, as defined in the BPMN process",
8+
"type": "string"
9+
},
10+
"worker": {
11+
"description": "the name of the worker activating the jobs, mostly used for logging purposes",
12+
"type": "string"
13+
},
14+
"timeout": {
15+
"description": "a job returned after this call will not be activated by another call until the\ntimeout (in ms) has been reached",
16+
"type": "number"
17+
},
18+
"maxJobsToActivate": {
19+
"description": "the maximum jobs to activate by this request",
20+
"type": "number"
21+
},
22+
"fetchVariable": {
23+
"description": "a list of variables to fetch as the job variables; if empty, all visible variables at\nthe time of activation for the scope of the job will be returned",
24+
"type": "array",
25+
"items": {
26+
"type": "string"
27+
}
28+
},
29+
"requestTimeout": {
30+
"description": "The request will be completed when at least one job is activated or after the requestTimeout (in ms).\nif the requestTimeout = 0, a default timeout is used.\nif the requestTimeout < 0, long polling is disabled and the request is completed immediately, even when no job is activated.",
31+
"type": "number"
32+
}
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"$id": "io.miranum.bpmn.command.v1.ActivateJobsResponse",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"type": "object",
5+
"properties": {
6+
"jobs": {
7+
"description": "list of activated jobs",
8+
"type": "array",
9+
"items": {
10+
"$ref": "#/definitions/ActivatedJob"
11+
}
12+
}
13+
},
14+
"definitions": {
15+
"ActivatedJob": {
16+
"type": "object",
17+
"properties": {
18+
"key": {
19+
"description": "the key, a unique identifier for the job",
20+
"type": "number"
21+
},
22+
"type": {
23+
"description": "the type of the job (should match what was requested)",
24+
"type": "string"
25+
},
26+
"processInstanceKey": {
27+
"description": "the job's process instance key",
28+
"type": "number"
29+
},
30+
"bpmnProcessId": {
31+
"description": "the bpmn process ID of the job process definition",
32+
"type": "string"
33+
},
34+
"processDefinitionVersion": {
35+
"description": "the version of the job process definition",
36+
"type": "number"
37+
},
38+
"processDefinitionKey": {
39+
"description": "the key of the job process definition",
40+
"type": "number"
41+
},
42+
"elementId": {
43+
"description": "the associated task element ID",
44+
"type": "string"
45+
},
46+
"elementInstanceKey": {
47+
"description": "the unique key identifying the associated task, unique within the scope of the\nprocess instance",
48+
"type": "number"
49+
},
50+
"customHeaders": {
51+
"description": "a set of custom headers defined during modelling; returned as a serialized\nJSON document",
52+
"type": "string"
53+
},
54+
"worker": {
55+
"description": "the name of the worker which activated this job",
56+
"type": "string"
57+
},
58+
"retries": {
59+
"description": "the amount of retries left to this job (should always be positive)",
60+
"type": "number"
61+
},
62+
"deadline": {
63+
"description": "when the job can be activated again, sent as a UNIX epoch timestamp",
64+
"type": "number"
65+
},
66+
"variables": {
67+
"description": "JSON document, computed at activation time, consisting of all visible variables to\nthe task scope",
68+
"type": "string"
69+
}
70+
}
71+
}
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "io.miranum.bpmn.command.v1.CancelProcessInstanceRequest",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"type": "object",
5+
"properties": {
6+
"processInstanceKey": {
7+
"description": "the process instance key (as, for example, obtained from\nCreateProcessInstanceResponse)",
8+
"type": "number"
9+
}
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$id": "io.miranum.bpmn.command.v1.CancelProcessInstanceResponse",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"type": "object"
5+
}

0 commit comments

Comments
 (0)