Skip to content

Commit ecdc8ea

Browse files
authored
[Issue #85] Update core library (#121)
* build(spec): Bumps to the latest typespec packages * fix(spec): Syntax change from typespec bump * feat(spec): Adds tag metadata * refactor(spec): Removes unauthorized response code * refactor: Update examples and templates to latest TypeSpec * build(spec): Bumps prerelease version
1 parent 28d045e commit ecdc8ea

10 files changed

Lines changed: 3295 additions & 1438 deletions

File tree

examples/custom-api/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ import "./routes.tsp"; // Import the overridden route from above
124124
using TypeSpec.Http;
125125
126126
/** Add the Custom API description here */
127-
@service({
128-
title: "Custom API",
129-
})
127+
@service(#{ title: "Custom API" })
130128
namespace CustomAPI;
131129
```
132130

specs/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ import "./routes.tsp"; // Import the routes from above
101101
using TypeSpec.Http;
102102
103103
/** Description of your API goes here */
104-
@service({
105-
title: "Custom API",
106-
})
104+
@service(#{ title: "Custom API" })
107105
namespace CustomAPI;
108106
```
109107

specs/lib/api.tsp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ import "@typespec/openapi";
55

66
using TypeSpec.Http;
77
using TypeSpec.OpenAPI;
8-
98
/** The base OpenAPI specification for a CommonGrants API
109
*
1110
* In order for an API to be "compliant" with the CommonGrants protocol,
1211
* it must implement all of the routes with the "required" tag in this specification.
1312
*/
14-
@service({
15-
title: "CommonGrants Base API",
16-
})
13+
@service(#{ title: "CommonGrants Base API" })
14+
@tagMetadata(
15+
"Opportunities",
16+
#{ description: "Endpoints related to funding opportunities" }
17+
)
18+
@tagMetadata(
19+
"required",
20+
#{
21+
description: "Endpoints that MUST be implemented by all CommonGrants APIs",
22+
}
23+
)
24+
@tagMetadata(
25+
"optional",
26+
#{ description: "Endpoints that MAY be implemented by CommonGrants APIs" }
27+
)
1728
namespace CommonGrants.API;
1829

1930
@tag("Opportunities")

specs/lib/core/routes/opportunities.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface Opportunities {
4949
@list
5050
list<T extends Models.OpportunityBase = Models.OpportunityBase>(
5151
...Pagination.PaginatedQueryParams,
52-
): Responses.Paginated<T> | Responses.Unauthorized;
52+
): Responses.Paginated<T>;
5353

5454
// ##############################
5555
// View an opportunity
@@ -66,7 +66,7 @@ interface Opportunities {
6666
read<T extends Models.OpportunityBase = Models.OpportunityBase>(
6767
/** The ID of the opportunity to view */
6868
@path id: Types.uuid,
69-
): Responses.Ok<T> | Responses.NotFound | Responses.Unauthorized;
69+
): Responses.Ok<T> | Responses.NotFound;
7070

7171
// ###############################
7272
// Search opportunities
@@ -94,5 +94,5 @@ interface Opportunities {
9494

9595
/** Pagination instructions for the results */
9696
pagination?: Pagination.PaginatedBodyParams,
97-
): Responses.Filtered<T, Models.OppFilters> | Responses.Unauthorized;
97+
): Responses.Filtered<T, Models.OppFilters>;
9898
}

0 commit comments

Comments
 (0)