From fc1c6ad448f43110a79ab473ef926a91b902174f Mon Sep 17 00:00:00 2001 From: Timo van Veenendaal Date: Wed, 30 Apr 2025 21:41:34 +0000 Subject: [PATCH 1/2] [http-client-js] emit correct diagnostic for unsupported API key auth --- .../components/client-context/client-context-factory.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/http-client-js/src/components/client-context/client-context-factory.tsx b/packages/http-client-js/src/components/client-context/client-context-factory.tsx index e4996855c9b..c254f746789 100644 --- a/packages/http-client-js/src/components/client-context/client-context-factory.tsx +++ b/packages/http-client-js/src/components/client-context/client-context-factory.tsx @@ -113,8 +113,10 @@ function AuthScheme(props: AuthSchemeProps) { ); case "apiKey": if (props.scheme.in !== "header") { - reportDiagnostic($.program, { code: "non-model-parts", target: props.client.service }); - return null; + reportDiagnostic($.program, { + code: "key-credential-non-header-not-implemented", + target: props.client.service, + }); } return ( From 31308a0a726cca6ae319b7984daae976918c8f24 Mon Sep 17 00:00:00 2001 From: Timo van Veenendaal Date: Wed, 30 Apr 2025 21:48:27 +0000 Subject: [PATCH 2/2] Changeset --- ...s-correct-warning-for-apikey-auth-2025-3-30-21-48-15.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/http-client-js-correct-warning-for-apikey-auth-2025-3-30-21-48-15.md diff --git a/.chronus/changes/http-client-js-correct-warning-for-apikey-auth-2025-3-30-21-48-15.md b/.chronus/changes/http-client-js-correct-warning-for-apikey-auth-2025-3-30-21-48-15.md new file mode 100644 index 00000000000..18cf64a07bc --- /dev/null +++ b/.chronus/changes/http-client-js-correct-warning-for-apikey-auth-2025-3-30-21-48-15.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-js" +--- + +Emit correct diagnostic for unsupported API key auth \ No newline at end of file