From f356a65f185039929a060dc83b1538f8f4b9d756 Mon Sep 17 00:00:00 2001 From: Connor Sullivan Date: Fri, 8 Sep 2023 21:51:43 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20src=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creates a `src` directory. Prepares for multiple files. --- main.tsp | 26 -------------------------- package.json | 2 +- src/main.tsp | 1 + src/root.tsp | 26 ++++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 main.tsp create mode 100644 src/main.tsp create mode 100644 src/root.tsp diff --git a/main.tsp b/main.tsp deleted file mode 100644 index 3da0cef..0000000 --- a/main.tsp +++ /dev/null @@ -1,26 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; - -using TypeSpec.Http; -using TypeSpec.Rest; - -@service({ - title: "SWAPI: The Star Wars API", - version: "v1", -}) -@server("https://swapi.dev/api/", "SWAPI server") -namespace SWAPI { - @route("/") - @get - op root(): Root; - - // https://swapi.dev/documentation#root - model Root { - films: string; - people: string; - planets: string; - species: string; - starships: string; - vehicles: string; - } -} diff --git a/package.json b/package.json index 964bd30..30b575b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.0.0-prerelease", "type": "module", "scripts": { - "build": "tsp compile .", + "build": "tsp compile src", "format": "prettier -l '**/*.{json,md,tsp,yaml}'", "format:fix": "npm run format -- -w", "prepare": "is-ci || husky install", diff --git a/src/main.tsp b/src/main.tsp new file mode 100644 index 0000000..1e7bb94 --- /dev/null +++ b/src/main.tsp @@ -0,0 +1 @@ +import "./root.tsp"; diff --git a/src/root.tsp b/src/root.tsp new file mode 100644 index 0000000..ebd6908 --- /dev/null +++ b/src/root.tsp @@ -0,0 +1,26 @@ +import "@typespec/http"; +import "@typespec/rest"; + +using TypeSpec.Http; +using TypeSpec.Rest; + +@service({ + title: "SWAPI: The Star Wars API", + version: "v1", +}) +@server("https://swapi.dev/api/", "SWAPI server") +namespace SWAPI; + +@route("/") +@get +op root(): Root; + +// https://swapi.dev/documentation#root +model Root { + films: string; + people: string; + planets: string; + species: string; + starships: string; + vehicles: string; +}