feat!: patchTemplateMeta to use optional fields (#24984)

Closes https://github.com/coder/coder/issues/13112

**Breaking Change**: Removed status code `StatusNotModified` when no
diffs occur in a patch. Now the patch is always applied and a template
is always returned.
This commit is contained in:
Steven Masley
2026-05-11 12:43:52 -05:00
committed by GitHub
parent 3986aa8a51
commit 19573e8aee
18 changed files with 1028 additions and 356 deletions
+5 -4
View File
@@ -101,8 +101,7 @@ func TestTemplateEdit(t *testing.T) {
ctx := testutil.Context(t, testutil.WaitLong)
err := inv.WithContext(ctx).Run()
require.ErrorContains(t, err, "not modified")
require.NoError(t, err)
// Assert that the template metadata did not change.
updated, err := client.Template(context.Background(), template.ID)
@@ -751,8 +750,10 @@ func TestTemplateEdit(t *testing.T) {
var req codersdk.UpdateTemplateMeta
err = json.Unmarshal(body, &req)
require.NoError(t, err)
assert.False(t, req.AllowUserAutostart)
assert.False(t, req.AllowUserAutostop)
require.NotNil(t, req.AllowUserAutostart)
assert.False(t, *req.AllowUserAutostart)
require.NotNil(t, req.AllowUserAutostop)
assert.False(t, *req.AllowUserAutostop)
r.Body = io.NopCloser(bytes.NewReader(body))
updateTemplateCalled.Add(1)