Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setTimeout(() => {
this.richPreview = new SwaggerUIBundle({
spec: this.getFormData(),
dom_id: '#rich-preview',
// Disable Swagger.io online validation (AKA spyware)
validatorUrl: null,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: 'StandaloneLayout'
});
}, 0);
}
jQuery(document).ready(function($) {
// We actually can't prevent SwaggerUI from overwriting the set URL with one in the query string.
// https://github.com/swagger-api/swagger-ui/issues/4332
if (window.location.search) {
window.location.search = "";
}
window.ui = SwaggerUI({
deepLinking: true,
dom_id: "#swagger-ui",
layout: "DashboardLayout",
plugins: [
SwaggerUI.plugins.DownloadUrl,
vanillaForums
],
presets: [
SwaggerUI.presets.apis
],
requestInterceptor: function (request) {
request.headers["x-transient-key"] = gdn.getMeta("TransientKey");
return request;
},
url: gdn.url("/api/v2/open-api/v2"),
validatorUrl: null
});
});
const swaggerUI = SwaggerUI({
dom_id: "#ui",
url: swagger.url,
requestInterceptor: (req) => {
// Only set Authorization header if the request matches the spec URL
if (req.url === url) {
req.headers.Authorization = "Bearer " + AuthManager.getUser().getPartialToken();
}
return req;
},
presets: [
SwaggerUI.presets.apis,
disableAuthorizeAndInfoPlugin
],
plugins: [
SwaggerUI.plugins.DownloadUrl
]
})
}).catch(
error => {
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
],
initialState: {
layout: undefined
},
plugins: [
ASTPlugin,
ValidateBasePlugin,
ValidateSemanticPlugin,
() => ({
statePlugins: {
configs: {
actions: {
loaded: () => {
return {
type: "noop"
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
],
initialState: {
layout: undefined
},
plugins: [
insertPlugin,
() => ({
statePlugins: {
spec: {
wrapSelectors: {
isOAS3: () => () => true
}
}
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
],
initialState: {
layout: undefined
},
plugins: [
EditorMetadataPlugin,
() => ({
statePlugins: {
configs: {
actions: {
loaded: () => {
return {
type: "noop"
}
}
}
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
],
initialState: {
layout: undefined
},
plugins: [
insertPlugin,
() => ({
statePlugins: {
spec: {
wrapSelectors: {
isOAS3: () => () => true
}
}
}
}),
() => ({
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
SwaggerUi.plugins.Oas3Index
],
initialState: {
layout: undefined
},
plugins: [
ASTPlugin,
ValidateBasePlugin,
ValidateSemanticPlugin,
() => ({
statePlugins: {
configs: {
actions: {
return new Promise((resolve) => {
const system = SwaggerUi({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
],
initialState: {
layout: undefined
},
plugins: [
EditorMetadataPlugin,
() => ({
statePlugins: {
configs: {
actions: {
loaded: () => {
return {
type: "noop"
response.ok = true
return response
})
.catch((err) => {
console.error(err)
response.text = `{"internal": "KVDI: Failure while trying to refresh access token: ${err}"}`
return response
})
}
return response
},
presets: [
SwaggerUIBundle.presets.apis
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
]
})
if (this.$userStore.getters.isLoggedIn) {
this.ui.authActions.authorize({
api_key: {
name: 'api_key',
schema: {
type: 'apiKey',
in: 'header',
name: 'X-Session-Token',
description: ''
},
value: this.$userStore.getters.token
}
})
}