Skip to content

Commit

Permalink
[compiler] Enum-driven visibility (#4825)
Browse files Browse the repository at this point in the history
This PR implements the design described in the Enum-Driven Visibility
rework discussions.

There is still some work to be done:

- [x] Testing of new functionality (existing tests are almost all
passing)
- [x] Diagnosing remaining failure w.r.t. Resource create operations in
TypeSpec/REST
- [ ] Validate no breaking changes to Azure specifications.
- [x] Documentation review and updating existing visibility
documentation to describe new behavior.

The design documents are located at the following gist:
https://gist.github.com/witemple-msft/f122c1fce83e72d102290b5678930ac5

---------

Co-authored-by: Will Temple <[email protected]>
Co-authored-by: Timothee Guerin <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent 34af566 commit 050139d
Show file tree
Hide file tree
Showing 32 changed files with 4,274 additions and 415 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@typespec/compiler"
---

Adds support for enum-driven visibility in the compiler core.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: internal
packages:
- "@typespec/http"
- "@typespec/openapi"
---

Mask deprecation on getVisibility
5 changes: 4 additions & 1 deletion packages/compiler/.scripts/gen-extern-signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ for (const [namespace, diagnostics] of resolved) {

const files = await generateExternDecorators(program, "@typespec/compiler", { namespaces });
for (const [name, content] of Object.entries(files)) {
const updatedContent = content.replace(/from "\@typespec\/compiler"/g, `from "../src/index.js"`);
const updatedContent = content.replace(
/from "\@typespec\/compiler"/g,
name.endsWith(".ts-test.ts") ? `from "../src/index.js"` : `from "../src/core/index.js"`,
);
const prettierConfig = await resolveConfig(root);

await NodeHost.writeFile(
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/generated-defs/TypeSpec.Prototypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DecoratorContext, Type } from "../src/index.js";
import type { DecoratorContext, Type } from "../src/core/index.js";

export type GetterDecorator = (context: DecoratorContext, target: Type) => void;

Expand Down
Loading

0 comments on commit 050139d

Please sign in to comment.