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..8efe7b6 100644 --- a/actions/rest-action/src/functions.rs +++ b/actions/rest-action/src/functions.rs @@ -14,11 +14,12 @@ 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." ), + design = "end", display_message( en_US = "Sends response with status ${http_status_code} and payload ${payload}" ),