Skip to content

bug: template settings and inconsistent API behavior ("empty field" vs "delete request") #5066

Closed as not planned
@mtojek

Description

@mtojek

Spotted in: #5060 (comment)

When a user wants to clear the field content (e.g. description) using the Template Settings form, and submit description: "", it isn't possible as the API considers it as "no change". On the other hand, a user can set the icon field, but calling the CLI: coder templates edit <template-name> will simply remove the icon.

The suggested solution would be to distinguish these actions:

  • delete the field: field "" is present in the JSON request
  • leave as is: field is not present in the request
  • modify the field: non-empty field is present in the request

It implicates that CreateTemplateRequest and UpdateTemplateMeta should either contain nillable fields or we need to redesign that contract (API can receive a set of modify-actions).

Let me know your thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleThis issue is like stale bread.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions