Add Smithy metadata translation to codegen - #7254
Open
Fred1155 wants to merge 1 commit into
Open
Conversation
S-Saranya1
reviewed
Aug 12, 2026
| return AddSmithyMetadata.constructMetadata(model, service, ServiceIndex.of(model), naming, | ||
| CustomizationConfig.create()); | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
nit: Similar to jsonVersion and supportsH2, should we add tests for auth as well? The fallback logic has a few distinct paths that aren't directly covered.
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
This adds the smithy translator for service-level metadata, such as service and class names, package names, API version,
protocol, endpoint prefix, signing name, auth, and the doc identifiers. This is the Smithy counterpart to
AddMetadata.C2J keeps all of this in one flat
metadatablock. Smithy spreads it across traits, and for some fields stores nothing at all . The value is implied by which trait is present, or sits inside another trait. Six fields need that handling; the rest are a trait read replacing a JSON field read.Modifications
smithy/AddSmithyMetadata.javaMetadataAddMetadatasmithy/AddSmithyMetadataTest.java(13)Nothing wired into the codegen or IM builder yet.
MetadatafieldapiVersionmetadata.apiVersionServiceShape.getVersion()documentationserviceModel.getDocumentation()@documentationserviceFullNamemetadata.serviceFullName@titleserviceIdmetadata.serviceId@aws.api#servicesdkIdendpointPrefixmetadata.endpointPrefix@aws.api#serviceendpointPrefixsigningNamemetadata.signingName@sigv4.name)protocolresolveProtocol(ServiceMetadata)resolveProtocol(ServiceIndex, service)jsonVersionmetadata.jsonVersion, else1.11.1authTypemetadata.signatureVersion@sigv4present →V4authmetadata.auth@authvalues, else applied auth traitawsQueryCompatiblemetadata.awsQueryCompatibleuidmetadata.uidServiceTrait.resolveDocId(service)supportsH2protocolSettings.containsKey("h2")h2in protocol trait listsserviceAbbreviationmetadata.serviceAbbreviationThis class takes the naming strategy as a parameter instead of building one, since the caller already has it.
Divergences
jsonVersionjsonVersionfield;@awsJson1_0vs@awsJson1_1carries it. rest-json and rpcv2Cbor have no version and take C2J's1.1defaultauth@authis absent@sigv4and no@auth, so reading only@authwould leave it emptyawsQueryCompatibleuiddocIdmemberuidequivalentappmeshdifferssupportsH2http/eventStreamHttplistsprotocolSettings, which Smithy doesn't havebedrock-agent-runtimediffersserviceAbbreviationabbreviationmember, andsdkIdis an identifier, not a display name (matches C2J 24% of the time vs 68% for the existing@titlefallback)getDescriptiveServiceName()falls back to the full service nameEverything else
AddMetadatapopulates is populated here;serviceAbbreviationis the only field left null.Testing
AddSmithyMetadataTest builds small inline Smithy models and asserts one field each
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