@@ -39,7 +39,7 @@ export interface OpenAPIReferencePluginOptions<T extends Context> extends OpenAP
39
39
*
40
40
* @default 'scalar'
41
41
*/
42
- uiType ?: 'scalar' | 'swagger'
42
+ docsProvider ?: 'scalar' | 'swagger'
43
43
44
44
/**
45
45
* Arbitrary configuration object for the UI.
@@ -78,7 +78,7 @@ export interface OpenAPIReferencePluginOptions<T extends Context> extends OpenAP
78
78
scriptUrl : string ,
79
79
config : Record < string , unknown > | undefined ,
80
80
spec : OpenAPI . Document ,
81
- uiType : 'scalar' | 'swagger' ,
81
+ docsProvider : 'scalar' | 'swagger' ,
82
82
cssUrl ?: string
83
83
) => string
84
84
}
@@ -90,7 +90,7 @@ export class OpenAPIReferencePlugin<T extends Context> implements StandardHandle
90
90
private readonly docsPath : Exclude < OpenAPIReferencePluginOptions < T > [ 'docsPath' ] , undefined >
91
91
private readonly docsTitle : Exclude < OpenAPIReferencePluginOptions < T > [ 'docsTitle' ] , undefined >
92
92
private readonly docsHead : Exclude < OpenAPIReferencePluginOptions < T > [ 'docsHead' ] , undefined >
93
- private readonly uiType : Exclude < OpenAPIReferencePluginOptions < T > [ 'uiType ' ] , undefined >
93
+ private readonly docsProvider : Exclude < OpenAPIReferencePluginOptions < T > [ 'docsProvider ' ] , undefined >
94
94
private readonly docsScriptUrl : Exclude < OpenAPIReferencePluginOptions < T > [ 'docsScriptUrl' ] , undefined >
95
95
private readonly docsCssUrl : OpenAPIReferencePluginOptions < T > [ 'docsCssUrl' ]
96
96
private readonly docsConfig : OpenAPIReferencePluginOptions < T > [ 'docsConfig' ]
@@ -101,18 +101,18 @@ export class OpenAPIReferencePlugin<T extends Context> implements StandardHandle
101
101
this . docsPath = options . docsPath ?? '/'
102
102
this . docsTitle = options . docsTitle ?? 'API Reference'
103
103
this . docsConfig = options . docsConfig ?? undefined
104
- this . uiType = options . uiType ?? 'scalar'
104
+ this . docsProvider = options . docsProvider ?? 'scalar'
105
105
106
106
// Set default script URL based on UI type
107
107
this . docsScriptUrl = options . docsScriptUrl ?? (
108
- this . uiType === 'swagger'
108
+ this . docsProvider === 'swagger'
109
109
? 'https://unpkg.com/swagger-ui-dist@5.17.14/swagger-ui-bundle.js'
110
110
: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference'
111
111
)
112
112
113
113
// Set CSS URL for Swagger UI
114
114
this . docsCssUrl = options . docsCssUrl ?? (
115
- this . uiType === 'swagger'
115
+ this . docsProvider === 'swagger'
116
116
? 'https://unpkg.com/swagger-ui-dist@5.17.14/swagger-ui.css'
117
117
: undefined
118
118
)
@@ -123,8 +123,8 @@ export class OpenAPIReferencePlugin<T extends Context> implements StandardHandle
123
123
124
124
const esc = ( s : string ) => s . replace ( / & / g, '&' ) . replace ( / " / g, '"' ) . replace ( / < / g, '<' ) . replace ( / > / g, '>' )
125
125
126
- this . renderDocsHtml = options . renderDocsHtml ?? ( ( specUrl , title , head , scriptUrl , config , spec , uiType , cssUrl ) => {
127
- if ( uiType === 'swagger' ) {
126
+ this . renderDocsHtml = options . renderDocsHtml ?? ( ( specUrl , title , head , scriptUrl , config , spec , docsProvider , cssUrl ) => {
127
+ if ( docsProvider === 'swagger' ) {
128
128
// Swagger UI configuration
129
129
const swaggerConfig = {
130
130
dom_id : '#app' ,
@@ -237,7 +237,7 @@ export class OpenAPIReferencePlugin<T extends Context> implements StandardHandle
237
237
await value ( this . docsScriptUrl , options ) ,
238
238
await value ( this . docsConfig , options ) ,
239
239
await generateSpec ( ) ,
240
- this . uiType ,
240
+ this . docsProvider ,
241
241
this . docsCssUrl ? await value ( this . docsCssUrl , options ) : undefined ,
242
242
)
243
243
0 commit comments