Skip to content

Add a new redirect property to both httpand openapi calls #1057

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ The [HTTP Call](#http-call) enables workflows to interact with external services
| body | `any` | `no` | The HTTP request body, if any. |
| query | `map[string, any]` | `no` | A name/value mapping of the query parameters to use, if any. |
| 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`.* |
| 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`.* |

###### Examples

Expand Down Expand Up @@ -438,6 +439,7 @@ The [OpenAPI Call](#openapi-call) enables workflows to interact with external se
| parameters | `map` | `no` | A name/value mapping of the parameters, if any, of the OpenAPI operation to call. |
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when calling the OpenAPI operation. |
| 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`.* |
| 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`.* |

###### Examples

Expand Down
26 changes: 26 additions & 0 deletions examples/call-http-redirect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# yaml-language-server: $schema=../schema/workflow.yaml
document:
dsl: 1.0.0-alpha2
namespace: examples
name: http-query-params
version: 1.0.0-alpha2
input:
schema:
format: json
document:
type: object
required:
- searchQuery
properties:
searchQuery:
type: string
do:
- searchStarWarsCharacters:
call: http
with:
method: get
endpoint: https://swapi.dev/api/people/
query:
search: ${.searchQuery}
redirect: true

15 changes: 15 additions & 0 deletions examples/call-openapi-redirect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
document:
dsl: '1.0.0-alpha5'
namespace: test
name: openapi-example
version: '0.1.0'
do:
- findPet:
call: openapi
with:
document:
endpoint: https://petstore.swagger.io/v2/swagger.json
operationId: findPetsByStatus
parameters:
status: available
redirect: true
20 changes: 14 additions & 6 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,29 +350,33 @@ $defs:
properties:
method:
type: string
title: WithHTTPMethod
title: HTTPMethod
description: The HTTP method of the HTTP request to perform.
endpoint:
title: WithHTTPEndpoint
title: HTTPEndpoint
description: The HTTP endpoint to send the request to.
$ref: '#/$defs/endpoint'
headers:
type: object
title: WithHTTPHeaders
title: HTTPHeaders
description: A name/value mapping of the headers, if any, of the HTTP request to perform.
body:
title: WithHTTPBody
title: HTTPBody
description: The body, if any, of the HTTP request to perform.
query:
type: object
title: WithHTTPQuery
title: HTTPQuery
description: A name/value mapping of the query parameters, if any, of the HTTP request to perform.
additionalProperties: true
output:
type: string
title: WithHTTPOutput
title: HTTPOutput
description: The http call output format. Defaults to 'content'.
enum: [ raw, content, response ]
redirect:
type: boolean
title: HttpRedirect
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
required: [ method, endpoint ]
unevaluatedProperties: false
- title: CallOpenAPI
Expand Down Expand Up @@ -412,6 +416,10 @@ $defs:
enum: [ raw, content, response ]
title: WithOpenAPIOutput
description: The http call output format. Defaults to 'content'.
redirect:
type: boolean
title: HttpRedirect
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
required: [ document, operationId ]
unevaluatedProperties: false
- title: CallFunction
Expand Down
Loading