-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implement scope negation for TCGC #1783
Conversation
packages/typespec-client-generator-core/test/decorators.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also change the documentation for the scope parameter in decorators.tsp
to explain the patten could be used in scope
packages/typespec-client-generator-core/test/decorators.test.ts
Outdated
Show resolved
Hide resolved
All changed packages have been documented.
Show changes
|
You can try these changes here
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the algorithm looks good. please merge before you refine the test.
packages/typespec-client-generator-core/test/decorators.test.ts
Outdated
Show resolved
Hide resolved
packages/typespec-client-generator-core/test/decorators.test.ts
Outdated
Show resolved
Hide resolved
Resolves Azure#1596 There are 2 formats of scope negation: ``` @clientName("A", "!(python, java)") Model foo ``` is equivalent to ``` @clientName("A", "!python, !java") Model foo ``` We allow combination of normal scope and negation scope for different scopes ``` @clientName("A", "!python, csharp") Model foo ``` Combination of same scope is also allowed ``` @clientName("A", "!python, python") Model foo ``` is equivalent to ``` @clientName("A", "!python") @clientName("A", "python") Model foo ``` and equivalent to ``` @clientName("A") Model foo ``` The rule for decorator override: - for the same scope, the later decorator value wins regardless it's defined with normal scope or scope negation Detailed override cases can be found in the tests of this PR.
Resolves #1596
There are 2 formats of scope negation:
is equivalent to
We allow combination of normal scope and negation scope for different scopes
Combination of same scope is also allowed
is equivalent to
and equivalent to
The rule for decorator override:
Detailed override cases can be found in the tests of this PR.