Closed JEONGHWANMIN closed 1 year ago
As we update tspec version to 0.1.97, we support header and cookie params!🎉 You can see the example in https://github.com/ts-spec/tspec/blob/main/examples/tspec-basic-example/index.ts
import { Tspec } from "tspec";
/** Schema description defined by JSDoc */
interface Book {
/** Field description defined by JSDoc */
id: number;
title: string;
description?: string;
}
export type BookApiSpec = Tspec.DefineApiSpec<{
tags: ['Book']
paths: {
'/books/{id}': {
get: {
summary: 'Get book by id',
path: { id: number },
header: { 'X-Request-ID': string },
cookie: { debug: 0 | 1 },
responses: { 200: Book },
},
},
}
}>;
ISSUE
I use tspec to create an api spec, but there is nothing customizable in the headers area. Are there any options that I can customize now?
I want to specify in the header to put refreshToken or accessToken.
The code I wrote is below.