Skip to content

feat: pass invocation_mode property to uploadDeployFunction endpoint #454

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

Merged
merged 4 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions go/models/function_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions go/porcelain/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,11 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
})
}

if function.DisplayName != "" || function.Generator != "" {
if function.DisplayName != "" || function.Generator != "" || function.InvocationMode != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, is this condition correct? Can you have a function config without display name or generator, just the invocation mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can. None of the fields are mandatory. I think the check is just preventing us from writing an empty function config object, which in itself feels weird but I didn't want to change it as part of this PR.

functionsConfig[file.Name] = models.FunctionConfig{
DisplayName: function.DisplayName,
Generator: function.Generator,
DisplayName: function.DisplayName,
Generator: function.Generator,
InvocationMode: function.InvocationMode,
}
}

Expand Down
6 changes: 4 additions & 2 deletions go/porcelain/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ func TestBundleWithManifest(t *testing.T) {
"path": "%s",
"runtime": "some-other-runtime",
"mainFile": "/some/path/hello-py-function-test",
"name": "hello-py-function-test"
"name": "hello-py-function-test",
"invocation_mode": "stream"
}
],
"version": 1
Expand All @@ -468,8 +469,9 @@ func TestBundleWithManifest(t *testing.T) {
assert.Equal(t, 2, len(functions.Files))
assert.Equal(t, "a-runtime", functions.Files["hello-js-function-test"].Runtime)
assert.Equal(t, "some-other-runtime", functions.Files["hello-py-function-test"].Runtime)
assert.Equal(t, "stream", functionsConfig["hello-py-function-test"].InvocationMode)

assert.Equal(t, 1, len(functionsConfig))
assert.Equal(t, 2, len(functionsConfig))
assert.Equal(t, "Hello Javascript Function", functionsConfig["hello-js-function-test"].DisplayName)
assert.Equal(t, "@netlify/[email protected]", functionsConfig["hello-js-function-test"].Generator)
}
Expand Down
1 change: 1 addition & 0 deletions go/porcelain/functions_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ type functionsManifestEntry struct {
Schedule string `json:"schedule"`
DisplayName string `json:"displayName"`
Generator string `json:"generator"`
InvocationMode string `json:"invocation_mode"`
}
2 changes: 2 additions & 0 deletions swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,8 @@ definitions:
type: string
generator:
type: string
invocation_mode:
type: string
parameters:
page:
type: integer
Expand Down