typespec-rust-emitter 0.1.0 → 0.3.0

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.
@@ -1,48 +1,38 @@
1
1
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)]
2
2
  #[error("{code}: {message}")]
3
- pub struct ApiError
4
- {
5
-
3
+ pub struct ApiError {
6
4
  /// Machine-readable error code.
7
5
  pub code: String,
8
-
9
6
  /// Human-readable message.
10
7
  pub message: String,
11
8
  }
12
9
 
13
10
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)]
14
11
  #[error("{code}: {message}")]
15
- pub struct NotFoundError
16
- {
12
+ pub struct NotFoundError {
17
13
  pub code: String,
18
-
19
14
  /// Human-readable message.
20
15
  pub message: String,
21
16
  }
22
17
 
23
18
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)]
24
19
  #[error("{code}: {message}")]
25
- pub struct ValidationError
26
- {
20
+ pub struct ValidationError {
27
21
  pub code: String,
28
-
29
22
  /// Human-readable message.
30
23
  pub message: String,
31
24
  }
32
25
 
33
26
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)]
34
27
  #[error("{code}: {message}")]
35
- pub struct ConflictError
36
- {
28
+ pub struct ConflictError {
37
29
  pub code: String,
38
-
39
30
  /// Human-readable message.
40
31
  pub message: String,
41
32
  }
42
33
 
43
34
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
44
- pub struct DurationStats
45
- {
35
+ pub struct DurationStats {
46
36
  #[serde(rename = "durationTotal")]
47
37
  pub duration_total: i64,
48
38
  #[serde(rename = "durationDay")]
@@ -54,8 +44,7 @@ pub struct DurationStats
54
44
  }
55
45
 
56
46
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
57
- pub struct Group
58
- {
47
+ pub struct Group {
59
48
  pub id: i64,
60
49
  #[serde(rename = "accountId")]
61
50
  pub account_id: uuid::Uuid,
@@ -72,8 +61,7 @@ pub struct Group
72
61
  }
73
62
 
74
63
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
75
- pub struct GroupStatistics
76
- {
64
+ pub struct GroupStatistics {
77
65
  pub id: i64,
78
66
  #[serde(rename = "accountId")]
79
67
  pub account_id: uuid::Uuid,
@@ -101,8 +89,7 @@ pub struct GroupStatistics
101
89
  }
102
90
 
103
91
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
104
- pub struct CreateGroupBody
105
- {
92
+ pub struct CreateGroupBody {
106
93
  pub name: String,
107
94
  pub icon: String,
108
95
  #[serde(rename = "colorText")]
@@ -112,8 +99,7 @@ pub struct CreateGroupBody
112
99
  }
113
100
 
114
101
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
115
- pub struct UpdateGroupBody
116
- {
102
+ pub struct UpdateGroupBody {
117
103
  #[serde(skip_serializing_if = "Option::is_none")]
118
104
  pub name: Option<String>,
119
105
  #[serde(skip_serializing_if = "Option::is_none")]
@@ -127,8 +113,7 @@ pub struct UpdateGroupBody
127
113
  }
128
114
 
129
115
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
130
- pub struct Subject
131
- {
116
+ pub struct Subject {
132
117
  pub id: i64,
133
118
  #[serde(rename = "accountId")]
134
119
  pub account_id: uuid::Uuid,
@@ -147,8 +132,7 @@ pub struct Subject
147
132
  }
148
133
 
149
134
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
150
- pub struct SubjectStatistics
151
- {
135
+ pub struct SubjectStatistics {
152
136
  pub id: i64,
153
137
  #[serde(rename = "accountId")]
154
138
  pub account_id: uuid::Uuid,
@@ -176,8 +160,7 @@ pub struct SubjectStatistics
176
160
  }
177
161
 
178
162
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
179
- pub struct CreateSubjectBody
180
- {
163
+ pub struct CreateSubjectBody {
181
164
  pub name: String,
182
165
  pub icon: String,
183
166
  #[serde(rename = "colorText")]
@@ -187,8 +170,7 @@ pub struct CreateSubjectBody
187
170
  }
188
171
 
189
172
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
190
- pub struct UpdateSubjectBody
191
- {
173
+ pub struct UpdateSubjectBody {
192
174
  #[serde(skip_serializing_if = "Option::is_none")]
193
175
  pub name: Option<String>,
194
176
  #[serde(skip_serializing_if = "Option::is_none")]
@@ -202,8 +184,7 @@ pub struct UpdateSubjectBody
202
184
  }
203
185
 
204
186
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
205
- pub struct Log
206
- {
187
+ pub struct Log {
207
188
  pub id: i64,
208
189
  #[serde(rename = "accountId")]
209
190
  pub account_id: uuid::Uuid,
@@ -219,8 +200,7 @@ pub struct Log
219
200
  }
220
201
 
221
202
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
222
- pub struct Timelog
223
- {
203
+ pub struct Timelog {
224
204
  pub id: i64,
225
205
  #[serde(rename = "accountId")]
226
206
  pub account_id: uuid::Uuid,
@@ -237,28 +217,26 @@ pub struct Timelog
237
217
  }
238
218
 
239
219
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
240
- pub struct SessionOpenedResponse
241
- {
220
+ pub struct SessionOpenedResponse {
242
221
  pub log: Log,
243
222
  pub timelog: Timelog,
244
223
  }
245
224
 
246
225
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
247
- pub struct SessionClosedResponse
248
- {
226
+ pub struct SessionClosedResponse {
249
227
  pub log: Log,
250
228
  pub timelog: Timelog,
251
229
  }
252
230
 
253
231
  #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
254
- pub struct SessionNoteBody
255
- {
232
+ pub struct SessionNoteBody {
256
233
  #[serde(rename = "logContent")]
257
234
  #[serde(skip_serializing_if = "Option::is_none")]
258
235
  pub log_content: Option<String>,
259
236
  }
260
237
 
261
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
238
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, sqlx::Type)]
239
+ #[sqlx(type_name = "study_status")]
262
240
  pub enum StudyStatus {
263
241
  #[serde(rename = "Starting")]
264
242
  Starting,
@@ -17,8 +17,7 @@
17
17
  }
18
18
  },
19
19
  "..": {
20
- "name": "typespec-rust-emitter",
21
- "version": "0.1.0",
20
+ "version": "0.2.0",
22
21
  "license": "MIT",
23
22
  "devDependencies": {
24
23
  "@types/node": "latest",
package/justfile CHANGED
@@ -6,10 +6,13 @@ install:
6
6
  cd example && npm install
7
7
 
8
8
  compile: install
9
- cd example && rm -rf output-rust/src/generated && mkdir -p output-rust/src/generated && tsp compile . && echo 'mod types;' > output-rust/src/generated/mod.rs
9
+ cd example && rm -rf output-rust/src/generated && mkdir -p output-rust/src/generated && tsp compile . && echo 'pub mod server;' > output-rust/src/generated/mod.rs && echo 'pub mod types;' >> output-rust/src/generated/mod.rs
10
10
 
11
11
  test:
12
12
  npm test
13
13
 
14
14
  check-rust:
15
15
  cd example/output-rust && cargo check
16
+
17
+ publish:
18
+ npm run build && npm publish
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespec-rust-emitter",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "TypeSpec emitter that generates idiomatic Rust types and structs",
5
5
  "keywords": [
6
6
  "typespec",
@@ -11,9 +11,14 @@
11
11
  "api"
12
12
  ],
13
13
  "author": {
14
- "name": "opencode",
15
- "url": "https://opencode.ai"
14
+ "name": "opencode & Qwen"
16
15
  },
16
+ "contributors": [
17
+ {
18
+ "name": "opencode",
19
+ "url": "https://opencode.ai"
20
+ }
21
+ ],
17
22
  "license": "MIT",
18
23
  "repository": {
19
24
  "type": "git",