@typespec/compiler 0.65.0-dev.4 → 0.65.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/manifest.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export default {
2
- "version": "0.65.0-dev.4",
3
- "commit": "34e32f95aa2a3ccc26b2afad21db11a822a265d6"
2
+ "version": "0.65.0-dev.6",
3
+ "commit": "dd65f86b4a9adbd78ee76e44510b6090247fd4bd"
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/compiler",
3
- "version": "0.65.0-dev.4",
3
+ "version": "0.65.0-dev.6",
4
4
  "description": "TypeSpec Compiler Preview",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "MIT",
@@ -84,12 +84,12 @@
84
84
  "devDependencies": {
85
85
  "@types/babel__code-frame": "~7.0.6",
86
86
  "@types/mustache": "~4.2.5",
87
- "@types/node": "~22.10.7",
87
+ "@types/node": "~22.10.10",
88
88
  "@types/prompts": "~2.4.9",
89
89
  "@types/semver": "^7.5.8",
90
90
  "@types/yargs": "~17.0.33",
91
91
  "@typespec/internal-build-utils": "~0.64.0 || >=0.65.0-dev <0.65.0",
92
- "@vitest/coverage-v8": "^3.0.3",
92
+ "@vitest/coverage-v8": "^3.0.4",
93
93
  "@vitest/ui": "^3.0.3",
94
94
  "c8": "^10.1.3",
95
95
  "grammarkdown": "~3.3.2",
@@ -97,7 +97,7 @@
97
97
  "source-map-support": "~0.5.21",
98
98
  "tmlanguage-generator": "~0.5.10 || >=0.6.0-dev <0.6.0",
99
99
  "typescript": "~5.7.3",
100
- "vitest": "^3.0.3",
100
+ "vitest": "^3.0.4",
101
101
  "vscode-oniguruma": "~2.0.1",
102
102
  "vscode-textmate": "~9.2.0"
103
103
  },
@@ -0,0 +1,9 @@
1
+ # MacOS
2
+ .DS_Store
3
+
4
+ # Default TypeSpec output
5
+ tsp-output/
6
+ dist/
7
+
8
+ # Dependency directories
9
+ node_modules/
@@ -0,0 +1,40 @@
1
+ import "@typespec/http";
2
+
3
+ using TypeSpec.Http;
4
+ @service({
5
+ title: "Widget Service",
6
+ })
7
+ namespace DemoService;
8
+
9
+ model Widget {
10
+ @visibility("read", "update")
11
+ @path
12
+ id: string;
13
+
14
+ weight: int32;
15
+ color: "red" | "blue";
16
+ }
17
+
18
+ @error
19
+ model Error {
20
+ code: int32;
21
+ message: string;
22
+ }
23
+
24
+ @route("/widgets")
25
+ @tag("Widgets")
26
+ interface Widgets {
27
+ /** List widgets */
28
+ @get list(): Widget[] | Error;
29
+ /** Read widgets */
30
+ @get read(@path id: string): Widget | Error;
31
+ /** Create a widget */
32
+ @post create(...Widget): Widget | Error;
33
+ /** Update a widget */
34
+ @patch update(...Widget): Widget | Error;
35
+ /** Delete a widget */
36
+ @delete delete(@path id: string): void | Error;
37
+
38
+ /** Analyze a widget */
39
+ @route("{id}/analyze") @post analyze(@path id: string): string | Error;
40
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "rest",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "peerDependencies": {
6
+ "@typespec/compiler": "latest",
7
+ "@typespec/http": "latest",
8
+ "@typespec/rest": "latest",
9
+ "@typespec/openapi": "latest",
10
+ "@typespec/openapi3": "latest"
11
+ },
12
+ "devDependencies": {
13
+ "@typespec/compiler": "latest",
14
+ "@typespec/http": "latest",
15
+ "@typespec/rest": "latest",
16
+ "@typespec/openapi": "latest",
17
+ "@typespec/openapi3": "latest"
18
+ },
19
+ "private": true
20
+ }
@@ -0,0 +1,16 @@
1
+ # extends: ../tspconfig.yaml # Extend another config file
2
+ # emit: # Emitter name
3
+ # - "<emitter-name"
4
+ # options: # Emitter options
5
+ # <emitter-name>:
6
+ # "<option-name>": "<option-value>"
7
+ # environment-variables: # Environment variables which can be used to interpolate emitter options
8
+ # <variable-name>:
9
+ # default: "<variable-default>"
10
+ # parameters: # Parameters which can be used to interpolate emitter options
11
+ # <param-name>:
12
+ # default: "<param-default>"
13
+ # trace: # Trace areas to enable tracing
14
+ # - "<trace-name>"
15
+ # warn-as-error: true # Treat warnings as errors
16
+ # output-dir: "{project-root}/_generated" # Configure the base output directory for all emitters
@@ -0,0 +1,40 @@
1
+ import "@typespec/http";
2
+
3
+ using TypeSpec.Http;
4
+ @service({
5
+ title: "Widget Service",
6
+ })
7
+ namespace DemoService;
8
+
9
+ model Widget {
10
+ @visibility("read", "update")
11
+ @path
12
+ id: string;
13
+
14
+ weight: int32;
15
+ color: "red" | "blue";
16
+ }
17
+
18
+ @error
19
+ model Error {
20
+ code: int32;
21
+ message: string;
22
+ }
23
+
24
+ @route("/widgets")
25
+ @tag("Widgets")
26
+ interface Widgets {
27
+ /** List widgets */
28
+ @get list(): Widget[] | Error;
29
+ /** Read widgets */
30
+ @get read(@path id: string): Widget | Error;
31
+ /** Create a widget */
32
+ @post create(...Widget): Widget | Error;
33
+ /** Update a widget */
34
+ @patch update(...Widget): Widget | Error;
35
+ /** Delete a widget */
36
+ @delete delete(@path id: string): void | Error;
37
+
38
+ /** Analyze a widget */
39
+ @route("{id}/analyze") @post analyze(@path id: string): string | Error;
40
+ }
@@ -12,13 +12,59 @@
12
12
  "libraries": [
13
13
  "@typespec/http",
14
14
  "@typespec/rest",
15
+ "@typespec/openapi",
15
16
  "@typespec/openapi3"
16
17
  ],
17
- "config": {
18
- "emit": [
19
- "@typespec/openapi3"
20
- ]
21
- }
18
+ "emitters": {
19
+ "@typespec/openapi3": {
20
+ "selected": true,
21
+ "options": {
22
+ "emitter-output-dir": "{output-dir}/schema"
23
+ }
24
+ },
25
+ "@typespec/http-client-csharp": {
26
+ "description": "CSharp Client emitter",
27
+ "options": {
28
+ "emitter-output-dir": "{output-dir}/clients/csharp"
29
+ }
30
+ },
31
+ "@typespec/http-client-java": {
32
+ "description": "Java Client emitter",
33
+ "options": {
34
+ "emitter-output-dir": "{output-dir}/clients/java"
35
+ }
36
+ },
37
+ "@typespec/http-client-js": {
38
+ "description": "JavaScript Client emitter",
39
+ "options": {
40
+ "emitter-output-dir": "{output-dir}/clients/js"
41
+ }
42
+ },
43
+ "@typespec/http-client-python": {
44
+ "description": "Python Client emitter",
45
+ "options": {
46
+ "emitter-output-dir": "{output-dir}/clients/python"
47
+ }
48
+ },
49
+ "@typespec/http-server-csharp": {
50
+ "description": "CSharp server stubs",
51
+ "options": {
52
+ "emitter-output-dir": "{output-dir}/server"
53
+ }
54
+ },
55
+ "@typespec/http-server-js": {
56
+ "description": "Javascript server stubs",
57
+ "options": {
58
+ "emitter-output-dir": "{output-dir}/server"
59
+ }
60
+ }
61
+ },
62
+ "files": [
63
+ {
64
+ "path": "rest/main.tsp",
65
+ "destination": "main.tsp"
66
+ }
67
+ ]
22
68
  },
23
69
  "library-ts": {
24
70
  "title": "TypeSpec Library (With TypeScript)",