Skip to content

[HDX-1360] External API parity for number-tile color #2359

@alex-fedotyev

Description

@alex-fedotyev

Follow-up to #2265 (number-tile static color picker).

PR #2265 adds an optional color field to the internal SharedChartSettingsSchema. The external dashboards API (packages/api/src/utils/zod.ts) does not yet accept the field, so customers can only author colors through the UI.

Scope

Mirror the color field on the external API for number-tile chart configs and verify round-trip parity.

  • packages/api/src/utils/zod.ts: add color: chartPaletteTokenSchema.optional() to externalDashboardNumberChartConfigSchema (and introduce the shared chartPaletteTokenSchema alongside the existing schemas).
  • packages/api/src/routers/external-api/v2/utils/dashboards.ts: round-trip the field in both convertToExternalTileChartConfig and convertToInternalTileConfig (number-tile arm only).
  • packages/api/src/routers/external-api/v2/dashboards.ts: OpenAPI JSDoc components for the palette enum.
  • packages/api/openapi.json: regenerate via yarn workspace @hyperdx/api docgen.
  • packages/api/src/routers/external-api/__tests__/dashboards.test.ts: extend the existing round-trip tests with color on a number tile.

Acceptance

  • POST /api/v2/dashboards accepts a number-tile config with color: "chart-success".
  • GET returns the same token unchanged.
  • Invalid token (e.g. "chart-99", hex) is rejected with a clear schema error.
  • OpenAPI spec lists the palette enum on the number-tile schema.

Relates to #1360.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions