@@ -27,7 +27,7 @@ model User {
27
27
username : string ;
28
28
29
29
/** The user's email address */
30
- @ format ("email" )
30
+ // @format("email") - crashes emitters for now
31
31
email : string ;
32
32
33
33
/**
@@ -44,7 +44,7 @@ model User {
44
44
@ jsonSchema
45
45
model TodoItem {
46
46
/** The item's unique id */
47
- @ key id : safeint ;
47
+ @ visibility ( "read" ) @ key id : safeint ;
48
48
49
49
/** The item's title */
50
50
@ maxLength (255 )
@@ -73,7 +73,11 @@ model TodoItem {
73
73
74
74
// Want the read form to be normalized to TodoLabelRecord[], but can't
75
75
// https://github.com/microsoft/typespec/issues/2926
76
- labels : TodoLabels ;
76
+ labels ? : TodoLabels ;
77
+
78
+ // hack to get a different schema for create
79
+ // (fastify glue doesn't support readonly)
80
+ @ visibility ("create" ) _dummy ? : string ;
77
81
}
78
82
79
83
@ jsonSchema
@@ -272,14 +276,18 @@ namespace TodoItems {
272
276
273
277
@ list op list (... PaginationControls ): WithStandardErrors <TodoPage >;
274
278
279
+ // want to be able to control the operation id of the shared route
280
+ // (no concat logic).
275
281
@ sharedRoute
282
+ @ OpenAPI.operationId ("TodoItems" )
276
283
@ post
277
284
op createJson (
278
285
@ header contentType : "application/json" ,
279
286
item : TodoItem ,
280
- attachments : TodoAttachment [],
287
+ attachments ? : TodoAttachment [],
281
288
): WithStandardErrors <TodoItem | InvalidTodoItem >;
282
289
290
+ @ OpenAPI.operationId ("create" )
283
291
@ sharedRoute
284
292
@ post
285
293
op createForm (
0 commit comments