Repository navigation
Rpcv2 json codegen - #915
Merged
Merged
Conversation
kingaly111
marked this pull request as ready for review
November 10, 2026 20:30
kuhe
previously approved these changes
Nov 11, 2026
Add Rpcv2JsonProtocolGenerator and Rpcv2JsonIntegration, mirroring the
rpcv2Cbor versions. Generated clients use AsyncRpcV2JsonClientProtocol
and depend on smithy-http[json].
Add an rpcv2-json projection for
smithy.protocoltests.rpcv2Json#RpcV2JsonProtocol and commit the
generated codegen-output/rpcv2-json snapshot. The four explicit-default
vectors are marked xfail, matching rpcv2Cbor and RestJson.
Fix HttpProtocolTestGenerator writing bigDecimal params as float
literals, which lost precision and produced the wrong type; they are
now written as Decimal("...") from the exact model text.
Add an rpcv2Json counterpart of the handwritten event-stream model and a my-handwritten-json-model projection, and play the Simon Says duplex game against the generated rpcv2Json client as well as rpcv2Cbor. The game moves into a shared _simon_says helper parametrized by client, models, codec, event content type and Smithy-Protocol value. The HTTP/2 test server takes the content type and Smithy-Protocol value (defaulting to rpcv2Cbor), records each frame's content type, and keeps the connection open until the client ends its stream, which removes a spurious "HTTP-stream has completed" error on close.
Develop raised the generated pytest requirement to >=9.0.3; regenerate the rpcv2-json and my-handwritten-json-model snapshots to match.
kingaly111
force-pushed
the
rpcv2-json-codegen
branch
from
November 11, 2026 23:25
1a1716c to
f640489
Compare
kuhe
approved these changes
Nov 12, 2026
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.
Add rpcv2Json codegen, protocol tests and duplex integration test
Summary
Generated clients can now target services that use
smithy.protocols#rpcv2Json. The runtime protocol landed in #902; this PR adds the codegen that selects it, runs Smithy's rpcv2Json protocol test suite against a generated client, and adds an end-to-end event-streaming test over real HTTP/2.Codegen
Rpcv2JsonProtocolGeneratorandRpcv2JsonIntegration: copies of the rpcv2Cbor versions.@rpcv2Json.httpandeventStreamHttpfrom the trait.AsyncRpcV2JsonClientProtocoland depend onsmithy-http[json].RpcV2JsonClientProtocolautomatically through the existing async-to-sync mapping, so no extra runtime type was needed.META-INF/services/...PythonIntegration, andRuntimeTypes.RPC_V2_JSON_CLIENT_PROTOCOLis added.SchemaTraitFilterIndex: the comments on the keptoriginalShapeIdtrait now say it's used for unit detection by both rpcv2 protocols. No behavior change.ValueNodeVisitorwrote bigDecimal values in generated tests as Python float literals, which lose precision past about 17 digits and are the wrong type. It now writesDecimal("...")using the exact text from the model. This fixed 8 rpcv2Json arbitrary-precision tests and changed no other snapshot.Protocol tests
rpcv2-jsonincodegen/protocol-test/smithy-build.json, forsmithy.protocoltests.rpcv2Json#RpcV2JsonProtocolfromsmithy-protocol-tests1.74.1.codegen-output/rpcv2-json.Duplex event-stream integration test (Simon Says)
my-handwritten-json-model.smithyis an@rpcv2Jsoncopy of the hand-written event-stream service. Its projection generatesAsyncMyHandwrittenJsonModel. The shapes are local copies, so the CBOR service and its snapshot are untouched.tests/integration/_simon_says.py. Each protocol's test file supplies its client, models, codec, event content type andSmithy-Protocolvalue.test_rpcv2cbor_event_stream.pykeeps its test id and behavior.test_rpcv2json_event_stream.pyplays the same game using the client's own JSON codec.initial-requestfollowed by exactly one move or pass per turn, in order, and every frame must carry the protocol's content type.H2BidiServernow takes the event content type and theSmithy-Protocolvalue, defaulting to rpcv2Cbor.AWS_ERROR_HTTP_STREAM_HAS_COMPLETED. That's gone for both protocols.Testing
make generate-protocol-tests: only the newrpcv2-jsonandmy-handwritten-json-modeldirectories differ; every existing snapshot is byte-identical. Generation was repeated and produced the same output.make test-protocols: all projections pass, including rpcv2-json (70 passed, 4 xfailed) and rpcv2-cbor (69 passed, 4 xfailed).make typecheck-protocols: 0 errors in every projection.make test-functional: bothtest_simon_says_duplextests andtest_client_uses_rpcv2json_codecrun (none skipped) and pass.make static-analysis,uv run pyright packagesandmake check-java: pass.Notes