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.
Follow-up to #2265 (number-tile static color picker).
PR #2265 adds an optional
colorfield to the internalSharedChartSettingsSchema. 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
colorfield on the external API for number-tile chart configs and verify round-trip parity.packages/api/src/utils/zod.ts: addcolor: chartPaletteTokenSchema.optional()toexternalDashboardNumberChartConfigSchema(and introduce the sharedchartPaletteTokenSchemaalongside the existing schemas).packages/api/src/routers/external-api/v2/utils/dashboards.ts: round-trip the field in bothconvertToExternalTileChartConfigandconvertToInternalTileConfig(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 viayarn workspace @hyperdx/api docgen.packages/api/src/routers/external-api/__tests__/dashboards.test.ts: extend the existing round-trip tests withcoloron a number tile.Acceptance
/api/v2/dashboardsaccepts a number-tile config withcolor: "chart-success"."chart-99", hex) is rejected with a clear schema error.Relates to #1360.