@common-grants/core 0.1.0-alpha.12 → 0.1.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/api.tsp CHANGED
@@ -5,6 +5,7 @@ import "@typespec/openapi";
5
5
 
6
6
  using TypeSpec.Http;
7
7
  using TypeSpec.OpenAPI;
8
+
8
9
  /** The base OpenAPI specification for a CommonGrants API
9
10
  *
10
11
  * In order for an API to be "compliant" with the CommonGrants protocol,
@@ -12,8 +13,8 @@ using TypeSpec.OpenAPI;
12
13
  */
13
14
  @service(#{ title: "CommonGrants Base API" })
14
15
  @tagMetadata(
15
- "Opportunities",
16
- #{ description: "Endpoints related to funding opportunities" }
16
+ "optional",
17
+ #{ description: "Endpoints that MAY be implemented by CommonGrants APIs" }
17
18
  )
18
19
  @tagMetadata(
19
20
  "required",
@@ -22,8 +23,8 @@ using TypeSpec.OpenAPI;
22
23
  }
23
24
  )
24
25
  @tagMetadata(
25
- "optional",
26
- #{ description: "Endpoints that MAY be implemented by CommonGrants APIs" }
26
+ "Opportunities",
27
+ #{ description: "Endpoints related to funding opportunities" }
27
28
  )
28
29
  namespace CommonGrants.API;
29
30
 
@@ -35,7 +35,7 @@ model PaginatedBodyParams {
35
35
  }
36
36
 
37
37
  /** Details about the paginated results */
38
- model PaginationInfo {
38
+ model PaginatedResultsInfo {
39
39
  /** Current page number (indexing starts at 1) */
40
40
  @example(1)
41
41
  @minValue(1)
@@ -75,7 +75,7 @@ model Paginated<T> extends Success {
75
75
  items: T[];
76
76
 
77
77
  /** Details about the paginated results */
78
- paginationInfo: Pagination.PaginationInfo;
78
+ paginationInfo: Pagination.PaginatedResultsInfo;
79
79
  }
80
80
 
81
81
  // ############################################################################
@@ -103,7 +103,7 @@ model Sorted<T> {
103
103
  ...Paginated<T>;
104
104
 
105
105
  /** The sort order of the items */
106
- sortInfo: Sorting.SortInfo;
106
+ sortInfo: Sorting.SortedResultsInfo;
107
107
  }
108
108
 
109
109
  // ############################################################################
@@ -137,5 +137,10 @@ model Filtered<ItemsT, FilterT> extends Success {
137
137
  ...Sorted<ItemsT>;
138
138
 
139
139
  /** The filters applied to the response items */
140
- filterInfo: FilterT;
140
+ filterInfo: {
141
+ filters: FilterT;
142
+
143
+ /** Non-fatal errors that occurred during filtering */
144
+ errors?: string[];
145
+ };
141
146
  }
@@ -82,6 +82,10 @@ interface Opportunities {
82
82
  @post
83
83
  @route("/search")
84
84
  search<T extends Models.OpportunityBase = Models.OpportunityBase>(
85
+ /** Opportunity search query */
86
+ @example("Pre-school education")
87
+ search?: string,
88
+
85
89
  /** Filters to apply to the opportunity search
86
90
  *
87
91
  * Multiple filter conditions will be combined with AND logic, so that
@@ -57,16 +57,19 @@ model SortBodyParams {
57
57
  }
58
58
 
59
59
  /** Information about the sort order of the items returned */
60
- model SortInfo {
61
- /** The field to sort by */
60
+ model SortedResultsInfo {
61
+ /** The field results are sorted by, or "custom" if an implementation-defined sort key is used */
62
62
  @example("lastModifiedAt")
63
63
  sortBy: string;
64
64
 
65
- /** Implementation-defined sort key */
65
+ /** Implementation-defined sort key used to sort the results, if applicable */
66
66
  @example("customField")
67
67
  customSortBy?: string;
68
68
 
69
- /** The order to sort by */
69
+ /** The order in which the results are sorted, e.g. ascending or descending */
70
70
  @example(SortOrder.asc)
71
- sortOrder?: SortOrder;
71
+ sortOrder: SortOrder;
72
+
73
+ /** Non-fatal errors that occurred during sorting */
74
+ errors?: string[];
72
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-grants/core",
3
- "version": "0.1.0-alpha.12",
3
+ "version": "0.1.0-alpha.13",
4
4
  "description": "TypeSpec library for defining grant opportunity data models and APIs",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",