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; +}