Skip to content

[compiler] Add nesting and scalar handling for getPlausibleName #7153

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

Merged
merged 4 commits into from
May 1, 2025

Conversation

maorleger
Copy link
Member

@maorleger maorleger commented Apr 28, 2025

Fixes a few known cases where getPlausibleName is not providing the right result

Few examples:

      model Foo<T> {t: T};
      model Box<T> {t: T};
      scalar myInt extends int32;
      @test model Bar {
        stringArrayArray: Array<Array<string>>;
        stringFoo: Foo<string>;
        boxFoo: Box<Foo<string>>;
        int32Array: Array<myInt>;
      }
field type before after
stringArrayArray Array<Array<string>> ArrayArray StringArrayArray
stringFoo Foo<string> stringFoo StringFoo
boxFoo Box<Foo<string>> FooBox StringFooBox
int32Array Array<myInt> myIntArray MyIntArray

Resolves #6961

@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Apr 28, 2025
Copy link
Contributor

github-actions bot commented Apr 28, 2025

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - fix ✏️

Fixes handling of nested templates in getPlausibleName

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 28, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@maorleger maorleger force-pushed the get-plausible-name-fixes branch from 7c937f4 to c9a49b5 Compare May 1, 2025 19:21
@maorleger maorleger enabled auto-merge May 1, 2025 19:35
@maorleger maorleger added this pull request to the merge queue May 1, 2025
Merged via the queue into microsoft:main with commit 1608eb2 May 1, 2025
22 checks passed
@maorleger maorleger deleted the get-plausible-name-fixes branch May 1, 2025 20:12
github-merge-queue bot pushed a commit that referenced this pull request May 2, 2025
Follow-up from
#7153 (comment) -
we noticed that many packages have their own copy of this helper so this
PR moves it to the compiler where packages can use it.

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[typekit] getPlausibleName doesn't handle arrays, nested types, or scalars properly
4 participants