Fix duplicate enum values in bundle JSON schema#5723
Draft
50sotero wants to merge 1 commit into
Draft
Conversation
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
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5713
Root Cause
cli.jsonandbundle/internal/schema/annotations.ymlcan both supply enum values for the same annotation descriptor. The generic annotation merge concatenates sequences, so the generated schema published duplicate enum entries forcatalog.SseEncryptionDetailsAlgorithm.Tests
go test ./bundle/internal/schema ./bundle/schema -count=1go test ./bundle/... -count=1Note:
./task generate-schemacould not run in this local environment becauseuvis not on PATH; I ran its Go command directly:go run ./bundle/internal/schema ./bundle/internal/schema ./bundle/schema/jsonschema.json .codegen/cli.json.