Repository navigation
Replace docgen id usage in codegen with legacy id mapping #3964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f23d0ae
resolve smithy ServiceNameUtil conflict
wty-Bryant 540149a
add changelog
wty-Bryant 33a5241
rebase from main
wty-Bryant eae5f3a
add codegen namespace test for c2j service metadata and smithy servic…
wty-Bryant a91bef4
Restore aws-crt-cpp submodule to mainline (v0.44.2)
wty-Bryant 2589c29
include dualstack in client config to resolve cspeel error
wty-Bryant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "type": "bugfix", | ||
| "category": "tools", | ||
| "contributor": "", | ||
| "description": "Derive generated service client namespaces from the service ID in both the C2J and Smithy code generators. Generated client output is unchanged." | ||
| } |
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
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
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
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
71 changes: 71 additions & 0 deletions
71
.../src/main/java/com/amazonaws/util/awsclientgenerator/transform/ServiceNamespaceTable.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| package com.amazonaws.util.awsclientgenerator.transform; | ||
|
|
||
| import com.google.gson.Gson; | ||
| import com.google.gson.reflect.TypeToken; | ||
|
|
||
| import java.io.InputStream; | ||
| import java.io.InputStreamReader; | ||
| import java.lang.reflect.Type; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Static, checked-in table that preserves the C++ SDK service namespaces that diverge from the | ||
| * namespace derived from the service's {@code "serviceId"} (so previously released names stay | ||
| * stable). | ||
| * | ||
| * <p>The table is keyed by the exact, untransformed {@code "serviceId"} and is loaded from the | ||
| * shared data file {@code service-namespace-table.json}, which is the single source of truth | ||
| * shared with the Smithy generator. Identifiers are derived from {@code "serviceId"} only, never | ||
| * from the display-name fields ({@code serviceAbbreviation}/{@code serviceFullName}), the endpoint | ||
| * prefix, or the model file name; the values here are frozen literals, not computed from model | ||
| * metadata at generation time. | ||
| */ | ||
| public final class ServiceNamespaceTable { | ||
|
|
||
| private static final String RESOURCE = "/service-namespace-table.json"; | ||
| private static final Map<String, String> TABLE = load(); | ||
|
|
||
| private ServiceNamespaceTable() { | ||
| } | ||
|
|
||
| private static Map<String, String> load() { | ||
| try (InputStream in = ServiceNamespaceTable.class.getResourceAsStream(RESOURCE)) { | ||
| if (in == null) { | ||
| throw new IllegalStateException("Missing classpath resource " + RESOURCE); | ||
| } | ||
| Type mapType = new TypeToken<Map<String, String>>() { | ||
| }.getType(); | ||
| Map<String, String> parsed = new Gson().fromJson( | ||
| new InputStreamReader(in, StandardCharsets.UTF_8), mapType); | ||
| if (parsed == null) { | ||
| throw new IllegalStateException("Empty or invalid " + RESOURCE); | ||
| } | ||
| return Collections.unmodifiableMap(parsed); | ||
| } catch (Exception e) { | ||
| throw new IllegalStateException("Failed to load " + RESOURCE, e); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @return the frozen namespace preserved for this serviceId, or {@code null} if the service | ||
| * is not in the table (in which case the caller derives the namespace from the serviceId). | ||
| */ | ||
| public static String getNamespace(String serviceId) { | ||
| return TABLE.get(serviceId); | ||
| } | ||
|
|
||
| /** | ||
| * @return {@code true} if the given namespace is already reserved by a preserved (tabled) | ||
| * service. Used to fail generation when a serviceId-derived name would collide with one. | ||
| */ | ||
| public static boolean isReservedNamespace(String namespace) { | ||
| return TABLE.containsValue(namespace); | ||
| } | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "AppIntegrations": "AppIntegrationsService", | ||
| "CloudControl": "CloudControlApi", | ||
| "DataBrew": "GlueDataBrew", | ||
| "ECR PUBLIC": "ECRPublic", | ||
| "EMR containers": "EMRContainers", | ||
| "IVS RealTime": "ivsrealtime", | ||
| "Inspector Scan": "inspectorscan", | ||
| "IotDeviceAdvisor": "IoTDeviceAdvisor", | ||
| "Kinesis Video Signaling": "KinesisVideoSignalingChannels", | ||
| "Location": "LocationService", | ||
| "Marketplace Agreement": "AgreementService", | ||
| "MediaPackageV2": "mediapackagev2", | ||
| "MigrationHubStrategy": "MigrationHubStrategyRecommendations", | ||
| "OpenSearch": "OpenSearchService", | ||
| "RDS Data": "RDSDataService", | ||
| "RUM": "CloudWatchRUM", | ||
| "Redshift Data": "RedshiftDataAPIService", | ||
| "SESv2": "SESV2", | ||
| "SageMaker A2I Runtime": "AugmentedAIRuntime", | ||
| "Sagemaker Edge": "SagemakerEdgeManager", | ||
| "Service Catalog AppRegistry": "AppRegistry", | ||
| "Transcribe": "TranscribeService", | ||
| "Transcribe Streaming": "TranscribeStreamingService", | ||
| "Wisdom": "ConnectWisdomService", | ||
| "amp": "PrometheusService", | ||
| "b2bi": "B2BI", | ||
| "billingconductor": "BillingConductor", | ||
| "codeartifact": "CodeArtifact", | ||
| "codestar notifications": "CodeStarNotifications", | ||
| "evs": "EVS", | ||
| "fis": "FIS", | ||
| "forecast": "ForecastService", | ||
| "forecastquery": "ForecastQueryService", | ||
| "grafana": "ManagedGrafana", | ||
| "identitystore": "IdentityStore", | ||
| "ivs": "IVS", | ||
| "m2": "MainframeModernization", | ||
| "mq": "MQ", | ||
| "rbin": "RecycleBin", | ||
| "resiliencehub": "ResilienceHub", | ||
| "savingsplans": "SavingsPlans", | ||
| "schemas": "Schemas", | ||
| "synthetics": "Synthetics" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more docgen id read in codegen:
Metadata.java#L76pinsarc-region-switchto JSON viaserviceFullName.equalsIgnoreCase("ARC - Region switch"). With a placeholderserviceFullName, the client switches fromAWSJsonClienttoAWSRpcV2CborClient. If this display name ever changes (e.g. in the rebrand), the client would silently switch its wire protocol from JSON to CBOR. Matching onserviceId("ARC Region switch") would keep this stable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with serviceId