Create OAS3 plugin
This commit is contained in:
20
src/core/plugins/oas3/index.js
Normal file
20
src/core/plugins/oas3/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// import reducers from "./reducers"
|
||||
// import * as actions from "./actions"
|
||||
import * as selectors from "./selectors"
|
||||
// import * as wrapActions from "./wrap-actions"
|
||||
|
||||
export default function(system) {
|
||||
return {
|
||||
components: {
|
||||
|
||||
},
|
||||
statePlugins: {
|
||||
spec: {
|
||||
// wrapActions,
|
||||
// reducers,
|
||||
// actions,
|
||||
selectors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/core/plugins/oas3/selectors.js
Normal file
43
src/core/plugins/oas3/selectors.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import { createSelector } from "reselect"
|
||||
// import { sorters } from "core/utils"
|
||||
// import { fromJS, Set, Map, List } from "immutable"
|
||||
|
||||
const DEFAULT_TAG = "default"
|
||||
|
||||
const state = state => {
|
||||
return state || Map()
|
||||
}
|
||||
|
||||
// export const specJson = createSelector(
|
||||
// state,
|
||||
// spec => spec.get("json", Map())
|
||||
// )
|
||||
//
|
||||
// export const specResolved = createSelector(
|
||||
// state,
|
||||
// spec => spec.get("resolved", Map())
|
||||
// )
|
||||
//
|
||||
// export const spec = state => {
|
||||
// let res = specResolved(state)
|
||||
// if(res.count() < 1)
|
||||
// res = specJson(state)
|
||||
// return res
|
||||
// }
|
||||
//
|
||||
// export const findDefinition = ( state, name ) => {
|
||||
// return specResolved(state).getIn(["definitions", name], null)
|
||||
// }
|
||||
//
|
||||
// export const definitions = onlyOAS3(createSelector(
|
||||
// spec,
|
||||
// spec => spec.getIn(["components", "schemas"]) || Map()
|
||||
// ))
|
||||
|
||||
// helpers
|
||||
|
||||
function onlyOAS3(selector) {
|
||||
return ( state ) => ( thing ) => {
|
||||
return selector
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import BasePreset from "./base"
|
||||
import OAS3Plugin from "../plugins/oas3"
|
||||
|
||||
// Just the base, for now.
|
||||
|
||||
@@ -6,5 +7,6 @@ export default function PresetApis() {
|
||||
|
||||
return [
|
||||
BasePreset,
|
||||
OAS3Plugin
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user