Skip to content

Update presets endpoint to return snake_case keys #19195

@ssncferreira

Description

@ssncferreira

Description:

The presets endpoint has been available since v2.20 and currently returns JSON keys in CamelCase, while other API responses use snake_case.

To align with our convention without introducing a breaking change, we can return both formats for now and mark the CamelCase keys as deprecated. This will give consumers time to migrate before fully switching to snake_case in a future major version.

Current example response
[
  {
    "ID": "4caa3b16-8cd5-4c1f-ad8f-6687d7138f0c",
    "Name": "Cape Town",
    "Parameters": [
      {
        "Name": "Coder Repository Base Directory",
        "Value": "~"
      },
      {
        "Name": "Memory usage threshold",
        "Value": "80"
      },
      {
        "Name": "Region",
        "Value": "za-cpt"
      },
      {
        "Name": "Volume path",
        "Value": "/home/coder"
      },
      {
        "Name": "Volume usage threshold",
        "Value": "90"
      },
      {
        "Name": "Coder Image",
        "Value": "codercom/oss-dogfood:latest"
      }
    ],
    "Default": false,
    "DesiredPrebuildInstances": 1,
    "Description": "Development workspace hosted in South Africa with 1 prebuild instance",
    "Icon": "/emojis/1f1ff-1f1e6.png"
  },
...

Proposed approach:

  • Return both CamelCase and snake_case keys in API response for the presets endpoint.
  • Mark the CamelCase keys as deprecated in the API documentation and OpenAPI spec.
  • After a deprecation period, remove the CamelCase keys in a future major version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions