From dd1deb9b8720b36bcad523b924d07b71bba8fb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Bethune?= Date: Sun, 16 Nov 2025 16:27:14 +0100 Subject: [PATCH] Use object value syntax for @service parameter The example code no longer compiles because the @service decorator expects an #object value parameter in post-1.0 typespec code. Relevant upstream PR: * microsoft/typespec#6108 The updated code has been tested with the latest typespec 1.6 compiler and language server. --- main.tsp.section01 | 4 +--- main.tsp.section02 | 4 +--- main.tsp.section03 | 4 +--- main.tsp.section04 | 4 +--- main.tsp.section05 | 4 +--- main.tsp.section06 | 4 +--- main.tsp.section07 | 4 +--- main.tsp.section08 | 4 +--- 8 files changed, 8 insertions(+), 24 deletions(-) diff --git a/main.tsp.section01 b/main.tsp.section01 index 858e8c8..3dab2c6 100644 --- a/main.tsp.section01 +++ b/main.tsp.section01 @@ -2,9 +2,7 @@ import "@typespec/http"; using TypeSpec.Http; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") namespace PetStore; diff --git a/main.tsp.section02 b/main.tsp.section02 index f1c57c7..c37d6b0 100644 --- a/main.tsp.section02 +++ b/main.tsp.section02 @@ -2,9 +2,7 @@ import "@typespec/http"; using TypeSpec.Http; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") namespace PetStore; diff --git a/main.tsp.section03 b/main.tsp.section03 index 712f369..bcc871d 100644 --- a/main.tsp.section03 +++ b/main.tsp.section03 @@ -2,9 +2,7 @@ import "@typespec/http"; using TypeSpec.Http; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") namespace PetStore; diff --git a/main.tsp.section04 b/main.tsp.section04 index 33a48b9..bbfc7a3 100644 --- a/main.tsp.section04 +++ b/main.tsp.section04 @@ -2,9 +2,7 @@ import "@typespec/http"; using TypeSpec.Http; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") namespace PetStore; diff --git a/main.tsp.section05 b/main.tsp.section05 index 83a68f7..7a10e6c 100644 --- a/main.tsp.section05 +++ b/main.tsp.section05 @@ -2,9 +2,7 @@ import "@typespec/http"; using TypeSpec.Http; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") namespace PetStore; diff --git a/main.tsp.section06 b/main.tsp.section06 index c338dcb..9a4417a 100644 --- a/main.tsp.section06 +++ b/main.tsp.section06 @@ -4,9 +4,7 @@ import "@typespec/versioning"; using TypeSpec.Http; using TypeSpec.Versioning; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") @versioned(Versions) namespace PetStore; diff --git a/main.tsp.section07 b/main.tsp.section07 index 9e19a92..5080224 100644 --- a/main.tsp.section07 +++ b/main.tsp.section07 @@ -4,9 +4,7 @@ import "@typespec/versioning"; using TypeSpec.Http; using TypeSpec.Versioning; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") @versioned(Versions) namespace PetStore; diff --git a/main.tsp.section08 b/main.tsp.section08 index 88f5dbd..f6dcc7a 100644 --- a/main.tsp.section08 +++ b/main.tsp.section08 @@ -8,9 +8,7 @@ import "./petstore/models.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; -@service({ - title: "Pet Store", -}) +@service(#{ title: "Pet Store" }) @server("https://example.com", "Single server endpoint") @versioned(Versions) namespace PetStore;