Skip to content

Commit ca8a3aa

Browse files
committed
Minor spec updates, implement non-multipart create, implement typescript sample
1 parent 47fdec6 commit ca8a3aa

30 files changed

+407
-1341
lines changed

main.tsp

+12-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ model User {
2727
username: string;
2828

2929
/** The user's email address */
30-
@format("email")
30+
// @format("email") - crashes emitters for now
3131
email: string;
3232

3333
/**
@@ -44,7 +44,7 @@ model User {
4444
@jsonSchema
4545
model TodoItem {
4646
/** The item's unique id */
47-
@key id: safeint;
47+
@visibility("read") @key id: safeint;
4848

4949
/** The item's title */
5050
@maxLength(255)
@@ -73,7 +73,11 @@ model TodoItem {
7373

7474
// Want the read form to be normalized to TodoLabelRecord[], but can't
7575
// 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;
7781
}
7882

7983
@jsonSchema
@@ -272,14 +276,18 @@ namespace TodoItems {
272276

273277
@list op list(...PaginationControls): WithStandardErrors<TodoPage>;
274278

279+
// want to be able to control the operation id of the shared route
280+
// (no concat logic).
275281
@sharedRoute
282+
@OpenAPI.operationId("TodoItems")
276283
@post
277284
op createJson(
278285
@header contentType: "application/json",
279286
item: TodoItem,
280-
attachments: TodoAttachment[],
287+
attachments?: TodoAttachment[],
281288
): WithStandardErrors<TodoItem | InvalidTodoItem>;
282289

290+
@OpenAPI.operationId("create")
283291
@sharedRoute
284292
@post
285293
op createForm(

0 commit comments

Comments
 (0)