Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple namespaces in client library code generation #4537

Open
5 of 12 tasks
srnagar opened this issue Sep 25, 2024 · 2 comments
Open
5 of 12 tasks

Support multiple namespaces in client library code generation #4537

srnagar opened this issue Sep 25, 2024 · 2 comments
Assignees
Labels
1_0_E2E emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python epic

Comments

@srnagar
Copy link
Member

srnagar commented Sep 25, 2024

Clear and concise description of the problem

Currently, code generators for .NET, Java and Python only support generating client library in a single namespace. Generators use the namespace defined in tspconfig.yaml and ignore the namespaces defined in TypeSpec. This works when we only have a single namespace.

However, there are cases where we need multiple namespaces in the generated library to allow different clients to be in different namespaces (for e.g. OpenAI and Search). So, the proposal is for generators to use the namespaces defined in TypeSpec as the namespaces in client libraries too and not use tspconfig.yaml.

More details on the proposal can be found here.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Spec

Preview Give feedback
  1. weidongxu-microsoft
  2. docs lib:tcgc
    tadelesh

Implementation

Preview Give feedback
  1. lib:tcgc
    iscai-msft
  2. DPG
    weidongxu-microsoft
  3. HRLC p0
    qiaozha
  4. emitter:client:csharp
    ArcturusZhang
  5. Client CodeGen feature-request
    ArcturusZhang
  6. jhendrixMSFT
  7. msyyc
  8. lib:tcgc
    tadelesh
@srnagar srnagar added emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python labels Sep 25, 2024
@srnagar srnagar self-assigned this Sep 25, 2024
@lmazuel lmazuel added the epic label Oct 4, 2024
@lirenhe
Copy link
Member

lirenhe commented Nov 27, 2024

To clarify, we need to support multiple namespaces also for unbranded scenario and the scope includes c#, Java, Python, JS Modular

@weidongxu-microsoft
Copy link
Contributor

weidongxu-microsoft commented Dec 6, 2024

There is models under typespec.rest.resource, e.g. https://github.com/microsoft/typespec/blob/main/packages/rest/lib/resource.tsp#L115-L117

For now, unbranded won't do any default namespace mapping, so they would appear at
https://github.com/allenjzhang/typespec-e2e-demo/blob/main/petstore/clients/java/src/main/java/typespec/rest/resource/PetUpdate.java

Do we need to do a mapping for models from this typespec.rest.resource? <-- Dec. 12, yes, should be in 0.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1_0_E2E emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python epic
Projects
None yet
Development

No branches or pull requests

4 participants