Merge branch 'master' into ft/deeplinking-link-component
This commit is contained in:
@@ -12,11 +12,12 @@ export default class ArrayModel extends Component {
|
||||
name: PropTypes.string,
|
||||
required: PropTypes.bool,
|
||||
expandDepth: PropTypes.number,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
depth: PropTypes.number
|
||||
}
|
||||
|
||||
render(){
|
||||
let { getComponent, getConfigs, schema, depth, expandDepth, name } = this.props
|
||||
let { getComponent, getConfigs, schema, depth, expandDepth, name, specPath } = this.props
|
||||
let description = schema.get("description")
|
||||
let items = schema.get("items")
|
||||
let title = schema.get("title") || name
|
||||
@@ -47,7 +48,7 @@ export default class ArrayModel extends Component {
|
||||
!description ? null :
|
||||
<Markdown source={ description } />
|
||||
}
|
||||
<span><Model { ...this.props } getConfigs={ getConfigs } name={null} schema={ items } required={ false } depth={ depth + 1 } /></span>
|
||||
<span><Model { ...this.props } getConfigs={ getConfigs } specPath={[...specPath, "items"]} name={null} schema={ items } required={ false } depth={ depth + 1 } /></span>
|
||||
]
|
||||
</ModelCollapse>
|
||||
</span>
|
||||
|
||||
@@ -8,7 +8,8 @@ export default class ModelExample extends React.Component {
|
||||
schema: PropTypes.object.isRequired,
|
||||
example: PropTypes.any.isRequired,
|
||||
isExecute: PropTypes.bool,
|
||||
getConfigs: PropTypes.func.isRequired
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
}
|
||||
|
||||
constructor(props, context) {
|
||||
@@ -32,7 +33,7 @@ export default class ModelExample extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let { getComponent, specSelectors, schema, example, isExecute, getConfigs } = this.props
|
||||
let { getComponent, specSelectors, schema, example, isExecute, getConfigs, specPath } = this.props
|
||||
let { defaultModelExpandDepth } = getConfigs()
|
||||
const ModelWrapper = getComponent("ModelWrapper")
|
||||
|
||||
@@ -54,7 +55,8 @@ export default class ModelExample extends React.Component {
|
||||
getComponent={ getComponent }
|
||||
getConfigs={ getConfigs }
|
||||
specSelectors={ specSelectors }
|
||||
expandDepth={ defaultModelExpandDepth } />
|
||||
expandDepth={ defaultModelExpandDepth }
|
||||
specPath={specPath} />
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ export default class Model extends PureComponent {
|
||||
isRef: PropTypes.bool,
|
||||
required: PropTypes.bool,
|
||||
expandDepth: PropTypes.number,
|
||||
depth: PropTypes.number
|
||||
depth: PropTypes.number,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
}
|
||||
|
||||
getModelName =( ref )=> {
|
||||
@@ -31,7 +32,7 @@ export default class Model extends PureComponent {
|
||||
}
|
||||
|
||||
render () {
|
||||
let { getComponent, getConfigs, specSelectors, schema, required, name, isRef } = this.props
|
||||
let { getComponent, getConfigs, specSelectors, schema, required, name, isRef, specPath } = this.props
|
||||
const ObjectModel = getComponent("ObjectModel")
|
||||
const ArrayModel = getComponent("ArrayModel")
|
||||
const PrimitiveModel = getComponent("PrimitiveModel")
|
||||
@@ -55,6 +56,7 @@ export default class Model extends PureComponent {
|
||||
case "object":
|
||||
return <ObjectModel
|
||||
className="object" { ...this.props }
|
||||
specPath={specPath}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ schema }
|
||||
name={ name }
|
||||
|
||||
@@ -15,6 +15,7 @@ export default class Models extends Component {
|
||||
let definitions = specSelectors.definitions()
|
||||
let { docExpansion, defaultModelExpandDepth } = getConfigs()
|
||||
let showModels = layoutSelectors.isShown("models", docExpansion === "full" || docExpansion === "list" )
|
||||
const specPathBase = specSelectors.isOAS3() ? ["components", "schemas"] : ["definitions"]
|
||||
|
||||
const ModelWrapper = getComponent("ModelWrapper")
|
||||
const Collapse = getComponent("Collapse")
|
||||
@@ -35,6 +36,7 @@ export default class Models extends Component {
|
||||
<ModelWrapper name={ name }
|
||||
expandDepth={ defaultModelExpandDepth }
|
||||
schema={ model }
|
||||
specPath={[...specPathBase, name]}
|
||||
getComponent={ getComponent }
|
||||
getConfigs={ getConfigs }
|
||||
specSelectors={ specSelectors }/>
|
||||
|
||||
@@ -14,13 +14,15 @@ export default class ObjectModel extends Component {
|
||||
name: PropTypes.string,
|
||||
isRef: PropTypes.bool,
|
||||
expandDepth: PropTypes.number,
|
||||
depth: PropTypes.number
|
||||
depth: PropTypes.number,
|
||||
specPath: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
render(){
|
||||
let { schema, name, isRef, getComponent, getConfigs, depth, expandDepth, ...otherProps } = this.props
|
||||
let { schema, name, isRef, getComponent, getConfigs, depth, specPath, expandDepth, ...otherProps } = this.props
|
||||
let { specSelectors } = otherProps
|
||||
let { isOAS3 } = specSelectors
|
||||
|
||||
const { isOAS3 } = specSelectors
|
||||
|
||||
if(!schema) {
|
||||
return null
|
||||
@@ -39,14 +41,13 @@ export default class ObjectModel extends Component {
|
||||
const Model = getComponent("Model")
|
||||
const ModelCollapse = getComponent("ModelCollapse")
|
||||
|
||||
const JumpToPathSection = ({ name }) => {
|
||||
const path = isOAS3 && isOAS3() ? `components.schemas.${name}` : `definitions.${name}`
|
||||
return <span className="model-jump-to-path"><JumpToPath path={path} /></span>
|
||||
const JumpToPathSection = () => {
|
||||
return <span className="model-jump-to-path"><JumpToPath specPath={specPath} /></span>
|
||||
}
|
||||
const collapsedContent = (<span>
|
||||
<span>{ braceOpen }</span>...<span>{ braceClose }</span>
|
||||
{
|
||||
isRef ? <JumpToPathSection name={ name }/> : ""
|
||||
isRef ? <JumpToPathSection /> : ""
|
||||
}
|
||||
</span>)
|
||||
|
||||
@@ -63,7 +64,7 @@ export default class ObjectModel extends Component {
|
||||
<ModelCollapse title={titleEl} collapsed={ depth > expandDepth } collapsedContent={ collapsedContent }>
|
||||
<span className="brace-open object">{ braceOpen }</span>
|
||||
{
|
||||
!isRef ? null : <JumpToPathSection name={ name }/>
|
||||
!isRef ? null : <JumpToPathSection />
|
||||
}
|
||||
<span className="inner-object">
|
||||
{
|
||||
@@ -94,6 +95,7 @@ export default class ObjectModel extends Component {
|
||||
<Model key={ `object-${name}-${key}_${value}` } { ...otherProps }
|
||||
required={ isRequired }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, "properties", key]}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ value }
|
||||
depth={ depth + 1 } />
|
||||
@@ -132,6 +134,7 @@ export default class ObjectModel extends Component {
|
||||
<td>
|
||||
<Model { ...otherProps } required={ false }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, "additionalProperties"]}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ additionalProperties }
|
||||
depth={ depth + 1 } />
|
||||
@@ -146,6 +149,7 @@ export default class ObjectModel extends Component {
|
||||
{anyOf.map((schema, k) => {
|
||||
return <div key={k}><Model { ...otherProps } required={ false }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, "anyOf", k]}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ schema }
|
||||
depth={ depth + 1 } /></div>
|
||||
@@ -161,6 +165,7 @@ export default class ObjectModel extends Component {
|
||||
{oneOf.map((schema, k) => {
|
||||
return <div key={k}><Model { ...otherProps } required={ false }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, "oneOf", k]}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ schema }
|
||||
depth={ depth + 1 } /></div>
|
||||
@@ -177,6 +182,7 @@ export default class ObjectModel extends Component {
|
||||
<Model { ...otherProps }
|
||||
required={ false }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, "not"]}
|
||||
getConfigs={ getConfigs }
|
||||
schema={ not }
|
||||
depth={ depth + 1 } />
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Iterable } from "immutable"
|
||||
|
||||
export default class Operation extends PureComponent {
|
||||
static propTypes = {
|
||||
specPath: PropTypes.array.isRequired,
|
||||
operation: PropTypes.instanceOf(Iterable).isRequired,
|
||||
response: PropTypes.instanceOf(Iterable),
|
||||
request: PropTypes.instanceOf(Iterable),
|
||||
@@ -36,6 +37,7 @@ export default class Operation extends PureComponent {
|
||||
|
||||
render() {
|
||||
let {
|
||||
specPath,
|
||||
response,
|
||||
request,
|
||||
toggleShown,
|
||||
@@ -57,7 +59,6 @@ export default class Operation extends PureComponent {
|
||||
let {
|
||||
isShown,
|
||||
isAuthorized,
|
||||
jumpToKey,
|
||||
path,
|
||||
method,
|
||||
op,
|
||||
@@ -113,8 +114,10 @@ export default class Operation extends PureComponent {
|
||||
let onChangeKey = [ path, method ] // Used to add values to _this_ operation ( indexed by path and method )
|
||||
|
||||
return (
|
||||
<div className={`opblock-summary opblock-summary-${method}`} onClick={toggleShown} >
|
||||
{/*TODO: convert this into a component, that can be wrapped
|
||||
and pulled in with getComponent */}
|
||||
<div className={deprecated ? "opblock opblock-deprecated" : isShown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`} id={isShownKey.join("-")} >
|
||||
<div className={`opblock-summary opblock-summary-${method}`} onClick={toggleShown} >
|
||||
<span className="opblock-summary-method">{method.toUpperCase()}</span>
|
||||
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
|
||||
<DeepLinkingLink
|
||||
@@ -122,7 +125,7 @@ export default class Operation extends PureComponent {
|
||||
isShown={isShown}
|
||||
path={`${isShownKey.join("/")}`}
|
||||
text={path} />
|
||||
<JumpToPath path={jumpToKey} />
|
||||
<JumpToPath path={specPath} /> {/*TODO: use wrapComponents here, swagger-ui doesn't care about jumpToPath */}
|
||||
</span>
|
||||
|
||||
{ !showSummary ? null :
|
||||
@@ -170,6 +173,7 @@ export default class Operation extends PureComponent {
|
||||
|
||||
<Parameters
|
||||
parameters={parameters}
|
||||
specPath={[...specPath, "parameters"]}
|
||||
operation={operation}
|
||||
onChangeKey={onChangeKey}
|
||||
onTryoutClick = { onTryoutClick }
|
||||
@@ -243,6 +247,7 @@ export default class Operation extends PureComponent {
|
||||
specActions={ specActions }
|
||||
produces={ produces }
|
||||
producesValue={ operation.get("produces_value") }
|
||||
specPath={[...specPath, "responses"]}
|
||||
path={ path }
|
||||
method={ method }
|
||||
displayRequestDuration={ displayRequestDuration }
|
||||
|
||||
@@ -2,6 +2,13 @@ import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { createDeepLinkPath, sanitizeUrl } from "core/utils"
|
||||
|
||||
const SWAGGER2_OPERATION_METHODS = [
|
||||
"get", "put", "post", "delete", "options", "head", "patch"
|
||||
]
|
||||
|
||||
const OAS3_OPERATION_METHODS = SWAGGER2_OPERATION_METHODS.concat(["trace"])
|
||||
|
||||
|
||||
export default class Operations extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
@@ -112,9 +119,24 @@ export default class Operations extends React.Component {
|
||||
operations.map( op => {
|
||||
const path = op.get("path")
|
||||
const method = op.get("method")
|
||||
const specPath = ["paths", path, method]
|
||||
|
||||
|
||||
// FIXME: (someday) this logic should probably be in a selector,
|
||||
// but doing so would require further opening up
|
||||
// selectors to the plugin system, to allow for dynamic
|
||||
// overriding of low-level selectors that other selectors
|
||||
// rely on. --KS, 12/17
|
||||
const validMethods = specSelectors.isOAS3() ?
|
||||
OAS3_OPERATION_METHODS : SWAGGER2_OPERATION_METHODS
|
||||
|
||||
if(validMethods.indexOf(method) === -1) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <OperationContainer
|
||||
key={`${path}-${method}`}
|
||||
specPath={specPath}
|
||||
op={op}
|
||||
path={path}
|
||||
method={method}
|
||||
|
||||
@@ -14,7 +14,8 @@ export default class ParameterRow extends Component {
|
||||
onChangeConsumes: PropTypes.func.isRequired,
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
pathMethod: PropTypes.array.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
}
|
||||
|
||||
constructor(props, context) {
|
||||
@@ -69,7 +70,7 @@ export default class ParameterRow extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let {param, onChange, getComponent, getConfigs, isExecute, fn, onChangeConsumes, specSelectors, pathMethod} = this.props
|
||||
let {param, onChange, getComponent, getConfigs, isExecute, fn, onChangeConsumes, specSelectors, pathMethod, specPath} = this.props
|
||||
|
||||
let { isOAS3 } = specSelectors
|
||||
|
||||
@@ -138,6 +139,7 @@ export default class ParameterRow extends Component {
|
||||
|
||||
{
|
||||
bodyParam && schema ? <ModelExample getComponent={ getComponent }
|
||||
specPath={[...specPath, "schema"]}
|
||||
getConfigs={ getConfigs }
|
||||
isExecute={ isExecute }
|
||||
specSelectors={ specSelectors }
|
||||
|
||||
@@ -20,7 +20,8 @@ export default class Parameters extends Component {
|
||||
onCancelClick: PropTypes.func,
|
||||
onChangeKey: PropTypes.array,
|
||||
pathMethod: PropTypes.array.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +31,7 @@ export default class Parameters extends Component {
|
||||
tryItOutEnabled: false,
|
||||
allowTryItOut: true,
|
||||
onChangeKey: [],
|
||||
specPath: [],
|
||||
}
|
||||
|
||||
onChange = ( param, value, isXml ) => {
|
||||
@@ -58,6 +60,7 @@ export default class Parameters extends Component {
|
||||
parameters,
|
||||
allowTryItOut,
|
||||
tryItOutEnabled,
|
||||
specPath,
|
||||
|
||||
fn,
|
||||
getComponent,
|
||||
@@ -92,8 +95,10 @@ export default class Parameters extends Component {
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
eachMap(parameters, (parameter) => (
|
||||
<ParameterRow fn={ fn }
|
||||
eachMap(parameters, (parameter, i) => (
|
||||
<ParameterRow
|
||||
fn={ fn }
|
||||
specPath={[...specPath, i]}
|
||||
getComponent={ getComponent }
|
||||
getConfigs={ getConfigs }
|
||||
param={ parameter }
|
||||
|
||||
@@ -47,6 +47,7 @@ export default class Response extends React.Component {
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
fn: PropTypes.object.isRequired,
|
||||
contentType: PropTypes.string,
|
||||
controlsAcceptHeader: PropTypes.bool,
|
||||
@@ -72,6 +73,7 @@ export default class Response extends React.Component {
|
||||
code,
|
||||
response,
|
||||
className,
|
||||
specPath,
|
||||
fn,
|
||||
getComponent,
|
||||
getConfigs,
|
||||
@@ -94,16 +96,19 @@ export default class Response extends React.Component {
|
||||
const ContentType = getComponent("contentType")
|
||||
|
||||
var sampleResponse
|
||||
var schema
|
||||
var schema, specPathWithPossibleSchema
|
||||
|
||||
if(isOAS3()) {
|
||||
let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"])
|
||||
const schemaPath = ["content", this.state.responseContentType, "schema"]
|
||||
const oas3SchemaForContentType = response.getIn(schemaPath)
|
||||
sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, {
|
||||
includeReadOnly: true
|
||||
}) : null
|
||||
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
|
||||
specPathWithPossibleSchema = oas3SchemaForContentType ? schemaPath : specPath
|
||||
} else {
|
||||
schema = inferSchema(response.toJS())
|
||||
schema = inferSchema(response.toJS()) // TODO: don't convert back and forth. Lets just stick with immutable for inferSchema
|
||||
specPathWithPossibleSchema = response.has("schema") ? [...specPath, "schema"] : specPath
|
||||
sampleResponse = schema ? getSampleSchema(schema, contentType, {
|
||||
includeReadOnly: true,
|
||||
includeWriteOnly: true // writeOnly has no filtering effect in swagger 2.0
|
||||
@@ -145,6 +150,7 @@ export default class Response extends React.Component {
|
||||
|
||||
{ example ? (
|
||||
<ModelExample
|
||||
specPath={specPathWithPossibleSchema}
|
||||
getComponent={ getComponent }
|
||||
getConfigs={ getConfigs }
|
||||
specSelectors={ specSelectors }
|
||||
|
||||
@@ -17,6 +17,7 @@ export default class Responses extends React.Component {
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
specActions: PropTypes.object.isRequired,
|
||||
oas3Actions: PropTypes.object.isRequired,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
fn: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
@@ -60,7 +61,8 @@ export default class Responses extends React.Component {
|
||||
specSelectors,
|
||||
fn,
|
||||
producesValue,
|
||||
displayRequestDuration
|
||||
displayRequestDuration,
|
||||
specPath,
|
||||
} = this.props
|
||||
let defaultCode = defaultStatusCode( responses )
|
||||
|
||||
@@ -114,9 +116,11 @@ export default class Responses extends React.Component {
|
||||
<tbody>
|
||||
{
|
||||
responses.entrySeq().map( ([code, response]) => {
|
||||
|
||||
let className = tryItOutResponse && tryItOutResponse.get("status") == code ? "response_current" : ""
|
||||
return (
|
||||
<Response key={ code }
|
||||
specPath={[...specPath, code]}
|
||||
isDefault={defaultCode === code}
|
||||
fn={fn}
|
||||
className={ className }
|
||||
|
||||
@@ -3,11 +3,12 @@ import deepExtend from "deep-extend"
|
||||
import System from "core/system"
|
||||
import win from "core/window"
|
||||
import ApisPreset from "core/presets/apis"
|
||||
|
||||
import * as AllPlugins from "core/plugins/all"
|
||||
import { parseSearch } from "core/utils"
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
window.Perf = require("react-addons-perf")
|
||||
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
||||
win.Perf = require("react-addons-perf")
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
|
||||
@@ -10,6 +10,7 @@ const RequestBody = ({
|
||||
specSelectors,
|
||||
contentType,
|
||||
isExecute,
|
||||
specPath,
|
||||
onChange
|
||||
}) => {
|
||||
const Markdown = getComponent("Markdown")
|
||||
@@ -37,6 +38,7 @@ const RequestBody = ({
|
||||
expandDepth={1}
|
||||
isExecute={isExecute}
|
||||
schema={mediaTypeValue.get("schema")}
|
||||
specPath={[...specPath, "content", contentType]}
|
||||
example={<RequestBodyEditor
|
||||
requestBody={requestBody}
|
||||
onChange={onChange}
|
||||
@@ -56,7 +58,8 @@ RequestBody.propTypes = {
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
contentType: PropTypes.string,
|
||||
isExecute: PropTypes.bool.isRequired,
|
||||
onChange: PropTypes.func.isRequired
|
||||
onChange: PropTypes.func.isRequired,
|
||||
specPath: PropTypes.array.isRequired
|
||||
}
|
||||
|
||||
export default RequestBody
|
||||
|
||||
@@ -6,7 +6,7 @@ export function isOAS3(jsSpec) {
|
||||
return false
|
||||
}
|
||||
|
||||
return oasVersion.startsWith("3.0.0")
|
||||
return oasVersion.startsWith("3")
|
||||
}
|
||||
|
||||
export function isSwagger2(jsSpec) {
|
||||
|
||||
@@ -29,6 +29,7 @@ class Parameters extends Component {
|
||||
fn: PropTypes.object.isRequired,
|
||||
tryItOutEnabled: PropTypes.bool,
|
||||
allowTryItOut: PropTypes.bool,
|
||||
specPath: PropTypes.array.isRequired,
|
||||
onTryoutClick: PropTypes.func,
|
||||
onCancelClick: PropTypes.func,
|
||||
onChangeKey: PropTypes.array,
|
||||
@@ -92,6 +93,7 @@ class Parameters extends Component {
|
||||
oas3Actions,
|
||||
oas3Selectors,
|
||||
pathMethod,
|
||||
specPath,
|
||||
operation
|
||||
} = this.props
|
||||
|
||||
@@ -105,6 +107,8 @@ class Parameters extends Component {
|
||||
const { isOAS3 } = specSelectors
|
||||
|
||||
const requestBody = operation.get("requestBody")
|
||||
const requestBodySpecPath = [...specPath.slice(0, -1), "requestBody"] // remove the "parameters" part
|
||||
|
||||
return (
|
||||
<div className="opblock-section">
|
||||
<div className="opblock-section-header">
|
||||
@@ -136,9 +140,10 @@ class Parameters extends Component {
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
eachMap(parameters, (parameter) => (
|
||||
eachMap(parameters, (parameter, i) => (
|
||||
<ParameterRow fn={ fn }
|
||||
getComponent={ getComponent }
|
||||
specPath={[...specPath, i]}
|
||||
getConfigs={ getConfigs }
|
||||
param={ parameter }
|
||||
key={ parameter.get( "name" ) }
|
||||
@@ -175,6 +180,7 @@ class Parameters extends Component {
|
||||
</div>
|
||||
<div className="opblock-description-wrapper">
|
||||
<RequestBody
|
||||
specPath={requestBodySpecPath}
|
||||
requestBody={requestBody}
|
||||
isExecute={isExecute}
|
||||
onChange={(value) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ export const SET_MUTATED_REQUEST = "spec_set_mutated_request"
|
||||
export const LOG_REQUEST = "spec_log_request"
|
||||
export const CLEAR_RESPONSE = "spec_clear_response"
|
||||
export const CLEAR_REQUEST = "spec_clear_request"
|
||||
export const ClEAR_VALIDATE_PARAMS = "spec_clear_validate_param"
|
||||
export const CLEAR_VALIDATE_PARAMS = "spec_clear_validate_param"
|
||||
export const UPDATE_OPERATION_VALUE = "spec_update_operation_value"
|
||||
export const UPDATE_RESOLVED = "spec_update_resolved"
|
||||
export const SET_SCHEME = "set_scheme"
|
||||
@@ -161,7 +161,7 @@ export const validateParams = ( payload, isOAS3 ) =>{
|
||||
|
||||
export function clearValidateParams( payload ){
|
||||
return {
|
||||
type: ClEAR_VALIDATE_PARAMS,
|
||||
type: CLEAR_VALIDATE_PARAMS,
|
||||
payload:{ pathMethod: payload }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
UPDATE_OPERATION_VALUE,
|
||||
CLEAR_RESPONSE,
|
||||
CLEAR_REQUEST,
|
||||
ClEAR_VALIDATE_PARAMS,
|
||||
CLEAR_VALIDATE_PARAMS,
|
||||
SET_SCHEME
|
||||
} from "./actions"
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
[ClEAR_VALIDATE_PARAMS]: ( state, { payload: { pathMethod } } ) => {
|
||||
[CLEAR_VALIDATE_PARAMS]: ( state, { payload: { pathMethod } } ) => {
|
||||
return state.updateIn( [ "resolved", "paths", ...pathMethod, "parameters" ], fromJS([]), parameters => {
|
||||
return parameters.withMutations( parameters => {
|
||||
for ( let i = 0, len = parameters.count(); i < len; i++ ) {
|
||||
|
||||
@@ -4,8 +4,6 @@ import { fromJS, Set, Map, OrderedMap, List } from "immutable"
|
||||
|
||||
const DEFAULT_TAG = "default"
|
||||
|
||||
const OPERATION_METHODS = ["get", "put", "post", "delete", "options", "head", "patch"]
|
||||
|
||||
const state = state => {
|
||||
return state || Map()
|
||||
}
|
||||
@@ -97,9 +95,6 @@ export const operations = createSelector(
|
||||
return {}
|
||||
}
|
||||
path.forEach((operation, method) => {
|
||||
if(OPERATION_METHODS.indexOf(method) === -1) {
|
||||
return
|
||||
}
|
||||
list = list.push(fromJS({
|
||||
path: pathName,
|
||||
method,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import React from "react"
|
||||
import { createStore, applyMiddleware, bindActionCreators, compose } from "redux"
|
||||
import Im, { fromJS, Map } from "immutable"
|
||||
import deepExtend from "deep-extend"
|
||||
@@ -97,7 +98,8 @@ export default class Store {
|
||||
getComponents: this.getComponents.bind(this),
|
||||
getState: this.getStore().getState,
|
||||
getConfigs: this._getConfigs.bind(this),
|
||||
Im
|
||||
Im,
|
||||
React
|
||||
}, this.system.rootInjects || {})
|
||||
}
|
||||
|
||||
@@ -264,8 +266,9 @@ export default class Store {
|
||||
|
||||
dispatch = dispatch || this.getStore().dispatch
|
||||
|
||||
const process = creator =>{
|
||||
const actions = this.getActions()
|
||||
|
||||
const process = creator =>{
|
||||
if( typeof( creator ) !== "function" ) {
|
||||
return objMap(creator, prop => process(prop))
|
||||
}
|
||||
@@ -284,7 +287,7 @@ export default class Store {
|
||||
}
|
||||
|
||||
}
|
||||
return objMap(this.getActions(), actionCreator => bindActionCreators( process( actionCreator ), dispatch ) )
|
||||
return objMap(actions, actionCreator => bindActionCreators( process( actionCreator ), dispatch ) )
|
||||
}
|
||||
|
||||
getMapStateToProps() {
|
||||
@@ -333,17 +336,22 @@ function systemExtend(dest={}, src={}) {
|
||||
// Parses existing components in the system, and prepares them for wrapping via getComponents
|
||||
if(src.wrapComponents) {
|
||||
objMap(src.wrapComponents, (wrapperFn, key) => {
|
||||
const ori = dest.components[key]
|
||||
const ori = dest.components && dest.components[key]
|
||||
if(ori && Array.isArray(ori)) {
|
||||
dest.components[key] = ori.concat([wrapperFn])
|
||||
delete src.wrapComponents[key]
|
||||
} else if(ori) {
|
||||
dest.components[key] = [ori, wrapperFn]
|
||||
} else {
|
||||
dest.components[key] = null
|
||||
delete src.wrapComponents[key]
|
||||
}
|
||||
})
|
||||
|
||||
delete src.wrapComponents
|
||||
if(!Object.keys(src.wrapComponents).length) {
|
||||
// only delete wrapComponents if we've matched all of our wrappers to components
|
||||
// this handles cases where the component to wrap may be out of our scope,
|
||||
// but a higher recursive `combinePlugins` call will be able to handle it.
|
||||
delete src.wrapComponents
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -607,7 +607,10 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
|
||||
|
||||
export const parseSearch = () => {
|
||||
let map = {}
|
||||
let search = window.location.search
|
||||
let search = win.location.search
|
||||
|
||||
if(!search)
|
||||
return {}
|
||||
|
||||
if ( search != "" ) {
|
||||
let params = search.substr(1).split("&")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Promise global, Used ( at least ) by 'whatwg-fetch'. And required by IE 11
|
||||
|
||||
if(!window.Promise) {
|
||||
if(typeof Promise === "undefined") {
|
||||
require("core-js/fn/promise")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user