From 2764ee869a0fb2b09a2f49262864f1ee1cd96a9d Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Tue, 21 Nov 2023 21:45:01 -0800 Subject: [PATCH] fix(experimentalIdentityAndAuth): update `DefaultIdentityProviderConfig` to not dedupe --- .../integration/AddHttpAuthSchemePlugin.java | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/auth/http/integration/AddHttpAuthSchemePlugin.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/auth/http/integration/AddHttpAuthSchemePlugin.java index 877fab66d01..64dd18feec6 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/auth/http/integration/AddHttpAuthSchemePlugin.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/auth/http/integration/AddHttpAuthSchemePlugin.java @@ -5,12 +5,10 @@ package software.amazon.smithy.typescript.codegen.auth.http.integration; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.codegen.core.Symbol; import software.amazon.smithy.model.knowledge.ServiceIndex; import software.amazon.smithy.model.shapes.ServiceShape; @@ -147,30 +145,15 @@ private getIdentityProviderConfigProvider() { s.getModel(), s.getSettings()); ServiceIndex serviceIndex = ServiceIndex.of(s.getModel()); - Map httpAuthSchemes - = AuthUtils.getAllEffectiveNoAuthAwareAuthSchemes(s.getService(), serviceIndex, authIndex); - // TODO(experimentalIdentityAndAuth): figure out a better deduping strategy - Map visitedConfigFields = new HashMap<>(); + Map httpAuthSchemes = + AuthUtils.getAllEffectiveNoAuthAwareAuthSchemes(s.getService(), serviceIndex, authIndex); for (HttpAuthScheme scheme : httpAuthSchemes.values()) { if (scheme == null) { continue; } for (ConfigField configField : scheme.getConfigFields()) { - if (visitedConfigFields.containsKey(configField.name())) { - ConfigField visitedConfigField = visitedConfigFields.get(configField.name()); - if (!configField.equals(visitedConfigField)) { - throw new CodegenException("Contradicting `ConfigField` definitions for `" - + configField.name() - + "`; existing: " - + visitedConfigField - + ", conflict: " - + configField); - } - } else { - visitedConfigFields.put(configField.name(), configField); - if (configField.type().equals(ConfigField.Type.MAIN)) { - w.write("$S: config.$L,", scheme.getSchemeId().toString(), configField.name()); - } + if (configField.type().equals(ConfigField.Type.MAIN)) { + w.write("$S: config.$L,", scheme.getSchemeId().toString(), configField.name()); } } }