Skip to content

Commit e1384e9

Browse files
authored
Merge pull request #10 from JaredCE/arazzo-runner
Arazzo runner
2 parents f261bee + 1980e76 commit e1384e9

32 files changed

+5391
-52
lines changed

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,24 @@ plugins:
3535
3636
Note: `serverless-openapi-documenter` is required for this to work.
3737

38+
This plugin can be used to generate Arazzo Specifications and to Run a generated Arazzo Specification.
39+
40+
**Using the plugin:**
41+
42+
To generate the specification, you should see:
43+
44+
- [Generation](#generating-the-arazzo-specification-file)
45+
46+
To run a specification, you should look at:
47+
48+
- [Running](#running-the-arazzo-specification)
49+
3850
## Generating the Arazzo Specification file
3951

40-
To Run: `serverless arazzo generate -f json`
52+
To generate an Arazzo Specification, you can call the plugin from the CLI like:
53+
```bash
54+
serverless arazzo generate -f json
55+
```
4156

4257
Options:
4358

@@ -109,6 +124,8 @@ Workflows comprise of one or many workflow objects, one workflow might be for lo
109124

110125
Each workflow object requires a `workflowId` and a set of `steps`. `workflowId` should conform to the Regex `[A-Za-z0-9_\-]+` and should be unique across the Arazzo Specification.
111126

127+
##### inputs
128+
112129
`inputs` is a [JSON Schema](https://json-schema.org/) of the various inputs you will need for each step e.g.
113130

114131
```yml
@@ -124,7 +141,7 @@ Each workflow object requires a `workflowId` and a set of `steps`. `workflowId`
124141
type: string
125142
```
126143

127-
The `inputs` here will be used in a login step and can be verified by this JSON Schema.
144+
The `inputs` here will be used in a login step and can be verified by this JSON Schema. If you are to be usng the runner part of this plugin (see [Running](#running-the-arazzo-specification)), then the inputs should map to the input file (see [Input File](#input-file)).
128145

129146
#### steps
130147

@@ -219,3 +236,44 @@ custom:
219236
```
220237

221238
`other-field` here will not make it to the generated Arazzo document.
239+
240+
## Running the Arazzo Specification
241+
242+
For now, I recommend using the [Redocly CLI](https://redocly.com/redocly-cli) to [run your Arazzo Workflows](https://redocly.com/learn/arazzo/testing-arazzo-workflows).
243+
244+
### Here be Dragons
245+
246+
To run the generated Arazzo Specification, you can call the plugin from the CLI like:
247+
248+
```bash
249+
serverless arazzo run
250+
```
251+
252+
Options:
253+
254+
```
255+
--source -s The default Arazzo Specification source file. Default: arazzo.json
256+
--input -i The file containign input variables to run the Workflow steps. Default: input.json
257+
```
258+
259+
### Input file
260+
261+
The input file is where you keep your variables that you wish to use within your workflow and should be a json file structured like:
262+
263+
```json
264+
{
265+
"worflowId1": {
266+
"name": "Jared"
267+
}
268+
}
269+
```
270+
271+
The file should contain objects for each workflow, by workflowId, with the variables matching up to the inputs that you defined in your workflow [inputs](#inputs) schema.
272+
273+
This file is likely to be comitted to your repository, so you should not store secrets in the file, instead you might use something like [jq](https://jqlang.org/) that can take repository variables and insert them into your input file:
274+
275+
```bash
276+
jq --arg password "$secret_password" '.workflowId1.password = $password' input.json
277+
```
278+
279+
Obviously, if you have a lot of secret variables that need adding as inputs, then you might need to write a script that can alter the `input.json` file for you within your CI/CD runner.

0 commit comments

Comments
 (0)