From e12935b13dfaab669fb3ed4e2ffcb3e5d6dfa040 Mon Sep 17 00:00:00 2001 From: Hugh Neale Date: Fri, 9 May 2025 12:09:33 +0100 Subject: [PATCH] Allow for http function calls to provide objects Signed-off-by: Hugh Neale --- model/function.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/model/function.go b/model/function.go index 7cf4197..567cb00 100644 --- a/model/function.go +++ b/model/function.go @@ -37,6 +37,8 @@ const ( // FunctionTypeCustom property defines a list of function types that are set by the specification. Some runtime // implementations might support additional function types that extend the ones defined in the specification FunctionTypeCustom FunctionType = "custom" + // FunctionTypeHttp defines a https://datatracker.ietf.org/doc/html/rfc2616#page-36 as the operation input + FunctionTypeHttp FunctionType = "http" ) // FunctionType ... @@ -51,6 +53,7 @@ func (i FunctionType) KindValues() []string { string(FunctionTypeAsyncAPI), string(FunctionTypeOData), string(FunctionTypeCustom), + string(FunctionTypeHttp), } } @@ -58,6 +61,8 @@ func (i FunctionType) String() string { return string(i) } +type FunctionOperation any + // Function ... // +builder-gen:new-call=ApplyDefault type Function struct { @@ -70,8 +75,16 @@ type Function struct { // If type is `expression`, defines the workflow expression. If the type is `custom`, // #. // +kubebuilder:validation:Required - Operation string `json:"operation" validate:"required"` - // Defines the function type. Is either `custom`, `rest`, `rpc`, `expression`, `graphql`, `odata` or `asyncapi`. + // If type is `http`, provide the http requst object. https://datatracker.ietf.org/doc/html/rfc2616#page-36 + // { + // "method": "POST", + // "uri": "https://petstore.swagger.io/v2/pet/", + // "headers": { + // "Content-Type": "application/json" + // } + // } + Operation FunctionOperation `json:"operation" validate:"required"` + // Defines the function type. Is either `custom`, `rest`, `rpc`, `expression`, `graphql`, `odata` or `asyncapi` or `http`. // Default is `rest`. // +kubebuilder:validation:Enum=rest;rpc;expression;graphql;odata;asyncapi;custom // +kubebuilder:default=rest