Skip to content

Conversation

@smilkuri
Copy link
Contributor

@smilkuri smilkuri commented Nov 24, 2025

Issue #, if available:

#1779
codegen v3: aws/aws-sdk-js-v3#7527

Description of changes:

--

@smilkuri smilkuri force-pushed the resolve-conflict-params branch from f3ea1fe to 13fd0f0 Compare December 1, 2025 16:16
@smilkuri smilkuri marked this pull request as ready for review December 1, 2025 16:57
@smilkuri smilkuri requested a review from a team as a code owner December 1, 2025 16:57
@smilkuri smilkuri force-pushed the resolve-conflict-params branch from cfaa5d4 to 9117008 Compare December 1, 2025 17:00
@smilkuri smilkuri force-pushed the resolve-conflict-params branch from 9117008 to 1fc37f8 Compare December 1, 2025 17:01
@smilkuri smilkuri changed the title fix: nest conflicting endpoint parameters fix: handle clientContextParam collisions with builtin config keys Dec 1, 2025
const config = clientConfig as typeof clientConfig & { clientContextParams?: Record<string, unknown> };
if (config.clientContextParams === undefined) {
config.clientContextParams = {};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to do this, since the only place where it's read also accounts for it being undefined

const clientContextParams = config.clientContextParams as Record<string, unknown> | undefined;
const nestedValue: unknown = clientContextParams?.[configKey] ?? clientContextParams?.[canonicalEndpointParamKey];
// Fall back to direct config properties
const configValue: unknown = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only happen when the configuration being read is a client context parameter.

Users should not be able to place other kinds of config into this object and have them be read. It will create a contract where none is intended.

return Object.assign(options, {
stage: options.stage ?? "production",
defaultSigningName: "",
clientContextParams: Object.assign(clientContextParamDefaults, options.clientContextParams ?? {}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to default the input to ?? {}, since object assign will ignore undefined values.

@smilkuri smilkuri force-pushed the resolve-conflict-params branch from ef3cda8 to c5f0d86 Compare December 1, 2025 20:11
Set<String> knownConfigKeys = Set.of(
"apiKey", "retryStrategy", "requestHandler");
// Generate clientContextParams with all params excluding built-ins
Map<String, String> customerContextParams = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this customContextParams, not customer

writer.addTypeImport("EndpointParameters", "__EndpointParameters", TypeScriptDependency.SMITHY_TYPES);
writer.addTypeImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
writer.addImport("EndpointParameters", "__EndpointParameters", TypeScriptDependency.SMITHY_TYPES);
writer.addImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reason to change these from type import to import

Map<String, String> builtInParams = ruleSetParameterFinder.getBuiltInParams();
builtInParams.keySet().removeIf(OmitEndpointParams::isOmitted);
Set<String> knownConfigKeys = Set.of(
"apiKey", "retryStrategy", "requestHandler");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this static final on the class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second thought this should be handled by a separate class.

seed the class with the config keys seen in https://github.com/aws/aws-sdk-js-v3/blob/f806a2b9eded9f82d488f3d81db36b9cba9da220/private/aws-client-api-test/src/client-interface-tests/client-s3/impl/initializeWithMaximalConfiguration.ts except those specific to S3, then create a public Java static method to add keys to the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants