Merge branch 'master' of https://github.com/swagger-api/swagger-ui
# Conflicts: # dist/swagger-ui-bundle.js # dist/swagger-ui-bundle.js.map # dist/swagger-ui-standalone-preset.js # dist/swagger-ui.js # dist/swagger-ui.js.map
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
import React, { PropTypes } from "react"
|
||||
|
||||
export default function (system) {
|
||||
return {
|
||||
components: {
|
||||
NoHostWarning,
|
||||
},
|
||||
statePlugins: {
|
||||
spec: {
|
||||
selectors: {
|
||||
allowTryItOutFor,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is a quick style. How do we improve this?
|
||||
const style = {
|
||||
backgroundColor: "#e7f0f7",
|
||||
padding: "1rem",
|
||||
borderRadius: "3px",
|
||||
}
|
||||
|
||||
function NoHostWarning() {
|
||||
return (
|
||||
<div style={style}>Note: The interactive forms are disabled, as no `host` property was found in the specification. Please see: <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object" target="_blank">OAI 2.0/#swagger-object</a></div>
|
||||
)
|
||||
}
|
||||
|
||||
// Only allow if, there is a host field
|
||||
function allowTryItOutFor(state) {
|
||||
return ({specSelectors}) => {
|
||||
return specSelectors.hasHost(state)
|
||||
}
|
||||
}
|
||||
@@ -277,8 +277,6 @@ export let getLineNumberForPathAsync = promisifySyncFn(getLineNumberForPath)
|
||||
|
||||
function promisifySyncFn(fn) {
|
||||
return function(...args) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
resolve(fn(...args))
|
||||
})
|
||||
return new Promise((resolve) => resolve(fn(...args)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import btoa from "btoa"
|
||||
import {
|
||||
SHOW_AUTH_POPUP,
|
||||
AUTHORIZE,
|
||||
PRE_AUTHORIZE_OAUTH2,
|
||||
AUTHORIZE_OAUTH2,
|
||||
LOGOUT
|
||||
} from "./actions"
|
||||
@@ -21,7 +20,6 @@ export default {
|
||||
// refactor withMutations
|
||||
securities.entrySeq().forEach( ([ key, security ]) => {
|
||||
let type = security.getIn(["schema", "type"])
|
||||
let name = security.get("name")
|
||||
|
||||
if ( type === "apiKey" ) {
|
||||
map = map.set(key, security)
|
||||
|
||||
@@ -10,7 +10,7 @@ export const shownDefinitions = createSelector(
|
||||
|
||||
export const definitionsToAuthorize = createSelector(
|
||||
state,
|
||||
auth =>( { specSelectors } ) => {
|
||||
() =>( { specSelectors } ) => {
|
||||
let definitions = specSelectors.securityDefinitions()
|
||||
let list = List()
|
||||
|
||||
@@ -66,7 +66,6 @@ export const authorized = createSelector(
|
||||
|
||||
export const isAuthorized = ( state, securities ) =>( { authSelectors } ) => {
|
||||
let authorized = authSelectors.authorized()
|
||||
let isAuth = false
|
||||
|
||||
return !!securities.toJS().filter( ( security ) => {
|
||||
let isAuthorized = true
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Map } from "immutable"
|
||||
|
||||
// Add security to the final `execute` call ( via `extras` )
|
||||
export const execute = ( oriAction, { authSelectors, specSelectors }) => ({ path, method, operation, extras }) => {
|
||||
let securities = {
|
||||
@@ -10,4 +8,3 @@ export const execute = ( oriAction, { authSelectors, specSelectors }) => ({ path
|
||||
|
||||
return oriAction({ path, method, operation, securities, ...extras })
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createSelector } from "reselect"
|
||||
import { Map } from "immutable"
|
||||
|
||||
export default function downloadUrlPlugin (toolbox) {
|
||||
let { fn, Im } = toolbox
|
||||
let { fn } = toolbox
|
||||
|
||||
const actions = {
|
||||
download: (url)=> ({ errActions, specSelectors, specActions }) => {
|
||||
|
||||
@@ -20,14 +20,14 @@ export function newThrownErrBatch(errors) {
|
||||
}
|
||||
}
|
||||
|
||||
export function newSpecErr(err, action) {
|
||||
export function newSpecErr(err) {
|
||||
return {
|
||||
type: NEW_SPEC_ERR,
|
||||
payload: err
|
||||
}
|
||||
}
|
||||
|
||||
export function newAuthErr(err, action) {
|
||||
export function newAuthErr(err) {
|
||||
return {
|
||||
type: NEW_AUTH_ERR,
|
||||
payload: err
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import concat from "lodash/concat"
|
||||
import reduce from "lodash/reduce"
|
||||
let request = require.context("./transformers/", true, /\.js$/)
|
||||
let errorTransformers = []
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import get from "lodash/get"
|
||||
import last from "lodash/get"
|
||||
import { fromJS, List } from "immutable"
|
||||
import { fromJS } from "immutable"
|
||||
|
||||
export function transform(errors, { jsSpec }) {
|
||||
// LOOK HERE THIS TRANSFORMER IS CURRENTLY DISABLED 😃
|
||||
|
||||
@@ -127,8 +127,12 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
|
||||
if (xml.wrapped) {
|
||||
res[displayName] = []
|
||||
if (Array.isArray(defaultValue)) {
|
||||
|
||||
if (Array.isArray(example)) {
|
||||
example.forEach((v)=>{
|
||||
items.example = v
|
||||
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
} else if (Array.isArray(defaultValue)) {
|
||||
defaultValue.forEach((v)=>{
|
||||
items.default = v
|
||||
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||
@@ -145,14 +149,20 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
|
||||
let _res = []
|
||||
|
||||
if (Array.isArray(defaultValue)) {
|
||||
if (Array.isArray(example)) {
|
||||
example.forEach((v)=>{
|
||||
items.example = v
|
||||
_res.push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
return _res
|
||||
} else if (Array.isArray(defaultValue)) {
|
||||
defaultValue.forEach((v)=>{
|
||||
items.default = v
|
||||
_res.push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
return _res
|
||||
|
||||
}
|
||||
|
||||
return sampleXmlFromSchema(items, config)
|
||||
}
|
||||
}
|
||||
@@ -176,7 +186,13 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
} else {
|
||||
props[propName].xml.name = props[propName].xml.name || propName
|
||||
props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName]
|
||||
res[displayName].push(sampleXmlFromSchema(props[propName]))
|
||||
let t = sampleXmlFromSchema(props[propName])
|
||||
if (Array.isArray(t)) {
|
||||
res[displayName] = res[displayName].concat(t)
|
||||
} else {
|
||||
res[displayName].push(t)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ export const logRequest = (req) => {
|
||||
|
||||
// Actually fire the request via fn.execute
|
||||
// (For debugging) and ease of testing
|
||||
export const executeRequest = (req) => ({fn, specActions, errActions}) => {
|
||||
export const executeRequest = (req) => ({fn, specActions}) => {
|
||||
let { pathName, method } = req
|
||||
let parsedRequest = Object.assign({}, req)
|
||||
if ( pathName && method ) {
|
||||
|
||||
@@ -51,7 +51,6 @@ export default {
|
||||
|
||||
[VALIDATE_PARAMS]: ( state, { payload: { pathMethod } } ) => {
|
||||
let operation = state.getIn( [ "resolved", "paths", ...pathMethod ] )
|
||||
let parameters = operation.get("parameters")
|
||||
let isXml = /xml/i.test(operation.get("consumes_value"))
|
||||
|
||||
return state.updateIn( [ "resolved", "paths", ...pathMethod, "parameters" ], fromJS([]), parameters => {
|
||||
@@ -64,9 +63,6 @@ export default {
|
||||
})
|
||||
},
|
||||
[ClEAR_VALIDATE_PARAMS]: ( state, { payload: { pathMethod } } ) => {
|
||||
let operation = state.getIn( [ "resolved", "paths", ...pathMethod ] )
|
||||
let parameters = operation.get("parameters")
|
||||
|
||||
return state.updateIn( [ "resolved", "paths", ...pathMethod, "parameters" ], fromJS([]), parameters => {
|
||||
return parameters.withMutations( parameters => {
|
||||
for ( let i = 0, len = parameters.count(); i < len; i++ ) {
|
||||
|
||||
@@ -224,7 +224,7 @@ export const requestFor = (state, path, method) => {
|
||||
return requests(state).getIn([path, method], null)
|
||||
}
|
||||
|
||||
export const allowTryItOutFor = (state, path, method ) => {
|
||||
export const allowTryItOutFor = () => {
|
||||
// This is just a hook for now.
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -57,14 +57,14 @@ export default class SplitPaneMode extends React.Component {
|
||||
const mode = layoutSelectors.whatMode(MODE_KEY)
|
||||
const left = mode === MODE_RIGHT ? <noscript/> : children[0]
|
||||
const right = mode === MODE_LEFT ? <noscript/> : children[1]
|
||||
const size = this.sizeFromMode(mode, '50%')
|
||||
const size = this.sizeFromMode(mode, "50%")
|
||||
|
||||
return (
|
||||
<SplitPane
|
||||
disabledClass={''}
|
||||
ref={'splitPane'}
|
||||
disabledClass={""}
|
||||
ref={"splitPane"}
|
||||
split='vertical'
|
||||
defaultSize={'50%'}
|
||||
defaultSize={"50%"}
|
||||
primary="second"
|
||||
minSize={0}
|
||||
size={size}
|
||||
|
||||
@@ -3,10 +3,6 @@ import ReactDOM from "react-dom"
|
||||
import { connect, Provider } from "react-redux"
|
||||
import omit from "lodash/omit"
|
||||
|
||||
|
||||
const NotFoundComponent = name => ()=> <span style={{color: "red"}}> "{name}" component not found </span>
|
||||
|
||||
|
||||
const SystemWrapper = (getSystem, ComponentToWrap ) => class extends Component {
|
||||
render() {
|
||||
return <ComponentToWrap {...getSystem() } {...this.props} {...this.context} />
|
||||
@@ -75,10 +71,10 @@ const createClass = component => React.createClass({
|
||||
}
|
||||
})
|
||||
|
||||
const Fallback = ({ error, name }) => <div style={{ // eslint-disable-line react/prop-types
|
||||
const Fallback = ({ name }) => <div style={{ // eslint-disable-line react/prop-types
|
||||
padding: "1em",
|
||||
"color": "#aaa"
|
||||
}}>😱 <i>Could not render { name ? name : "this component" }, see console.</i></div>
|
||||
}}>😱 <i>Could not render { name || name === "t" ? name : "this component" }, see the console.</i></div>
|
||||
|
||||
const wrapRender = (component) => {
|
||||
const isStateless = component => !(component.prototype && component.prototype.isReactComponent)
|
||||
|
||||
Reference in New Issue
Block a user