Remove duplicate enum values for jsonschema.json#5839
Merged
Conversation
`catalog.SseEncryptionDetailsAlgorithm` published a duplicated enum (`["AWS_SSE_S3", "AWS_SSE_KMS", "AWS_SSE_KMS", "AWS_SSE_S3"]`) in the generated schema, which strict JSON Schema validators (e.g. OPA) reject. Root cause: the enum was hand-authored in `annotations.yml` back when `cli.json` did not define this type (#4484). Once #5484 introduced the enum into `cli.json`, both sources supplied it, and the annotation merge concatenates sequences, producing the duplicate. The annotation sync only rewrites descriptions/placeholders, never hand-authored enums, so the redundant entry persisted. Remove the redundant enum from `annotations.yml` so `cli.json` is the single source; the description override is kept. Add a whole-schema uniqueness guard so this class of duplicate can't return. Fixes #5713 Co-authored-by: Isaac
Simplify the copyloopvar in duplicateEnumPaths by reassigning the range variable directly, and point the changelog entry at the PR instead of the issue. Co-authored-by: Isaac
enum values for jsonschema.json
pietern
approved these changes
Jul 6, 2026
pietern
left a comment
Contributor
There was a problem hiding this comment.
Nice!
The linked issue claims this was an issue since v0.299.1, but that doesn't align with the timeline for the new generator. Could the claim in the issue be incorrect?
Contributor
Author
Yes. The issue & also Claude's initial assessment (in this PR) were both wrong. The PR is now updated with the correct root cause & timeline |
Collaborator
Integration test reportCommit: b9da757
Top 5 slowest tests (at least 2 minutes):
|
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
catalog.SseEncryptionDetailsAlgorithmpublished a duplicatedenumin the generated bundle JSON schema:JSON Schema requires enum values to be unique, so strict validators (e.g. OPA) reject the entire schema at compile time. The duplicate has shipped since v0.290.0 (Feb 26 2026); the issue reports it "since v0.299.1" only because that is the first release where
jsonschema.jsonwas published as a downloadable release asset, so it is the earliest version an external consumer could inspect.Fixes #5713.
Root cause
The enum was hand-authored for
catalog.SseEncryptionDetailsAlgorithmin #4484 (UC external locations, Feb 18 2026), in the hand-authored override annotation file, with order[AWS_SSE_KMS, AWS_SSE_S3]. At that point the SDK-derived annotations did not define this type, so the generated schema had the correct 2 entries.Two days later, #4552 (Upgrade Go SDK to v0.110.0, Feb 20 2026) regenerated the SDK-derived annotation file, which now defined the same enum with order
[AWS_SSE_S3, AWS_SSE_KMS]. From then on both annotation sources supplied the enum. The annotation merge concatenates sequences, so the two pairs combined into four entries —[S3, KMS](SDK, merge base) followed by[KMS, S3](override), producing[S3, KMS, KMS, S3].The later consolidation of the annotation files into a single
annotations.yml+.codegen/cli.json(#5484 / #5574) preserved this pre-existing duplicate rather than causing it; only the file names changed.annotations.ymlis not generated fromcli.json—./task generate-schemaonly syncs descriptions and placeholders and drops stale entries; it never rewrites hand-authored enums. So the redundant entry persisted silently across the refactor.Fix
enumfromannotations.yml, leavingcli.json(SDK-derived) as the single source of truth. Thedescriptionoverride there is intentional (it differs from cli.json's text) and is kept.bundle/schema/jsonschema.json; the enum is now["AWS_SSE_S3", "AWS_SSE_KMS"].TestJsonSchemaEnumsAreUnique, a whole-schema guard that walks everyenumin the embedded schema and fails on any duplicate, so this class of bug cannot return regardless of source.Tests
go test ./bundle/internal/schema ./bundle/schema -count=1$defs/.../catalog.SseEncryptionDetailsAlgorithm/oneOf[0].This pull request and its description were written by Isaac, an AI coding agent.