Skip to content

Fix duplicate enum values in bundle JSON schema#5723

Draft
50sotero wants to merge 1 commit into
databricks:mainfrom
50sotero:fix/issue-5713-dedupe-schema-enums
Draft

Fix duplicate enum values in bundle JSON schema#5723
50sotero wants to merge 1 commit into
databricks:mainfrom
50sotero:fix/issue-5713-dedupe-schema-enums

Conversation

@50sotero

Copy link
Copy Markdown

Summary

  • deduplicate annotation enum values before assigning them to generated JSON Schema nodes
  • keep enumDescriptions aligned with the deduplicated enum order
  • add regressions that catch duplicate enum arrays in the embedded bundle schema

Fixes #5713

Root Cause

cli.json and bundle/internal/schema/annotations.yml can both supply enum values for the same annotation descriptor. The generic annotation merge concatenates sequences, so the generated schema published duplicate enum entries for catalog.SseEncryptionDetailsAlgorithm.

Tests

  • go test ./bundle/internal/schema ./bundle/schema -count=1
  • go test ./bundle/... -count=1

Note: ./task generate-schema could not run in this local environment because uv is not on PATH; I ran its Go command directly: go run ./bundle/internal/schema ./bundle/internal/schema ./bundle/schema/jsonschema.json .codegen/cli.json.

Strict JSON Schema consumers reject duplicate enum entries. The schema generator could receive the same enum values from cli.json and the local annotation file, then publish the concatenated list into bundle/schema/jsonschema.json.

The fix normalizes annotation enum values before assigning them to the JSON Schema node, keeping enumDescriptions aligned with the deduplicated order. A schema-wide regression test now checks every embedded enum array for duplicates.

Constraint: Annotation file merging concatenates sequences, including descriptor enum arrays.

Rejected: Remove the stale local enum only | future duplicate annotation sources could reintroduce invalid schema output

Confidence: high

Scope-risk: narrow

Directive: Keep enumDescriptions generated from the same normalized enum slice as enum to preserve index alignment

Tested: go test ./bundle/internal/schema ./bundle/schema -count=1

Tested: go test ./bundle/... -count=1

Not-tested: ./task generate-schema wrapper because local PATH lacks uv; ran its Go command directly

Related: databricks#5713
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 5723
  • Commit SHA: 55e12b842d25882c6a65e196349d8829d0c5d8f9

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bundle/schema/jsonschema.json: duplicate enum in SseEncryptionDetailsAlgorithm breaks strict JSON Schema validators

1 participant