Repository navigation
Conversation
Match the C2J processors that run for every service: set the smithy-rpc-v2-cbor operation request URI, run the event-stream, explicit String payload, and lowercase shape-name validations, and honor customServiceMetadata.protocol when resolving the protocol. The protocol is resolved once and passed to metadata construction.
1 of 12 tasks
This branch has not been deployed
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.
Motivation and Context
Before translating a C2J model, codegen runs a fixed chain of preprocessors for every service (
DefaultCustomizationProcessor). Some of them change how the client is generated; others only reject models that codegen cannot handle. The Smithy path did not run them yet. This PR adds the Smithy-path equivalent of five of them:MetadataModifiersProcessor(protocol part)customServiceMetadata.protocolsetting incustomization.configreplaces the model's protocol. Only Kinesis uses it, to generate with the legacycborprotocol, which has no Smithy trait.SmithyRpcV2CborProtocolProcessorPOST /service/{service}/operation/{operation}/NewAndLegacyEventStreamProcessorExplicitStringPayloadQueryProtocolProcessor@httpPayloadis a string, which those protocols do not supportLowercaseShapeValidatorProcessorModifications
ProtocolUtils: newresolveProtocol(ServiceIndex, ServiceShape, CustomizationConfig). With nocustomServiceMetadata.protocol, it returns the same protocol as before, from the service's Smithy protocol traits. With an override, it passes the override to the existing C2J resolver, so the value is checked and resolved exactly as on the C2J path.SmithyIntermediateModelBuilder: resolves the protocol once, with the override, and runs the new source-model validation at the start ofbuild().AddSmithyMetadata: takes the resolved protocol as a parameter instead of resolving it again, so the metadata and the shape translation always agree on the protocol.AddSmithyInputShapes: rpcv2Cbor requests usePOST /service/{service shape name}/operation/{operation name}. Other RPC protocols still usePOST /.SmithySourceModelValidator: the three validations above, run on the shapes the service reaches after the smithy-build transforms, with the same error messages as the C2J processors.NewAndLegacyEventStreamProcessor: adds a package-privatevalidateEventStreams(serviceId, names)so the Smithy validator reuses the same approved-stream list instead of copying it.Differences from the C2J processors, none of which changes the result for any current service:
metadata.targetPrefix; the Smithy path uses the service shape name. They are equal for every current rpcv2Cbor service.metadata.serviceId; the Smithy path uses thesdkIdof@aws.api#service. They are equal for every service.service-2.json.Two other C2J preprocessors in the chain are specific to S3 (
S3RemoveBucketFromUriProcessor) and S3 Control (S3ControlRemoveAccountIdHostPrefixProcessor). They are not ported here. They will be added as service-specific transforms when those services move to the Smithy path, so shared codegen does not gain service-specific code.Testing
SmithySourceModelValidationTest, covering each validation (failing and passing case).AddSmithyInputShapesTest(rpcv2Cbor request URI) andAddSmithyMetadataTest(protocol passed in).mvn clean install -pl :codegenpasses.Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License