From 37fcaa45d20eae053f729df2f2d085bfc4fd5945 Mon Sep 17 00:00:00 2001 From: Alexandru Georoceanu Date: Mon, 10 Feb 2025 11:22:28 +0200 Subject: [PATCH] feat(schema): allow expressions in HTTP query and headers Issue #1079 Signed-off-by: Alexandru Georoceanu --- .../call-http-query-headers-expressions.yaml | 31 +++++++++++++++++++ schema/workflow.yaml | 12 +++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 examples/call-http-query-headers-expressions.yaml diff --git a/examples/call-http-query-headers-expressions.yaml b/examples/call-http-query-headers-expressions.yaml new file mode 100644 index 00000000..0b790ab9 --- /dev/null +++ b/examples/call-http-query-headers-expressions.yaml @@ -0,0 +1,31 @@ +# yaml-language-server: $schema=../schema/workflow.yaml +document: + dsl: 1.0.0-alpha2 + namespace: examples + name: http-query-headers-expressions + version: 1.0.0-alpha2 +input: + schema: + format: json + document: + type: object + required: + - searchQuery + properties: + searchQuery: + type: string +do: + - setQueryAndHeaders: + set: + query: + search: ${.searchQuery} + headers: + Accept: application/json + - searchStarWarsCharacters: + call: http + with: + method: get + endpoint: https://swapi.dev/api/people/ + headers: ${.headers} + query: ${.query} + diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 70804f16..23165212 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -357,14 +357,22 @@ $defs: description: The HTTP endpoint to send the request to. $ref: '#/$defs/endpoint' headers: - type: object + oneOf: + - type: object + additionalProperties: + type: string + - $ref: '#/$defs/runtimeExpression' title: HTTPHeaders description: A name/value mapping of the headers, if any, of the HTTP request to perform. body: title: HTTPBody description: The body, if any, of the HTTP request to perform. query: - type: object + oneOf: + - type: object + additionalProperties: + type: string + - $ref: '#/$defs/runtimeExpression' title: HTTPQuery description: A name/value mapping of the query parameters, if any, of the HTTP request to perform. additionalProperties: true