Parse modeled members from AWS JSON errors - #3
Open
ikolomiets wants to merge 2 commits into
Open
Conversation
ikolomiets
marked this pull request as ready for review
August 4, 2026 04:43
Contributor
|
Hi @ikolomiets, Thanks for the PR. I'd prefer The |
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.
Disclaimer: The Issue and PR were created using Codex gpt-5.6-sol xhigh.
Fixes #2
Problem
DynamoDB supports
ReturnValuesOnConditionCheckFailure=ALL_OLDfor conditional writes. This lets callers retrieve the item that caused a failed condition directly fromConditionalCheckFailedException, which is useful for optimistic concurrency and conflict resolution based on a stored hash.The generated SDK already supports sending the request option:
The pinned AWS model also defines
ConditionalCheckFailedException.Itemas anAttributeMap. The missing capability was response handling:messageand syntheticrequest_idfields.AwsJsonProtocolidentified the error code but constructed the exception without deserializing the response body.error.ServiceErrorand the correct.conditional_check_failed_exceptiondiagnostic variant, but could not access the returned item or its hash.ReturnValues=ALL_OLDis not a substitute: it applies to successful writes, while conditional failures requireReturnValuesOnConditionCheckFailure.This is a generic AWS JSON generator defect rather than a DynamoDB-only omission. Every modeled exception member beyond
messageandrequest_idwas discarded for AWS JSON 1.0/1.1 services, including other structured diagnostic fields such as cancellation and throttling details.Fix
aws.map.MapEntrysupport for maps, including maps nested through lists.json_field_namesmappings that preserve Smithy wire casing.messageandrequest_idfields and reserve those normalized names to avoid duplicate fields.aws.json.parseJsonObjectinto the generated exception type, allocating from the diagnostic arena..unknowndiagnostic fallback, including code, message, and HTTP status, when a recognized error body is malformed.OutOfMemoryrather than converting allocation failure into an unknown service error..all_oldcases.The additive DynamoDB API is:
Typical access remains through the diagnostic union:
The returned data is owned by
ServiceError's arena and remains valid untildiagnostic.deinit().Why so many generated Zig files change
The handwritten fix is protocol-wide, not operation-specific. AWS JSON error parsing is generated into each operation module, so changing the recognized-error dispatch and importing typed error structures updates every generated operation for an AWS JSON service. Each service's
errors.zigalso changes because modeled exception members, supporting imports, documentation, defaults, and JSON wire-name mappings are now emitted.As a result, the regeneration commit contains 6,863 generated files across 152 AWS JSON 1.0/1.1 services. The large diff is the complete deterministic output of one generic generator change against the repository's pinned AWS models; it is not 6,863 independently handwritten changes. Keeping the full regeneration ensures that every affected service exposes its modeled error payload consistently and that checked-in generated sources match the generator.
The generated output is isolated in its own commit so reviewers can examine the six handwritten/test files independently from the mechanical regeneration.
Compatibility
ServiceError, operation return types, normalized messages, request IDs, retry behavior, and unknown-error handling remain compatible.Validation
Previously completed before PR preparation:
make codegen-dynamodbmake codegenmake test— 413 tests plus generated service compilationmake test-integration-localstack SCENARIO=dynamodb— 19/19 testsgit diff --check