Skip to content

Commit 07ea7ba

Browse files
committed
Allow for http function calls to provide objects
1 parent ceea13f commit 07ea7ba

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

model/function.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const (
3737
// FunctionTypeCustom property defines a list of function types that are set by the specification. Some runtime
3838
// implementations might support additional function types that extend the ones defined in the specification
3939
FunctionTypeCustom FunctionType = "custom"
40+
// FunctionTypeHttp defines a https://datatracker.ietf.org/doc/html/rfc2616#page-36 as the operation input
41+
FunctionTypeHttp FunctionType = "http"
4042
)
4143

4244
// FunctionType ...
@@ -51,13 +53,16 @@ func (i FunctionType) KindValues() []string {
5153
string(FunctionTypeAsyncAPI),
5254
string(FunctionTypeOData),
5355
string(FunctionTypeCustom),
56+
string(FunctionTypeHttp),
5457
}
5558
}
5659

5760
func (i FunctionType) String() string {
5861
return string(i)
5962
}
6063

64+
type FunctionOperation any
65+
6166
// Function ...
6267
// +builder-gen:new-call=ApplyDefault
6368
type Function struct {
@@ -70,8 +75,16 @@ type Function struct {
7075
// If type is `expression`, defines the workflow expression. If the type is `custom`,
7176
// <path_to_custom_script>#<custom_service_method>.
7277
// +kubebuilder:validation:Required
73-
Operation string `json:"operation" validate:"required"`
74-
// Defines the function type. Is either `custom`, `rest`, `rpc`, `expression`, `graphql`, `odata` or `asyncapi`.
78+
// If type is `http`, provide the http requst object. https://datatracker.ietf.org/doc/html/rfc2616#page-36
79+
// {
80+
// "method": "POST",
81+
// "uri": "https://petstore.swagger.io/v2/pet/",
82+
// "headers": {
83+
// "Content-Type": "application/json"
84+
// }
85+
// }
86+
Operation FunctionOperation `json:"operation" validate:"required"`
87+
// Defines the function type. Is either `custom`, `rest`, `rpc`, `expression`, `graphql`, `odata` or `asyncapi` or `http`.
7588
// Default is `rest`.
7689
// +kubebuilder:validation:Enum=rest;rpc;expression;graphql;odata;asyncapi;custom
7790
// +kubebuilder:default=rest

0 commit comments

Comments
 (0)