From 2ac1a1d057ca98c761c0bf41e59d2ff5a031210a Mon Sep 17 00:00:00 2001 From: Sam Martin Date: Wed, 29 Jan 2025 10:20:52 +0100 Subject: [PATCH 1/2] Remove dependency on lib.dom.d.ts --- types/index.d.ts | 4 ++-- types/types.test-d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index fb394c4..c88d916 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,5 +1,3 @@ -/// - import { FastifyPluginCallback, FastifyReply, @@ -157,6 +155,8 @@ declare namespace fastifySwaggerUi { [index: string]: any; } + type HTMLElement = unknown // nodejs does not have a DOM, and should not pollute the global types by referencing lib.dom.d.ts + export type FastifySwaggerUiConfigOptions = { // Core diff --git a/types/types.test-d.ts b/types/types.test-d.ts index eee458b..38d8f1c 100644 --- a/types/types.test-d.ts +++ b/types/types.test-d.ts @@ -37,6 +37,8 @@ const fastifySwaggerOptions: FastifySwaggerUiOptions = { indexPrefix: '/custom-prefix' } app.register(fastifySwaggerUi, fastifySwaggerOptions) +app.register(fastifySwaggerUi, { uiConfig: { domNode: null } }) +app.register(fastifySwaggerUi, { uiConfig: { domNode: {} } }) app.get('/deprecated', { schema: { From 17898efa4feafe5ac08c416d86463710d765c8f5 Mon Sep 17 00:00:00 2001 From: Sam Martin Date: Wed, 29 Jan 2025 11:18:28 +0100 Subject: [PATCH 2/2] Remove domNode option --- types/index.d.ts | 9 +-------- types/types.test-d.ts | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index c88d916..7a514a6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -155,8 +155,6 @@ declare namespace fastifySwaggerUi { [index: string]: any; } - type HTMLElement = unknown // nodejs does not have a DOM, and should not pollute the global types by referencing lib.dom.d.ts - export type FastifySwaggerUiConfigOptions = { // Core @@ -166,15 +164,10 @@ declare namespace fastifySwaggerUi { configUrl?: string | undefined; /** - * REQUIRED if domNode is not provided. The ID of a DOM element inside which SwaggerUI will put its user interface. + * The ID of a DOM element inside which SwaggerUI will put its user interface. */ dom_id?: string | undefined; - /** - * REQUIRED if dom_id is not provided. The HTML DOM element inside which SwaggerUI will put its user interface. Overrides dom_id. - */ - domNode?: HTMLElement | null | undefined; - /** * A JavaScript object describing the OpenAPI definition. When used, the url parameter will not be parsed. This is useful for testing manually-generated definitions without hosting them */ diff --git a/types/types.test-d.ts b/types/types.test-d.ts index 38d8f1c..eee458b 100644 --- a/types/types.test-d.ts +++ b/types/types.test-d.ts @@ -37,8 +37,6 @@ const fastifySwaggerOptions: FastifySwaggerUiOptions = { indexPrefix: '/custom-prefix' } app.register(fastifySwaggerUi, fastifySwaggerOptions) -app.register(fastifySwaggerUi, { uiConfig: { domNode: null } }) -app.register(fastifySwaggerUi, { uiConfig: { domNode: {} } }) app.get('/deprecated', { schema: {