Skip to content

Allow for http function calls to provide objects #242

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

Open
wants to merge 3 commits into
base: 2.6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
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
20 changes: 0 additions & 20 deletions .github/labeler.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/pull_request_labeler.yml

This file was deleted.

8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ goimports:
@goimports -w .

lint:
@echo "🚀 Running lint..."
@command -v golangci-lint > /dev/null || (echo "🚀 Installing golangci-lint..."; curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin")
@echo "🚀 Installing/updating golangci-lint…"
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

@echo "🚀 Running lint…"
@make addheaders
@make goimports
@make fmt
@./hack/go-lint.sh ${params}
@$(GOPATH)/bin/golangci-lint run ./... ${params}
@echo "✅ Linting completed!"

.PHONY: test
Expand Down
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
Loading