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

[tcgc] Namespace support #1786

Merged
merged 14 commits into from
Nov 6, 2024
Merged

Conversation

tadelesh
Copy link
Member

@tadelesh tadelesh commented Nov 1, 2024

resolve: #1604
resolve: #1722

Usage

  1. use clientNamespace property from SdkModelType SdkEnumType SdkNullableType SdkUnionType
  2. use namespaces property from SdkPackage, this will return SdkNamespace[] which contains the root namespaces, each SdkNamespace contains clients/models/enums/unions/namespaces belong to this namespace.

* namespace Contoso;
* ```
*/
extern dec clientNamespace(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current impl for @clientNamespace will need author to use full qualified name to do the namespace renaming.

@@ -691,6 +699,17 @@ export interface SdkPackage<TServiceOperation extends SdkServiceOperation> {
enums: SdkEnumType[];
unions: (SdkUnionType | SdkNullableType)[];
crossLanguagePackageId: string;
namespaces: SdkNamespace<TServiceOperation>[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of providing helper function, i put the namespaces hierarchy info into the current SdkPackage type and introduced another SdkNamepace type to wrapper the namespace contents.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Nov 5, 2024

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - feature ✏️

support client namespace

Copy link
Member

@weidongxu-microsoft weidongxu-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM.

Though we probably still need more discussion on namespace on template instances.

We can start with this PR (and a patch release), and iterate upon it if necessary.

PS: do we need to update all cadl-ranch cases? I guess Java would had to add @clientNamespace to all of them (about the com. prefix) -- not sure about other languages.

Copy link
Member

@weidongxu-microsoft weidongxu-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for me as a starter.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@tadelesh tadelesh changed the base branch from main to release/november-2024 November 6, 2024 07:54
@tadelesh
Copy link
Member Author

tadelesh commented Nov 6, 2024

@iscai-msft do you have any concern for this pr? i supposed to make it in the nov release, but obviously i missed it. so, i chagned to merge to release branch and will release a hotfix with the new ns support. language's emitters depend on this.

@iscai-msft iscai-msft merged commit 83f824e into release/november-2024 Nov 6, 2024
22 checks passed
@iscai-msft iscai-msft deleted the namespace_support branch November 6, 2024 15:46
@iscai-msft
Copy link
Contributor

i'll do a release of this today @tadelesh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespace refactoring TCGC Author doc [tcgc] namespaces in TCGC
4 participants