Skip to content

[Bug][http-client-js]: @noAuth at namespace level is not properly supported #6847

Open
@qiaozha

Description

@qiaozha

Describe the bug

In todoApp, we have noAuth decorated on the namespace Users

@useAuth(NoAuth)
namespace Users { }

the generated ./src/api/usersClient/usersClientContext.ts file should pass undefined to getClient instead of an undefine credential

export function createUsersClientContext(
  endpoint: string,
  options?: UsersClientOptions,): UsersClientContext {
  const params: Record<string, any> = {
    endpoint: endpoint
  };
  const resolvedEndpoint = "{endpoint}".replace(/{([^}]+)}/g, (_, key) =>
    key in params ? String(params[key]) : (() => { throw new Error(`Missing parameter: ${key}`); })()
-  );;return getClient(resolvedEndpoint,credential,{
+  );;return getClient(resolvedEndpoint,undefined,{
    ...options,
  })
}

Reproduction

https://github.com/allenjzhang/typespec-e2e-demo/tree/main/todoApp/spec

Checklist

Metadata

Metadata

Assignees

Labels

1_0_E2EbugSomething isn't workingemitter:client:jsIssue for the JS client emitter: @typespec/http-client-js

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions