Skip to content

Commit

Permalink
🔥 Remove operation template
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
connorjs committed Sep 10, 2023
1 parent be10da1 commit 5d7e5b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 44 deletions.
16 changes: 12 additions & 4 deletions src/films.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ using TypeSpec.Http;

namespace SWAPI;

// Dev note: See `operation-template.tsp`

@route("/films")
namespace films {
/**
* Get all the films resources.
*
* @param search Case-insensitive partial match on the `name` field.
*/
@OpenAPI.operationId("ListFilms")
op list is List<Film>;
op list(@query search: string): Film[];

/**
* Get a specific film resource.
*
* @param filmId Numeric ID of the film to get.
*/
@OpenAPI.operationId("GetFilm")
op read is Get<Film>;
op read(@path filmId: int32): Film;
}

/** A Film resource is a single film. */
Expand Down
1 change: 0 additions & 1 deletion src/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "@typespec/http";
import "@typespec/openapi";

import "./films.tsp";
import "./operation-templates.tsp";
import "./people.tsp";
import "./planets.tsp";
import "./root.tsp";
Expand Down
39 changes: 0 additions & 39 deletions src/operation-templates.tsp

This file was deleted.

0 comments on commit 5d7e5b6

Please sign in to comment.