Skip to content

Commit 5d7e5b6

Browse files
committed
🔥 Remove operation template
Removes operation template in favor of explicit operations (no code reuse across resources). The `films.tsp` diff shows the similarity: the templates did not save that much. Also brings back `filmId` param name.
1 parent be10da1 commit 5d7e5b6

File tree

3 files changed

+12
-44
lines changed

3 files changed

+12
-44
lines changed

src/films.tsp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@ using TypeSpec.Http;
22

33
namespace SWAPI;
44

5-
// Dev note: See `operation-template.tsp`
6-
75
@route("/films")
86
namespace films {
7+
/**
8+
* Get all the films resources.
9+
*
10+
* @param search Case-insensitive partial match on the `name` field.
11+
*/
912
@OpenAPI.operationId("ListFilms")
10-
op list is List<Film>;
13+
op list(@query search: string): Film[];
1114

15+
/**
16+
* Get a specific film resource.
17+
*
18+
* @param filmId Numeric ID of the film to get.
19+
*/
1220
@OpenAPI.operationId("GetFilm")
13-
op read is Get<Film>;
21+
op read(@path filmId: int32): Film;
1422
}
1523

1624
/** A Film resource is a single film. */

src/main.tsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import "@typespec/http";
22
import "@typespec/openapi";
33

44
import "./films.tsp";
5-
import "./operation-templates.tsp";
65
import "./people.tsp";
76
import "./planets.tsp";
87
import "./root.tsp";

src/operation-templates.tsp

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)