Disable Swagger2 auth features in OAS3

This commit is contained in:
Kyle Shockey
2017-09-29 17:49:15 -07:00
parent c6a664302a
commit 7e6f74080f
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { createSelector } from "reselect"
import { Map } from "immutable"
import { isOAS3 as isOAS3Helper, isSwagger2 as isSwagger2Helper } from "../helpers"
// Helpers
function onlyOAS3(selector) {
return (ori, system) => (...args) => {
const spec = system.getSystem().specSelectors.specJson()
if(isOAS3Helper(spec)) {
return selector(...args)
} else {
return ori(...args)
}
}
}
const state = state => {
return state || Map()
}
const nullSelector = createSelector(() => null)
const OAS3NullSelector = onlyOAS3(nullSelector)
// Hasta la vista, authentication!
export const shownDefinitions = OAS3NullSelector
export const definitionsToAuthorize = OAS3NullSelector
export const getDefinitionsByNames = OAS3NullSelector
export const authorized = OAS3NullSelector
export const isAuthorized = OAS3NullSelector
export const getConfigs = OAS3NullSelector

View File

@@ -1,6 +1,7 @@
// import reducers from "./reducers" // import reducers from "./reducers"
// import * as actions from "./actions" // import * as actions from "./actions"
import * as specWrapSelectors from "./spec-extensions/wrap-selectors" import * as specWrapSelectors from "./spec-extensions/wrap-selectors"
import * as authWrapSelectors from "./auth-extensions/wrap-selectors"
import * as specSelectors from "./spec-extensions/selectors" import * as specSelectors from "./spec-extensions/selectors"
import components from "./components" import components from "./components"
import wrapComponents from "./wrap-components" import wrapComponents from "./wrap-components"
@@ -17,6 +18,9 @@ export default function() {
wrapSelectors: specWrapSelectors, wrapSelectors: specWrapSelectors,
selectors: specSelectors selectors: specSelectors
}, },
auth: {
wrapSelectors: authWrapSelectors
},
oas3: { oas3: {
actions: oas3Actions, actions: oas3Actions,
reducers: oas3Reducers, reducers: oas3Reducers,

View File

@@ -53,6 +53,7 @@ export const basePath = OAS3NullSelector
export const consumes = OAS3NullSelector export const consumes = OAS3NullSelector
export const produces = OAS3NullSelector export const produces = OAS3NullSelector
export const schemes = OAS3NullSelector export const schemes = OAS3NullSelector
export const securityDefinitions = OAS3NullSelector
// New selectors // New selectors