Skip to content

Commit e50e714

Browse files
authored
fix: added transform types to export (#866)
1 parent 301b725 commit e50e714

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

index.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ declare module 'fastify' {
6060
}
6161

6262
interface FastifyContextConfig {
63-
swaggerTransform?: SwaggerTransform | false;
63+
swaggerTransform?: fastifySwagger.SwaggerTransform | false;
6464
}
6565
}
6666

@@ -71,20 +71,6 @@ type SwaggerDocumentObject = {
7171
openapiObject: Partial<OpenAPIV3.Document | OpenAPIV3_1.Document>;
7272
}
7373

74-
type SwaggerTransform = <S extends FastifySchema = FastifySchema>({
75-
schema,
76-
url,
77-
route,
78-
...documentObject
79-
}: {
80-
schema: S;
81-
url: string;
82-
route: RouteOptions;
83-
} & SwaggerDocumentObject) => { schema: FastifySchema; url: string }
84-
85-
// eslint-disable-next-line camelcase
86-
type SwaggerTransformObject = (documentObject: SwaggerDocumentObject) => Partial<OpenAPIV2.Document> | Partial<OpenAPIV3.Document | OpenAPIV3_1.Document>
87-
8874
type FastifySwagger = FastifyPluginCallback<fastifySwagger.SwaggerOptions>
8975

9076
declare namespace fastifySwagger {
@@ -105,6 +91,20 @@ declare namespace fastifySwagger {
10591
[key: string]: JSONValue;
10692
}
10793

94+
export type SwaggerTransform<S extends FastifySchema = FastifySchema> = ({
95+
schema,
96+
url,
97+
route,
98+
...documentObject
99+
}: {
100+
schema: S;
101+
url: string;
102+
route: RouteOptions;
103+
} & SwaggerDocumentObject) => { schema: FastifySchema; url: string }
104+
105+
// eslint-disable-next-line camelcase
106+
export type SwaggerTransformObject = (documentObject: SwaggerDocumentObject) => Partial<OpenAPIV2.Document> | Partial<OpenAPIV3.Document | OpenAPIV3_1.Document>
107+
108108
export interface FastifyDynamicSwaggerOptions extends FastifySwaggerOptions {
109109
mode?: 'dynamic';
110110
swagger?: Partial<OpenAPIV2.Document>;

0 commit comments

Comments
 (0)