-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components proposal #51
Changes from 14 commits
a408a36
6a42a02
254b277
b7844a0
9fbf292
dd367b9
d556b2b
5946142
c627f16
9d45822
9f553c8
27b3bfa
d965fbb
f810363
d0d9015
d59e165
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,12 @@ The Workflows Specification can articulate these workflows in a human and machin | |
- [Failure Action Object](#failure-action-object) | ||
- [Fixed Fields](#fixed-fields-7) | ||
- [Failure Action Object Example](#failure-action-object-example) | ||
- [Component Object](#component-object) | ||
- [Fixed Fields](#fixed-fields-8) | ||
- [Component Object Example](#component-object-example) | ||
- [Reference Object](#reference-object) | ||
- [Fixed Fields](#fixed-fields-9) | ||
- [Reference Object Example](#reference-object-example) | ||
- [Runtime Expressions](#runtime-expressions) | ||
- [Specification Extensions](#specification-extensions) | ||
- [Appendix A: Revision History](#appendix-a-revision-history) | ||
|
@@ -121,6 +127,7 @@ Field Name | Type | Description | |
<a name="workflowsInfo"></a>info | [Info Object](#info-object) | **REQUIRED**. Provides metadata about the Workflows. The metadata MAY be used by tooling as required. | ||
<a name="workflowsSources"></a>sources | [[Source Object](#source-object)] | **REQUIRED**. A list of source documents (such as an OpenAPI document) this workflow SHALL apply to. The list MUST have at least one entry. | ||
<a name="workflows"></a>workflows | [[Workflow Object](#workflow-object)] | **REQUIRED**. A list of workflows. The list MUST have at least one entry. | ||
<a name="components"></a>components | [Component Object](#component-object) | An element to hold various schemas for the document. | ||
|
||
This object MAY be extended with [Specification Extensions](#specification-extensionsxtensions). | ||
|
||
|
@@ -250,8 +257,8 @@ Field Name | Type | Description | |
<a name="workflowId"></a>workflowId | `string` | **REQUIRED**. Unique string to represent the workflow. The id MUST be unique amongst all workflows describe in the Workflows document. The `workflowId` value is **case-sensitive**. Tools and libraries MAY use the `workflowId` to uniquely identify a workflow, therefore, it is RECOMMENDED to follow common programming naming conventions. | ||
<a name="workflowSummary"></a>summary | `string` | A summary of the purpose or objective of the workflow. | ||
<a name="workflowDescription"></a>description | `string` | A description of the workflow. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. | ||
<a name="workflowInputs"></a>inputs | `JSON Schema` | A JSON Schema object representing the input parameters used by this workflow | ||
<a name="workflowSteps"></a>steps | [[Step Object](#step-object)] | **REQUIRED**. An ordered list of steps where each step represents a call to an API operation or to another workflow | ||
<a name="workflowInputs"></a>inputs | `JSON Schema` | A JSON Schema 2020-12 object representing the input parameters used by this workflow. | ||
<a name="workflowSteps"></a>steps | [[Step Object](#step-object)] | **REQUIRED**. An ordered list of steps where each step represents a call to an API operation or to another workflow. | ||
<a name="outputs"></a>outputs | Map[`string`, {expression}] | A map between a friendly name and a dynamic output value. The name MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. | ||
|
||
This object MAY be extended with [Specification Extensions](#specification-extensions). | ||
|
@@ -305,7 +312,7 @@ Field Name | Type | Description | |
<a name="stepOperationId"></a>operationId | `string` | The name of an existing, resolvable operation, as defined with a unique `operationId` and existing within one of the `source` documents. The referenced operation will be invoked by this workflow step. If more than one `source` document is defined within a Workflows document, then the `operationId` specified MUST be prefixed with the source name to avoid ambiguity or potential clashes. This field is mutually exclusive of the `operationRef` and `workflowId` fields respectively. | ||
<a name="stepOperationRef"></a>operationRef | `string` | A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` and `workflowId` fields respectively. Relative `operationRef` values MAY be used to locate an existing. See [OpenAPI relative reference resolution rules](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relativeReferencesURI) for guidance. A complete [URI Template](https://www.rfc-editor.org/rfc/rfc6570) can also be used. | ||
<a name="stepWorkflowId"></a>workflowId | `string` | The [workflowId](#fixed-fields-2) referencing an existing workflow within the Workflows document. The field is mutually exclusive of the `operationId` and `operationRef` fields respectively. | ||
<a name="stepParameters"></a>parameters | [[Parameter Object](#parameter-object)] | A list of parameters to pass to an operation or workflow as referenced by `operationId`, `operationRef`, or `workflowId`. | ||
<a name="stepParameters"></a>parameters | [[Parameter Object](#parameter-object) | [Reference Object](#reference-object)] | A list of parameters to pass to an operation or workflow as referenced by `operationId`, `operationRef`, or `workflowId`. If a Reference Object is provided, it MUST refer to a Parameter. | ||
<a name="dependsOn"></a>dependsOn | [`string`] | A list of steps that MUST be completed before this step can be processed. This helps to ensure workflow steps are executed in the correct order and that dependent steps are not processed in parallel. The values provided MUST be the be the `stepId` which uniquely references a step. | ||
<a name="stepSuccessCriteria"></a>successCriteria | [{expression}] | A list of assertions to determine the success of the step | ||
<a name="stepOnSuccess"></a>onSuccess | [[Success Action Object](#success-action-object)] | An array of success action objects that specify what to do upon step success. If omitted, the next sequential step shall be executed as the default behavior. | ||
|
@@ -480,6 +487,92 @@ criteria: | |
- $statusCode == 503 | ||
``` | ||
|
||
#### Component Object | ||
|
||
Holds a set of reusable objects for different aspects of the Workflows Specification. All objects defined within the components object will have no effect on the workflow unless they are explicitly referenced from properties outside the components object. | ||
|
||
##### Fixed Fields | ||
|
||
Field Name | Type | Description | ||
---|:---|--- | ||
<a name="componentInputs"></a> inputs | Map[`string`, JSON Schema Object] | An object to hold reusable JSON Schema objects to be referenced from workflow inputs. | ||
<a name="componentParameters">parameters</a> | Map[`string`, [Parameter Object](#parameter-object)] | An object to hold reusable Parameter Objects | ||
|
||
This object _MAY_ be extended with [Specification Extensions](#specificationExtensions). | ||
|
||
|
||
All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. The key is used to refer to the input or parameter in other parts of the Workflow document. | ||
|
||
Field Name Examples: | ||
|
||
``` | ||
User | ||
User_1 | ||
User_Name | ||
user-name | ||
my.org.User | ||
``` | ||
|
||
##### Component Object Example | ||
|
||
```json | ||
"components": { | ||
"inputs": { | ||
"storeId": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These examples seem to be backwards no? Isn't input a JSON Schema and parameter has the the name, in value property? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm - components.inputs is a Map of string to JSON Schema object, so I'm reasonably sure that piece is right (in this case |
||
"name": "storeId", | ||
"in": "header", | ||
"value": "$inputs.x-store-id" | ||
} | ||
}, | ||
"parameters": { | ||
"pagination": { | ||
"type": "object", | ||
"properties": { | ||
"page": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"pageSize": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### Reference Object | ||
|
||
**Note -** This section is derived from the [OpenAPI Specification, v3.1](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject), and is intended to be implemented in similar fashion. | ||
|
||
A simple object to allow referencing other components in the OpenAPI document, internally and externally. | ||
frankkilcommins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The `$ref` string value contains a URI [RFC3986](https://tools.ietf.org/html/rfc3986), which identifies the location of the value being referenced. | ||
|
||
See the rules for resolving [Relative References](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relativeReferencesURI). | ||
|
||
##### Fixed Fields | ||
Field Name | Type | Description | ||
---|:---:|--- | ||
<a name="referenceRef"></a>$ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI, with a prefix of `#/components/inputs` or `#/components/parameters`. | ||
<a name="referenceValue"></a>value | `string` | The value of the Input or Parameter which by default SHOULD override that of the referenced component. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a dramatic departure from how I'm kind of dropping in here without context- is there somewhere I can read up on the reason for this usage? don't see any discussion of it in the referenced issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably makes sense to discuss at our meeting this coming Wednesday, can you make it? Also, might be worth taking a look at the pet store example which I've marked up in this PR, that should at least convey the intention of this use of $ref. But certainly open to hearing improvements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll try to make the meeting. My main concern here is that this proposal seems to be a bit disconnected from the general history and usage of |
||
|
||
##### Reference Object Example | ||
|
||
```json | ||
{ | ||
"$ref": "#/components/parameters/page", | ||
"value": 1 | ||
} | ||
``` | ||
|
||
```yaml | ||
"$ref": "#/components/parameters/page" | ||
value: 1 | ||
``` | ||
|
||
|
||
### <a name="runtimeExpressions"></a>Runtime Expressions | ||
A runtime expression allows values to be defined based on information that will be available within an HTTP message, an event message, and within objects serialized from the Workflows document such as [workflows](#workflow-object) or [steps](#step-object). | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the field name examples are representing here. We don't have this in other sections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a regex for the keys in the Maps - happy to remove this section but I figured it'd be a good idea.