Skip to content

Allow for http function calls to provide objects #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions model/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand All @@ -51,13 +53,16 @@ func (i FunctionType) KindValues() []string {
string(FunctionTypeAsyncAPI),
string(FunctionTypeOData),
string(FunctionTypeCustom),
string(FunctionTypeHttp),
}
}

func (i FunctionType) String() string {
return string(i)
}

type FunctionOperation any

// Function ...
// +builder-gen:new-call=ApplyDefault
type Function struct {
Expand All @@ -70,8 +75,16 @@ type Function struct {
// If type is `expression`, defines the workflow expression. If the type is `custom`,
// <path_to_custom_script>#<custom_service_method>.
// +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
Expand Down