Skip to content

Commit d54763d

Browse files
authored
fix(types): fix plugin options (#851)
1 parent 79384b1 commit d54763d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ An example of using `@fastify/swagger` with `static` mode enabled can be found [
234234
| ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
235235
| hiddenTag | X-HIDDEN | Tag to control hiding of routes. |
236236
| hideUntagged | false | If `true` remove routes without tags from resulting Swagger/OpenAPI schema file. |
237-
| initOAuth | {} | Configuration options for [Swagger UI initOAuth](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/). |
238237
| openapi | {} | [OpenAPI configuration](https://swagger.io/specification/#oasObject). |
239238
| stripBasePath | true | Strips base path from routes in docs. |
240239
| swagger | {} | [Swagger configuration](https://swagger.io/specification/v2/#swaggerObject). |

index.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ declare namespace fastifySwagger {
112112
openapi?: Partial<OpenAPIV3.Document | OpenAPIV3_1.Document>
113113
hiddenTag?: string;
114114
hideUntagged?: boolean;
115+
116+
/** Include HEAD routes in the definitions */
117+
exposeHeadRoutes?: boolean;
118+
115119
/**
116120
* Strips matching base path from routes in documentation
117121
* @default true
@@ -127,6 +131,9 @@ declare namespace fastifySwagger {
127131
*/
128132
transformObject?: SwaggerTransformObject;
129133

134+
/** Overrides the Fastify decorator. */
135+
decorator?: 'swagger' | (string & Record<never, never>);
136+
130137
refResolver?: {
131138
/** Clone the input schema without changing it. Default to `false`. */
132139
clone?: boolean;

test/types/types.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,19 @@ expectType<string>(app.swagger({ yaml: true }))
241241
expectType<OpenAPI.Document | string>(app.swagger({ yaml: Boolean(process.env.YAML) }))
242242

243243
expectType<(arg: string)=>string>(formatParamUrl)
244+
245+
app.register(fastifySwagger, {
246+
decorator: 'swagger'
247+
})
248+
249+
app.register(fastifySwagger, {
250+
decorator: 'customSwagger'
251+
})
252+
253+
app.register(fastifySwagger, {
254+
exposeHeadRoutes: true
255+
})
256+
257+
app.register(fastifySwagger, {
258+
exposeHeadRoutes: false
259+
})

0 commit comments

Comments
 (0)