Skip to content

Commit a60c123

Browse files
committed
Ref: no Omit<> in OpenAPIContext.
1 parent 642744e commit a60c123

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

express-zod-api/src/documentation-helpers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ import { Security } from "./security";
5656
import { ezUploadBrand } from "./upload-schema";
5757
import wellKnownHeaders from "./well-known-headers.json";
5858

59-
export interface OpenAPIContext {
60-
isResponse: boolean;
59+
interface ReqResCommons {
6160
makeRef: (
6261
key: object,
6362
subject: SchemaObject | ReferenceObject,
@@ -67,6 +66,10 @@ export interface OpenAPIContext {
6766
method: Method;
6867
}
6968

69+
export interface OpenAPIContext extends ReqResCommons {
70+
isResponse: boolean;
71+
}
72+
7073
export type Depicter = (
7174
zodCtx: { zodSchema: $ZodType; jsonSchema: JSONSchema.BaseSchema },
7275
oasCtx: OpenAPIContext,
@@ -81,8 +84,6 @@ export type IsHeader = (
8184

8285
export type BrandHandling = Record<string | symbol, Depicter>;
8386

84-
type ReqResCommons = Omit<OpenAPIContext, "isResponse">;
85-
8687
const shortDescriptionLimit = 50;
8788
const isoDateDocumentationUrl =
8889
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString";

express-zod-api/tests/documentation-helpers.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ import {
3434

3535
describe("Documentation helpers", () => {
3636
const makeRefMock = vi.fn();
37-
const requestCtx = {
37+
const requestCtx: OpenAPIContext = {
3838
path: "/v1/user/:id",
3939
method: "get",
4040
isResponse: false,
4141
makeRef: makeRefMock,
42-
} satisfies OpenAPIContext;
43-
const responseCtx = {
42+
};
43+
const responseCtx: OpenAPIContext = {
4444
path: "/v1/user/:id",
4545
method: "get",
4646
isResponse: true,
4747
makeRef: makeRefMock,
48-
} satisfies OpenAPIContext;
48+
};
4949

5050
beforeEach(() => {
5151
makeRefMock.mockClear();

0 commit comments

Comments
 (0)