You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+19-13Lines changed: 19 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ Both queries & mutations can accept a set of their inputs via URL path parameter
126
126
127
127
#### Query
128
128
129
-
Query inputs are always accepted as a `string`, if you wish to support other primitives such as `number`, `boolean`, `Date` etc. please use [`z.preprocess()`](https://github.com/colinhacks/zod#preprocess).
129
+
Query (& path parameter) inputs are always accepted as a `string`, if you wish to support other primitives such as `number`, `boolean`, `Date` etc. please use [`z.preprocess()`](https://github.com/colinhacks/zod#preprocess).
Any custom headers can be specified in the `meta.openapi.headers` array, these headers will not be validated on request. Please consider using [Authorization](#authorization) for first-class OpenAPI auth/security support.
174
+
171
175
## HTTP Responses
172
176
173
177
Inspired by [Slack Web API](https://api.slack.com/web).
@@ -181,16 +185,17 @@ Please see [error status codes here](src/adapters/node-http/errors.ts).
181
185
```jsonc
182
186
{
183
187
"ok":true,
184
-
"data":"This is good"/* tRPC procedure output*/
188
+
"data":"This is good"/*Output from tRPC procedure */
185
189
}
186
190
```
187
191
188
192
```jsonc
189
193
{
190
194
"ok":false,
191
195
"error": {
192
-
"message":"This is bad"/* Message from TRPCError */,
193
-
"code":"BAD_REQUEST"/* Code from TRPCError */
196
+
"message":"This is bad", /* Message from TRPCError */,
197
+
"code":"BAD_REQUEST", /* Code from TRPCError */
198
+
"issues": [...] /* (optional) ZodIssues[] from TRPCError */
194
199
}
195
200
}
196
201
```
@@ -305,15 +310,16 @@ Please see [full typings here](src/generator/index.ts).
|`enabled`|`boolean`| Exposes this procedure to `trpc-openapi` adapters and on the OpenAPI document. |`true`|`false`|
311
-
|`method`|`HttpMethod`| Method this endpoint is exposed on. Value can be `GET`/`DELETE` for queries OR `POST`/`PUT`/`PATCH` for mutations. |`true`|`undefined`|
312
-
|`path`|`string`| Pathname this endpoint is exposed on. Value must start with `/`, specify path parameters using `{}`. |`true`|`undefined`|
313
-
|`protect`|`boolean`| Requires this endpoint to use an `Authorization` header credential with `Bearer` scheme on OpenAPI document. |`false`|`false`|
314
-
|`summary`|`string`| A short summary of the endpoint included in the OpenAPI document. |`false`|`undefined`|
315
-
|`description`|`string`| A verbose description of the endpoint included in the OpenAPI document. |`false`|`undefined`|
316
-
|`tags`|`string[]`| A list of tags used for logical grouping of endpoints in the OpenAPI document. |`false`|`undefined`|
|`enabled`|`boolean`| Exposes this procedure to `trpc-openapi` adapters and on the OpenAPI document. |`true`|`false`|
316
+
|`method`|`HttpMethod`| Method this endpoint is exposed on. Value can be `GET`/`DELETE` for queries OR `POST`/`PUT`/`PATCH` for mutations. |`true`|`undefined`|
317
+
|`path`|`string`| Pathname this endpoint is exposed on. Value must start with `/`, specify path parameters using `{}`. |`true`|`undefined`|
318
+
|`protect`|`boolean`| Requires this endpoint to use an `Authorization` header credential with `Bearer` scheme on OpenAPI document. |`false`|`false`|
319
+
|`summary`|`string`| A short summary of the endpoint included in the OpenAPI document. |`false`|`undefined`|
320
+
|`description`|`string`| A verbose description of the endpoint included in the OpenAPI document. |`false`|`undefined`|
321
+
|`tags`|`string[]`| A list of tags used for logical grouping of endpoints in the OpenAPI document. |`false`|`undefined`|
322
+
|`headers`|`ParameterObject[]`| An array of custom headers to add for this endpoint in the OpenAPI document. |`false`|`undefined`|
0 commit comments