Namespace hierarchy assumptions in the context of client generation with useAuth
#2032
Labels
lib:tcgc
Issues for @azure-tools/typespec-client-generator-core library
We have similar discussions in this but the hierachy assumptions are still unclear for me when mapping to our new client design. Here are my assumptions and questions.
Case 1: One auth with root namespace
Assumptions:
Todo
accepts a parameter for authentication (e.g., BearerAuth or ApiKeyAuth).Users
andTodoItems
. Both of them would share the parent authentication.access
would beAccess.internal
which means they can't be initialized separately;accessorAccess
would beAccess.public
which means they could be got from parent client.Case 2: Different auth in different namespace
Assumptions:
Todo
accepts a parameter for authentication (e.g., BearerAuth or ApiKeyAuth).Users
andTodoItems
. Sub-clientUsers
would override the parent's authentication parameter to align with NoAuth.TodoItems
would share the parent authentication.access
would beAccess.internal
which means they can't be initialized separately;accessorAccess
would beAccess.public
which means they could be got from parent client.If we trust the assumption that
useAuth
should not change the hierarchy, we may see the contradictory point in clientUsers
which requires a construtor overriding but is not allowed to override. One way to correct the conflict is to use@clientInitialization
.I know most of SDK emitters has yet to support different authentication for different clients but considering this would impact the client hierarchy, Could we settle down following questions to reduce future potential breakings?
useAuth
to change the sub-client'saccess
?@clientInitialization
be used in both Azure and unbranded area?/cc @joheredi @tadelesh @ArcturusZhang @weidongxu-microsoft
The text was updated successfully, but these errors were encountered: