From 20dfbe8b6702d243f9786842aa534107778f4b5c Mon Sep 17 00:00:00 2001 From: nicosammito Date: Tue, 27 Oct 2026 14:03:54 +0100 Subject: [PATCH 1/3] feat: update REST event signature to make http_schema and input_schema optional --- actions/rest-action/src/events.rs | 25 ++++++++++++++++--------- actions/rest-action/src/functions.rs | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/actions/rest-action/src/events.rs b/actions/rest-action/src/events.rs index 1e0dfa2..a1a3894 100644 --- a/actions/rest-action/src/events.rs +++ b/actions/rest-action/src/events.rs @@ -7,7 +7,13 @@ #[hercules_sdk::runtime_event( identifier = "REST", - signature = "(http_schema: HTTP_SCHEMA, http_url: HTTP_URL, http_method: HTTP_METHOD, http_auth: A, http_auth_value: REST_AUTH_VALUE, input_schema: T): REST_ADAPTER_INPUT", + // Only the URL and the method are genuinely required: a bodyless + // request (`GET`, `DELETE`, `HEAD`) has no content type and no body to + // describe, so `http_schema` and `input_schema` have to be optional here + // too, not just on their `#[setting]`s — otherwise the signature demands + // values the request can never carry, and `T` collapses to `undefined` + // (`REST_ADAPTER_INPUT.payload`) when no input schema is set. + signature = "(http_url: HTTP_URL, http_method: HTTP_METHOD, http_schema?: HTTP_SCHEMA, http_auth?: A, http_auth_value?: REST_AUTH_VALUE, input_schema?: T): REST_ADAPTER_INPUT", name(en_US = "Webhook"), description( en_US = "A Webhook is an HTTP endpoint that listens for incoming requests from external services or clients, allowing you to react to events in real time using standard HTTP methods like GET, POST, PUT, and DELETE." @@ -22,14 +28,6 @@ linked_data_type_identifiers("REST_ADAPTER_INPUT"), editable )] -#[setting( - identifier = "http_schema", - name(en_US = "Content Type"), - description( - en_US = "Specifies the MIME type of the incoming request payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter." - ), - linked_data_type_identifiers("HTTP_SCHEMA") -)] #[setting( identifier = "http_url", unique = "project", @@ -43,6 +41,15 @@ description(en_US = "Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE)."), linked_data_type_identifiers("HTTP_METHOD") )] +#[setting( + identifier = "http_schema", + name(en_US = "Content Type"), + description( + en_US = "Specifies the MIME type of the incoming request payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter." + ), + linked_data_type_identifiers("HTTP_SCHEMA"), + optional +)] #[setting( identifier = "http_auth", name(en_US = "Authentication type"), diff --git a/actions/rest-action/src/functions.rs b/actions/rest-action/src/functions.rs index c435c16..f87832b 100644 --- a/actions/rest-action/src/functions.rs +++ b/actions/rest-action/src/functions.rs @@ -14,7 +14,7 @@ use crate::pending::{self, PendingResponses, RespondPayload, RespondSignal}; #[hercules_sdk::runtime_function( identifier = "rest::control::respond", - signature = "(http_status_code: HTTP_STATUS_CODE, http_schema: S, payload: HTTP_PAYLOAD, headers?: OBJECT<{}>): void", + signature = "(http_status_code: HTTP_STATUS_CODE, http_schema: S, payload: HTTP_PAYLOAD, headers?: OBJECT<{ [key: string]: string }>): void", name(en_US = "Respond"), description( en_US = "Processes an HTTP response and returns it to the requesting client. This function typically completes the HTTP request–response cycle by delivering the server’s final output, such as headers, status codes, and body content, back to the client." From cb4fbce02efa7dcb0f10177e81090f71455ad510 Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 28 Oct 2026 14:58:00 +0100 Subject: [PATCH 2/3] feat: add design attribute to HTTP response processing function --- actions/rest-action/src/functions.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/rest-action/src/functions.rs b/actions/rest-action/src/functions.rs index f87832b..b304b19 100644 --- a/actions/rest-action/src/functions.rs +++ b/actions/rest-action/src/functions.rs @@ -19,6 +19,7 @@ use crate::pending::{self, PendingResponses, RespondPayload, RespondSignal}; description( en_US = "Processes an HTTP response and returns it to the requesting client. This function typically completes the HTTP request–response cycle by delivering the server’s final output, such as headers, status codes, and body content, back to the client." ), + design = "end" display_message( en_US = "Sends response with status ${http_status_code} and payload ${payload}" ), From 4a7e245a700846bdff0d2c2d027631f7b53cbaf5 Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 28 Oct 2026 14:58:08 +0100 Subject: [PATCH 3/3] feat: fix design attribute formatting in HTTP response processing function --- actions/rest-action/src/functions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/rest-action/src/functions.rs b/actions/rest-action/src/functions.rs index b304b19..8efe7b6 100644 --- a/actions/rest-action/src/functions.rs +++ b/actions/rest-action/src/functions.rs @@ -19,7 +19,7 @@ use crate::pending::{self, PendingResponses, RespondPayload, RespondSignal}; description( en_US = "Processes an HTTP response and returns it to the requesting client. This function typically completes the HTTP request–response cycle by delivering the server’s final output, such as headers, status codes, and body content, back to the client." ), - design = "end" + design = "end", display_message( en_US = "Sends response with status ${http_status_code} and payload ${payload}" ),