Skip to content

Commit 08af9e2

Browse files
authored
Merge pull request serverlessworkflow#1057 from neuroglia-io/feat-document-http-openapi-error-behavior
Add a new `redirect` property to both `http`and `openapi` calls
2 parents e7a4460 + c59e1c5 commit 08af9e2

File tree

4 files changed

+57
-6
lines changed

4 files changed

+57
-6
lines changed

dsl-reference.md

+2
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ The [HTTP Call](#http-call) enables workflows to interact with external services
408408
| body | `any` | `no` | The HTTP request body, if any. |
409409
| query | `map[string, any]` | `no` | A name/value mapping of the query parameters to use, if any. |
410410
| output | `string` | `no` | The http call's output format.<br>*Supported values are:*<br>*- `raw`, which output's the base-64 encoded [http response](#http-response) content, if any.*<br>*- `content`, which outputs the content of [http response](#http-response), possibly deserialized.*<br>*- `response`, which outputs the [http response](#http-response).*<br>*Defaults to `content`.* |
411+
| redirect | `boolean` | `no` | Specifies whether redirection status codes (`300–399`) should be treated as errors.<br>*If set to `false`, runtimes must raise an error for response status codes outside the `200–299` range.*<br>*If set to `true`, they must raise an error for status codes outside the `200–399` range.*<br>*Defaults to `false`.* |
411412

412413
###### Examples
413414

@@ -438,6 +439,7 @@ The [OpenAPI Call](#openapi-call) enables workflows to interact with external se
438439
| parameters | `map` | `no` | A name/value mapping of the parameters, if any, of the OpenAPI operation to call. |
439440
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when calling the OpenAPI operation. |
440441
| output | `string` | `no` | The OpenAPI call's output format.<br>*Supported values are:*<br>*- `raw`, which output's the base-64 encoded [http response](#http-response) content, if any.*<br>*- `content`, which outputs the content of [http response](#http-response), possibly deserialized.*<br>*- `response`, which outputs the [http response](#http-response).*<br>*Defaults to `content`.* |
442+
| redirect | `boolean` | `no` | Specifies whether redirection status codes (`300–399`) should be treated as errors.<br>*If set to `false`, runtimes must raise an error for response status codes outside the `200–299` range.*<br>*If set to `true`, they must raise an error for status codes outside the `200–399` range.*<br>*Defaults to `false`.* |
441443

442444
###### Examples
443445

examples/call-http-redirect.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=../schema/workflow.yaml
2+
document:
3+
dsl: 1.0.0-alpha2
4+
namespace: examples
5+
name: http-query-params
6+
version: 1.0.0-alpha2
7+
input:
8+
schema:
9+
format: json
10+
document:
11+
type: object
12+
required:
13+
- searchQuery
14+
properties:
15+
searchQuery:
16+
type: string
17+
do:
18+
- searchStarWarsCharacters:
19+
call: http
20+
with:
21+
method: get
22+
endpoint: https://swapi.dev/api/people/
23+
query:
24+
search: ${.searchQuery}
25+
redirect: true
26+

examples/call-openapi-redirect.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
document:
2+
dsl: '1.0.0-alpha5'
3+
namespace: test
4+
name: openapi-example
5+
version: '0.1.0'
6+
do:
7+
- findPet:
8+
call: openapi
9+
with:
10+
document:
11+
endpoint: https://petstore.swagger.io/v2/swagger.json
12+
operationId: findPetsByStatus
13+
parameters:
14+
status: available
15+
redirect: true

schema/workflow.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -350,29 +350,33 @@ $defs:
350350
properties:
351351
method:
352352
type: string
353-
title: WithHTTPMethod
353+
title: HTTPMethod
354354
description: The HTTP method of the HTTP request to perform.
355355
endpoint:
356-
title: WithHTTPEndpoint
356+
title: HTTPEndpoint
357357
description: The HTTP endpoint to send the request to.
358358
$ref: '#/$defs/endpoint'
359359
headers:
360360
type: object
361-
title: WithHTTPHeaders
361+
title: HTTPHeaders
362362
description: A name/value mapping of the headers, if any, of the HTTP request to perform.
363363
body:
364-
title: WithHTTPBody
364+
title: HTTPBody
365365
description: The body, if any, of the HTTP request to perform.
366366
query:
367367
type: object
368-
title: WithHTTPQuery
368+
title: HTTPQuery
369369
description: A name/value mapping of the query parameters, if any, of the HTTP request to perform.
370370
additionalProperties: true
371371
output:
372372
type: string
373-
title: WithHTTPOutput
373+
title: HTTPOutput
374374
description: The http call output format. Defaults to 'content'.
375375
enum: [ raw, content, response ]
376+
redirect:
377+
type: boolean
378+
title: HttpRedirect
379+
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
376380
required: [ method, endpoint ]
377381
unevaluatedProperties: false
378382
- title: CallOpenAPI
@@ -412,6 +416,10 @@ $defs:
412416
enum: [ raw, content, response ]
413417
title: WithOpenAPIOutput
414418
description: The http call output format. Defaults to 'content'.
419+
redirect:
420+
type: boolean
421+
title: HttpRedirect
422+
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
415423
required: [ document, operationId ]
416424
unevaluatedProperties: false
417425
- title: CallFunction

0 commit comments

Comments
 (0)