feat: expose plugins and presets on SwaggerUI global symbol (#9189)
Part of this commit is also: - complete plugins consolidation - complete presets consolidation - build system consolidation Refs #9188
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import BasePreset from "./base"
|
||||
import OAS3Plugin from "../plugins/oas3"
|
||||
import OAS31Plugin from "../plugins/oas31"
|
||||
import JSONSchema202012Plugin from "../plugins/json-schema-2020-12"
|
||||
|
||||
export default function PresetApis() {
|
||||
return [BasePreset, OAS3Plugin, JSONSchema202012Plugin, OAS31Plugin]
|
||||
}
|
||||
11
src/core/presets/apis/index.js
Normal file
11
src/core/presets/apis/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import BasePreset from "core/presets/base"
|
||||
import OpenAPI30Plugin from "core/plugins/oas3"
|
||||
import OpenAPI31Plugin from "core/plugins/oas31"
|
||||
import JSONSchema202012Plugin from "core/plugins/json-schema-2020-12"
|
||||
|
||||
export default function PresetApis() {
|
||||
return [BasePreset, OpenAPI30Plugin, JSONSchema202012Plugin, OpenAPI31Plugin]
|
||||
}
|
||||
49
src/core/presets/base/index.js
Normal file
49
src/core/presets/base/index.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import AuthPlugin from "core/plugins/auth/"
|
||||
import ConfigsPlugin from "core/plugins/configs"
|
||||
import DeepLinkingPlugin from "core/plugins/deep-linking"
|
||||
import ErrPlugin from "core/plugins/err"
|
||||
import FilterPlugin from "core/plugins/filter"
|
||||
import IconsPlugin from "core/plugins/icons"
|
||||
import LayoutPlugin from "core/plugins/layout"
|
||||
import LogsPlugin from "core/plugins/logs"
|
||||
import OnCompletePlugin from "core/plugins/on-complete"
|
||||
import RequestSnippetsPlugin from "core/plugins/request-snippets"
|
||||
import SamplesPlugin from "core/plugins/samples"
|
||||
import SpecPlugin from "core/plugins/spec"
|
||||
import SwaggerClientPlugin from "core/plugins/swagger-client"
|
||||
import UtilPlugin from "core/plugins/util"
|
||||
import ViewPlugin from "core/plugins/view"
|
||||
import DownloadUrlPlugin from "core/plugins/download-url"
|
||||
import SafeRenderPlugin from "core/plugins/safe-render"
|
||||
// ad-hoc plugins
|
||||
import CoreComponentsPlugin from "core/presets/base/plugins/core-components"
|
||||
import FormComponentsPlugin from "core/presets/base/plugins/form-components"
|
||||
import JSONSchemaComponentsPlugin from "core/presets/base/plugins/json-schema-components"
|
||||
|
||||
const BasePreset = () => [
|
||||
ConfigsPlugin,
|
||||
UtilPlugin,
|
||||
LogsPlugin,
|
||||
ViewPlugin,
|
||||
SpecPlugin,
|
||||
ErrPlugin,
|
||||
IconsPlugin,
|
||||
LayoutPlugin,
|
||||
SamplesPlugin,
|
||||
CoreComponentsPlugin,
|
||||
FormComponentsPlugin,
|
||||
SwaggerClientPlugin,
|
||||
JSONSchemaComponentsPlugin,
|
||||
AuthPlugin,
|
||||
DownloadUrlPlugin,
|
||||
DeepLinkingPlugin,
|
||||
FilterPlugin,
|
||||
OnCompletePlugin,
|
||||
RequestSnippetsPlugin,
|
||||
SafeRenderPlugin(),
|
||||
]
|
||||
|
||||
export default BasePreset
|
||||
@@ -1,26 +1,6 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import err from "core/plugins/err"
|
||||
import layout from "core/plugins/layout"
|
||||
import spec from "core/plugins/spec"
|
||||
import view from "core/plugins/view"
|
||||
import samples from "core/plugins/samples"
|
||||
import requestSnippets from "core/plugins/request-snippets"
|
||||
import logs from "core/plugins/logs"
|
||||
import swaggerJs from "core/plugins/swagger-js"
|
||||
import auth from "core/plugins/auth"
|
||||
import util from "core/plugins/util"
|
||||
import downloadUrlPlugin from "core/plugins/download-url"
|
||||
import configsPlugin from "core/plugins/configs"
|
||||
import deepLinkingPlugin from "core/plugins/deep-linking"
|
||||
import filter from "core/plugins/filter"
|
||||
import onComplete from "core/plugins/on-complete"
|
||||
import safeRender from "core/plugins/safe-render"
|
||||
import iconsPlugin from "core/plugins/icons"
|
||||
|
||||
import OperationContainer from "core/containers/OperationContainer"
|
||||
|
||||
import App from "core/components/app"
|
||||
import AuthorizationPopup from "core/components/auth/authorization-popup"
|
||||
import AuthorizeBtn from "core/components/auth/authorize-btn"
|
||||
@@ -41,6 +21,7 @@ import OnlineValidatorBadge from "core/components/online-validator-badge"
|
||||
import Operations from "core/components/operations"
|
||||
import OperationTag from "core/components/operation-tag"
|
||||
import Operation from "core/components/operation"
|
||||
import OperationContainer from "core/containers/OperationContainer"
|
||||
import OperationSummary from "core/components/operation-summary"
|
||||
import OperationSummaryMethod from "core/components/operation-summary-method"
|
||||
import OperationSummaryPath from "core/components/operation-summary-path"
|
||||
@@ -91,116 +72,83 @@ import DeepLink from "core/components/deep-link"
|
||||
import SvgAssets from "core/components/svg-assets"
|
||||
import Markdown from "core/components/providers/markdown"
|
||||
import BaseLayout from "core/components/layouts/base"
|
||||
import * as LayoutUtils from "core/components/layout-utils"
|
||||
import * as JsonSchemaComponents from "core/json-schema-components"
|
||||
|
||||
export default function () {
|
||||
let coreComponents = {
|
||||
components: {
|
||||
App,
|
||||
authorizationPopup: AuthorizationPopup,
|
||||
authorizeBtn: AuthorizeBtn,
|
||||
AuthorizeBtnContainer,
|
||||
authorizeOperationBtn: AuthorizeOperationBtn,
|
||||
auths: Auths,
|
||||
AuthItem: AuthItem,
|
||||
authError: AuthError,
|
||||
oauth2: Oauth2,
|
||||
apiKeyAuth: ApiKeyAuth,
|
||||
basicAuth: BasicAuth,
|
||||
clear: Clear,
|
||||
liveResponse: LiveResponse,
|
||||
InitializedInput,
|
||||
info: Info,
|
||||
InfoContainer,
|
||||
InfoUrl,
|
||||
InfoBasePath,
|
||||
Contact,
|
||||
License,
|
||||
JumpToPath,
|
||||
CopyToClipboardBtn,
|
||||
onlineValidatorBadge: OnlineValidatorBadge,
|
||||
operations: Operations,
|
||||
operation: Operation,
|
||||
OperationSummary,
|
||||
OperationSummaryMethod,
|
||||
OperationSummaryPath,
|
||||
highlightCode: HighlightCode,
|
||||
responses: Responses,
|
||||
response: Response,
|
||||
ResponseExtension: ResponseExtension,
|
||||
responseBody: ResponseBody,
|
||||
parameters: Parameters,
|
||||
parameterRow: ParameterRow,
|
||||
execute: Execute,
|
||||
headers: Headers,
|
||||
errors: Errors,
|
||||
contentType: ContentType,
|
||||
overview: Overview,
|
||||
footer: Footer,
|
||||
FilterContainer,
|
||||
ParamBody: ParamBody,
|
||||
curl: Curl,
|
||||
schemes: Schemes,
|
||||
SchemesContainer,
|
||||
modelExample: ModelExample,
|
||||
ModelWrapper,
|
||||
ModelCollapse,
|
||||
Model,
|
||||
Models,
|
||||
EnumModel,
|
||||
ObjectModel,
|
||||
ArrayModel,
|
||||
PrimitiveModel,
|
||||
Property,
|
||||
TryItOutButton,
|
||||
Markdown,
|
||||
BaseLayout,
|
||||
VersionPragmaFilter,
|
||||
VersionStamp,
|
||||
OpenAPIVersion,
|
||||
OperationExt,
|
||||
OperationExtRow,
|
||||
ParameterExt,
|
||||
ParameterIncludeEmpty,
|
||||
OperationTag,
|
||||
OperationContainer,
|
||||
DeepLink,
|
||||
SvgAssets,
|
||||
Example,
|
||||
ExamplesSelect,
|
||||
ExamplesSelectValueRetainer,
|
||||
},
|
||||
}
|
||||
const CoreComponentsPlugin = () => ({
|
||||
components: {
|
||||
App,
|
||||
authorizationPopup: AuthorizationPopup,
|
||||
authorizeBtn: AuthorizeBtn,
|
||||
AuthorizeBtnContainer,
|
||||
authorizeOperationBtn: AuthorizeOperationBtn,
|
||||
auths: Auths,
|
||||
AuthItem: AuthItem,
|
||||
authError: AuthError,
|
||||
oauth2: Oauth2,
|
||||
apiKeyAuth: ApiKeyAuth,
|
||||
basicAuth: BasicAuth,
|
||||
clear: Clear,
|
||||
liveResponse: LiveResponse,
|
||||
InitializedInput,
|
||||
info: Info,
|
||||
InfoContainer,
|
||||
InfoUrl,
|
||||
InfoBasePath,
|
||||
Contact,
|
||||
License,
|
||||
JumpToPath,
|
||||
CopyToClipboardBtn,
|
||||
onlineValidatorBadge: OnlineValidatorBadge,
|
||||
operations: Operations,
|
||||
operation: Operation,
|
||||
OperationSummary,
|
||||
OperationSummaryMethod,
|
||||
OperationSummaryPath,
|
||||
highlightCode: HighlightCode,
|
||||
responses: Responses,
|
||||
response: Response,
|
||||
ResponseExtension: ResponseExtension,
|
||||
responseBody: ResponseBody,
|
||||
parameters: Parameters,
|
||||
parameterRow: ParameterRow,
|
||||
execute: Execute,
|
||||
headers: Headers,
|
||||
errors: Errors,
|
||||
contentType: ContentType,
|
||||
overview: Overview,
|
||||
footer: Footer,
|
||||
FilterContainer,
|
||||
ParamBody: ParamBody,
|
||||
curl: Curl,
|
||||
schemes: Schemes,
|
||||
SchemesContainer,
|
||||
modelExample: ModelExample,
|
||||
ModelWrapper,
|
||||
ModelCollapse,
|
||||
Model,
|
||||
Models,
|
||||
EnumModel,
|
||||
ObjectModel,
|
||||
ArrayModel,
|
||||
PrimitiveModel,
|
||||
Property,
|
||||
TryItOutButton,
|
||||
Markdown,
|
||||
BaseLayout,
|
||||
VersionPragmaFilter,
|
||||
VersionStamp,
|
||||
OperationExt,
|
||||
OperationExtRow,
|
||||
ParameterExt,
|
||||
ParameterIncludeEmpty,
|
||||
OperationTag,
|
||||
OperationContainer,
|
||||
OpenAPIVersion,
|
||||
DeepLink,
|
||||
SvgAssets,
|
||||
Example,
|
||||
ExamplesSelect,
|
||||
ExamplesSelectValueRetainer,
|
||||
},
|
||||
})
|
||||
|
||||
let formComponents = {
|
||||
components: LayoutUtils,
|
||||
}
|
||||
|
||||
let jsonSchemaComponents = {
|
||||
components: JsonSchemaComponents,
|
||||
}
|
||||
|
||||
return [
|
||||
configsPlugin,
|
||||
util,
|
||||
logs,
|
||||
view,
|
||||
spec,
|
||||
err,
|
||||
layout,
|
||||
samples,
|
||||
coreComponents,
|
||||
formComponents,
|
||||
swaggerJs,
|
||||
jsonSchemaComponents,
|
||||
auth,
|
||||
downloadUrlPlugin,
|
||||
deepLinkingPlugin,
|
||||
filter,
|
||||
onComplete,
|
||||
requestSnippets,
|
||||
iconsPlugin,
|
||||
safeRender(),
|
||||
]
|
||||
}
|
||||
export default CoreComponentsPlugin
|
||||
10
src/core/presets/base/plugins/form-components/index.js
Normal file
10
src/core/presets/base/plugins/form-components/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import * as LayoutUtils from "core/components/layout-utils"
|
||||
|
||||
const FormComponentsPlugin = () => ({
|
||||
components: { ...LayoutUtils },
|
||||
})
|
||||
|
||||
export default FormComponentsPlugin
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import * as JSONSchemaComponents from "core/components/json-schema-components"
|
||||
|
||||
const JSONSchemaComponentsPlugin = () => ({
|
||||
components: { ...JSONSchemaComponents },
|
||||
})
|
||||
|
||||
export default JSONSchemaComponentsPlugin
|
||||
Reference in New Issue
Block a user