diff --git a/.chronus/changes/fix_builtinTemplate-2025-0-24-1-37-7.md b/.chronus/changes/fix_builtinTemplate-2025-0-24-1-37-7.md new file mode 100644 index 0000000000..4a1d46d3a3 --- /dev/null +++ b/.chronus/changes/fix_builtinTemplate-2025-0-24-1-37-7.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/compiler" +--- + +Adjust built-in init template sample \ No newline at end of file diff --git a/.chronus/changes/fix_builtinTemplate-2025-0-24-21-57-49.md b/.chronus/changes/fix_builtinTemplate-2025-0-24-21-57-49.md new file mode 100644 index 0000000000..279691e4a4 --- /dev/null +++ b/.chronus/changes/fix_builtinTemplate-2025-0-24-21-57-49.md @@ -0,0 +1,8 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: internal +packages: + - typespec-vscode +--- + +update test framework version diff --git a/eng/tsp-core/pipelines/templates/install-browsers.yml b/eng/tsp-core/pipelines/templates/install-browsers.yml index 885b853557..eaa7a6470d 100644 --- a/eng/tsp-core/pipelines/templates/install-browsers.yml +++ b/eng/tsp-core/pipelines/templates/install-browsers.yml @@ -1,5 +1,4 @@ # Template installing browsers steps: - - script: npx playwright install --with-deps + - script: pnpm exec playwright install displayName: Install playwright browsers - workingDirectory: packages/playground-website diff --git a/packages/compiler/.scripts/build-init-templates.ts b/packages/compiler/.scripts/build-init-templates.ts index e6d4c04899..cd6524ee18 100644 --- a/packages/compiler/.scripts/build-init-templates.ts +++ b/packages/compiler/.scripts/build-init-templates.ts @@ -39,7 +39,7 @@ const builtInTemplates: Record<string, InitTemplate> = { "emitter-output-dir": "{output-dir}/clients/java", }, }, - "@typespec/http-client-js": { + "@azure-tools/typespec-ts": { description: "JavaScript Client emitter", options: { "emitter-output-dir": "{output-dir}/clients/js", @@ -54,7 +54,7 @@ const builtInTemplates: Record<string, InitTemplate> = { "@typespec/http-server-csharp": { description: "CSharp server stubs", options: { - "emitter-output-dir": "{output-dir}/server", + "emitter-output-dir": "{output-dir}/server/generated", }, }, "@typespec/http-server-js": { diff --git a/packages/compiler/templates/__snapshots__/rest/main.tsp b/packages/compiler/templates/__snapshots__/rest/main.tsp index 6a185cca88..d5c1d97b5c 100644 --- a/packages/compiler/templates/__snapshots__/rest/main.tsp +++ b/packages/compiler/templates/__snapshots__/rest/main.tsp @@ -7,34 +7,40 @@ using TypeSpec.Http; namespace DemoService; model Widget { - @visibility("read", "update") - @path id: string; - weight: int32; color: "red" | "blue"; } +model WidgetList { + items: Widget[]; +} + @error model Error { code: int32; message: string; } +model AnalyzeResult { + id: string; + analysis: string; +} + @route("/widgets") @tag("Widgets") interface Widgets { /** List widgets */ - @get list(): Widget[] | Error; + @get list(): WidgetList | Error; /** Read widgets */ @get read(@path id: string): Widget | Error; /** Create a widget */ - @post create(...Widget): Widget | Error; + @post create(@body body: Widget): Widget | Error; /** Update a widget */ - @patch update(...Widget): Widget | Error; + @patch update(@path id: string, @body body: Widget): Widget | Error; /** Delete a widget */ @delete delete(@path id: string): void | Error; /** Analyze a widget */ - @route("{id}/analyze") @post analyze(@path id: string): string | Error; + @route("{id}/analyze") @post analyze(@path id: string): AnalyzeResult | Error; } diff --git a/packages/compiler/templates/rest/main.tsp b/packages/compiler/templates/rest/main.tsp index 6a185cca88..d5c1d97b5c 100644 --- a/packages/compiler/templates/rest/main.tsp +++ b/packages/compiler/templates/rest/main.tsp @@ -7,34 +7,40 @@ using TypeSpec.Http; namespace DemoService; model Widget { - @visibility("read", "update") - @path id: string; - weight: int32; color: "red" | "blue"; } +model WidgetList { + items: Widget[]; +} + @error model Error { code: int32; message: string; } +model AnalyzeResult { + id: string; + analysis: string; +} + @route("/widgets") @tag("Widgets") interface Widgets { /** List widgets */ - @get list(): Widget[] | Error; + @get list(): WidgetList | Error; /** Read widgets */ @get read(@path id: string): Widget | Error; /** Create a widget */ - @post create(...Widget): Widget | Error; + @post create(@body body: Widget): Widget | Error; /** Update a widget */ - @patch update(...Widget): Widget | Error; + @patch update(@path id: string, @body body: Widget): Widget | Error; /** Delete a widget */ @delete delete(@path id: string): void | Error; /** Analyze a widget */ - @route("{id}/analyze") @post analyze(@path id: string): string | Error; + @route("{id}/analyze") @post analyze(@path id: string): AnalyzeResult | Error; } diff --git a/packages/compiler/templates/scaffolding.json b/packages/compiler/templates/scaffolding.json index 6a7ebaca17..73d9ff5ca5 100644 --- a/packages/compiler/templates/scaffolding.json +++ b/packages/compiler/templates/scaffolding.json @@ -34,7 +34,7 @@ "emitter-output-dir": "{output-dir}/clients/java" } }, - "@typespec/http-client-js": { + "@azure-tools/typespec-ts": { "description": "JavaScript Client emitter", "options": { "emitter-output-dir": "{output-dir}/clients/js" @@ -49,7 +49,7 @@ "@typespec/http-server-csharp": { "description": "CSharp server stubs", "options": { - "emitter-output-dir": "{output-dir}/server" + "emitter-output-dir": "{output-dir}/server/generated" } }, "@typespec/http-server-js": { diff --git a/packages/typespec-vscode/package.json b/packages/typespec-vscode/package.json index 1093013f96..5ce296efcd 100644 --- a/packages/typespec-vscode/package.json +++ b/packages/typespec-vscode/package.json @@ -254,7 +254,7 @@ "@typespec/internal-build-utils": "workspace:~", "@vitest/coverage-v8": "^3.0.4", "@vitest/ui": "^3.0.3", - "@vscode/test-web": "^0.0.62", + "@vscode/test-web": "^0.0.65", "@vscode/vsce": "~3.2.1", "c8": "^10.1.3", "mocha": "^11.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8256d96481..7ac206cfeb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1931,8 +1931,8 @@ importers: specifier: ^3.0.3 version: 3.0.4(vitest@3.0.4) '@vscode/test-web': - specifier: ^0.0.62 - version: 0.0.62 + specifier: ^0.0.65 + version: 0.0.65 '@vscode/vsce': specifier: ~3.2.1 version: 3.2.1 @@ -5729,8 +5729,8 @@ packages: '@vscode/l10n@0.0.18': resolution: {integrity: sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==} - '@vscode/test-web@0.0.62': - resolution: {integrity: sha512-Ypug5PvhPOPFbuHVilai7t23tm3Wm5geIpC2DB09Gy9o0jZCduramiSdPf+YN7yhkFy1usFYtN3Eaks1XoBrOQ==} + '@vscode/test-web@0.0.65': + resolution: {integrity: sha512-jNc6FyJARgiru/2Y8vXSkaf399JFtTNxAAtwLPzSSU5C4+AJwvOOOhlVHQfmee51R9LIs6uwZryFxmqSfMhniQ==} engines: {node: '>=16'} hasBin: true @@ -5858,10 +5858,6 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} - agent-base@7.1.1: - resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} - engines: {node: '>= 14'} - agent-base@7.1.3: resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} engines: {node: '>= 14'} @@ -8314,10 +8310,6 @@ packages: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - is-generator-function@1.0.10: - resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} - engines: {node: '>= 0.4'} - is-generator-function@1.1.0: resolution: {integrity: sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==} engines: {node: '>= 0.4'} @@ -9751,11 +9743,6 @@ packages: engines: {node: '>=18'} hasBin: true - playwright@1.49.0: - resolution: {integrity: sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==} - engines: {node: '>=18'} - hasBin: true - playwright@1.50.0: resolution: {integrity: sha512-+GinGfGTrd2IfX1TA4N2gNmeIksSb+IAe589ZH+FlmpV3MYTx6+buChGIuDLQwrGNCw2lWibqV50fU510N7S+w==} engines: {node: '>=18'} @@ -16760,21 +16747,21 @@ snapshots: '@vscode/l10n@0.0.18': {} - '@vscode/test-web@0.0.62': + '@vscode/test-web@0.0.65': dependencies: '@koa/cors': 5.0.0 '@koa/router': 13.1.0 '@playwright/browser-chromium': 1.49.0 - glob: 11.0.0 + glob: 11.0.1 gunzip-maybe: 1.4.2 http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.5 + https-proxy-agent: 7.0.6 koa: 2.15.3 koa-morgan: 1.0.1 koa-mount: 4.0.0 koa-static: 5.0.0 minimist: 1.2.8 - playwright: 1.49.0 + playwright: 1.50.0 tar-fs: 3.0.6 vscode-uri: 3.0.8 transitivePeerDependencies: @@ -16923,12 +16910,6 @@ snapshots: transitivePeerDependencies: - supports-color - agent-base@7.1.1: - dependencies: - debug: 4.4.0(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - agent-base@7.1.3: {} ajv-draft-04@1.0.0(ajv@8.13.0): @@ -18616,7 +18597,7 @@ snapshots: es-define-property@1.0.0: dependencies: - get-intrinsic: 1.2.4 + get-intrinsic: 1.2.7 es-define-property@1.0.1: {} @@ -19420,7 +19401,7 @@ snapshots: gopd@1.0.1: dependencies: - get-intrinsic: 1.2.4 + get-intrinsic: 1.2.7 gopd@1.2.0: {} @@ -19500,7 +19481,7 @@ snapshots: has-tostringtag@1.0.2: dependencies: - has-symbols: 1.0.3 + has-symbols: 1.1.0 hasown@2.0.2: dependencies: @@ -19793,7 +19774,7 @@ snapshots: http-proxy-agent@7.0.2: dependencies: - agent-base: 7.1.1 + agent-base: 7.1.3 debug: 4.4.0(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -19807,7 +19788,7 @@ snapshots: https-proxy-agent@7.0.5: dependencies: - agent-base: 7.1.1 + agent-base: 7.1.3 debug: 4.4.0(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -20006,10 +19987,6 @@ snapshots: is-fullwidth-code-point@3.0.0: {} - is-generator-function@1.0.10: - dependencies: - has-tostringtag: 1.0.2 - is-generator-function@1.1.0: dependencies: call-bound: 1.0.3 @@ -20105,7 +20082,7 @@ snapshots: is-symbol@1.0.4: dependencies: - has-symbols: 1.0.3 + has-symbols: 1.1.0 is-symbol@1.1.1: dependencies: @@ -20132,7 +20109,7 @@ snapshots: is-weakset@2.0.3: dependencies: call-bind: 1.0.7 - get-intrinsic: 1.2.4 + get-intrinsic: 1.2.7 is-windows@1.0.2: {} @@ -20428,7 +20405,7 @@ snapshots: fresh: 0.5.2 http-assert: 1.5.0 http-errors: 1.8.1 - is-generator-function: 1.0.10 + is-generator-function: 1.1.0 koa-compose: 4.1.0 koa-convert: 2.0.0 on-finished: 2.4.1 @@ -21867,12 +21844,6 @@ snapshots: playwright-core@1.50.0: {} - playwright@1.49.0: - dependencies: - playwright-core: 1.49.0 - optionalDependencies: - fsevents: 2.3.2 - playwright@1.50.0: dependencies: playwright-core: 1.50.0 @@ -22731,8 +22702,8 @@ snapshots: define-data-property: 1.1.4 es-errors: 1.3.0 function-bind: 1.1.2 - get-intrinsic: 1.2.4 - gopd: 1.0.1 + get-intrinsic: 1.2.7 + gopd: 1.2.0 has-property-descriptors: 1.0.2 set-function-name@2.0.2: @@ -23684,7 +23655,7 @@ snapshots: dependencies: inherits: 2.0.4 is-arguments: 1.1.1 - is-generator-function: 1.0.10 + is-generator-function: 1.1.0 is-typed-array: 1.1.15 which-typed-array: 1.1.18