diff --git a/src/core/plugins/oas3/index.js b/src/core/plugins/oas3/index.js new file mode 100644 index 00000000..5135063c --- /dev/null +++ b/src/core/plugins/oas3/index.js @@ -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 + } + } + } +} diff --git a/src/core/plugins/oas3/selectors.js b/src/core/plugins/oas3/selectors.js new file mode 100644 index 00000000..63828957 --- /dev/null +++ b/src/core/plugins/oas3/selectors.js @@ -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 + } +} diff --git a/src/core/presets/apis.js b/src/core/presets/apis.js index 3d4b5961..14afc627 100644 --- a/src/core/presets/apis.js +++ b/src/core/presets/apis.js @@ -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 ] }