Merge branch 'master' into bug/3136-operation-scheme-update
This commit is contained in:
@@ -24,8 +24,8 @@ export default class Models extends Component {
|
||||
return <section className={ showModels ? "models is-open" : "models"}>
|
||||
<h4 onClick={() => layoutActions.show("models", !showModels)}>
|
||||
<span>Models</span>
|
||||
<svg width="20" height="20">
|
||||
<use xlinkHref="#large-arrow" />
|
||||
<svg className="arrow" width="20" height="20">
|
||||
<use xlinkHref={showModels ? "#large-arrow-down" : "#large-arrow"} />
|
||||
</svg>
|
||||
</h4>
|
||||
<Collapse isOpened={showModels} animated>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, { PropTypes } from "react"
|
||||
import shallowCompare from "react-addons-shallow-compare"
|
||||
import React, { PureComponent, PropTypes } from "react"
|
||||
import { getList } from "core/utils"
|
||||
import * as CustomPropTypes from "core/proptypes"
|
||||
|
||||
//import "less/opblock"
|
||||
|
||||
export default class Operation extends React.Component {
|
||||
export default class Operation extends PureComponent {
|
||||
static propTypes = {
|
||||
path: PropTypes.string.isRequired,
|
||||
method: PropTypes.string.isRequired,
|
||||
@@ -70,10 +69,6 @@ export default class Operation extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(props, state) {
|
||||
return shallowCompare(this, props, state)
|
||||
}
|
||||
|
||||
toggleShown =() => {
|
||||
let { layoutActions, isShownKey } = this.props
|
||||
layoutActions.show(isShownKey, !this.isShown())
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, { Component, PropTypes } from "react"
|
||||
import shallowCompare from "react-addons-shallow-compare"
|
||||
import React, { PureComponent, PropTypes } from "react"
|
||||
import { fromJS, List } from "immutable"
|
||||
import { getSampleSchema } from "core/utils"
|
||||
|
||||
const NOOP = Function.prototype
|
||||
|
||||
export default class ParamBody extends Component {
|
||||
export default class ParamBody extends PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
param: PropTypes.object,
|
||||
@@ -41,10 +40,6 @@ export default class ParamBody extends Component {
|
||||
this.updateValues.call(this, this.props)
|
||||
}
|
||||
|
||||
shouldComponentUpdate(props, state) {
|
||||
return shallowCompare(this, props, state)
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.updateValues.call(this, nextProps)
|
||||
}
|
||||
|
||||
@@ -5,14 +5,16 @@ import { getSampleSchema } from "core/utils"
|
||||
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
|
||||
if ( examples && examples.size ) {
|
||||
return examples.entrySeq().map( ([ key, example ]) => {
|
||||
let exampleValue
|
||||
try {
|
||||
exampleValue = example && example.toJS ? example.toJS() : example
|
||||
exampleValue = JSON.stringify(exampleValue, null, 2)
|
||||
}
|
||||
catch(e) {
|
||||
exampleValue = String(example)
|
||||
let exampleValue = example
|
||||
if ( example.toJS ) {
|
||||
try {
|
||||
exampleValue = JSON.stringify(example.toJS(), null, 2)
|
||||
}
|
||||
catch(e) {
|
||||
exampleValue = String(example)
|
||||
}
|
||||
}
|
||||
|
||||
return (<div key={ key }>
|
||||
<h5>{ key }</h5>
|
||||
<HighlightCode className="example" value={ exampleValue } />
|
||||
|
||||
@@ -6,7 +6,7 @@ import ApisPreset from "core/presets/apis"
|
||||
import * as AllPlugins from "core/plugins/all"
|
||||
import { parseSeach, filterConfigs } from "core/utils"
|
||||
|
||||
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
||||
const CONFIGS = [ "url", "urls", "urls.primaryName", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
||||
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
|
||||
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" ]
|
||||
|
||||
@@ -23,6 +23,7 @@ module.exports = function SwaggerUI(opts) {
|
||||
dom_id: null,
|
||||
spec: {},
|
||||
url: "",
|
||||
urls: null,
|
||||
layout: "BaseLayout",
|
||||
docExpansion: "list",
|
||||
validatorUrl: "https://online.swagger.io/validator",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { PropTypes, Component } from "react"
|
||||
import shallowCompare from "react-addons-shallow-compare"
|
||||
import React, { PropTypes, PureComponent, Component } from "react"
|
||||
import { List, fromJS } from "immutable"
|
||||
//import "less/json-schema-form"
|
||||
|
||||
@@ -74,7 +73,7 @@ export class JsonSchema_string extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export class JsonSchema_array extends Component {
|
||||
export class JsonSchema_array extends PureComponent {
|
||||
|
||||
static propTypes = JsonSchemaPropShape
|
||||
static defaultProps = JsonSchemaDefaultProps
|
||||
@@ -89,10 +88,6 @@ export class JsonSchema_array extends Component {
|
||||
this.setState({value: props.value})
|
||||
}
|
||||
|
||||
shouldComponentUpdate(props, state) {
|
||||
return shallowCompare(this, props, state)
|
||||
}
|
||||
|
||||
onChange = () => this.props.onChange(this.state.value)
|
||||
|
||||
onItemChange = (itemVal, i) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ const primitives = {
|
||||
"number": () => 0,
|
||||
"number_float": () => 0.0,
|
||||
"integer": () => 0,
|
||||
"boolean": () => true
|
||||
"boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
|
||||
}
|
||||
|
||||
const primitive = (schema) => {
|
||||
@@ -74,6 +74,10 @@ export const sampleFromSchema = (schema, config={}) => {
|
||||
return normalizeArray(schema["enum"])[0]
|
||||
}
|
||||
|
||||
if (type === "file") {
|
||||
return
|
||||
}
|
||||
|
||||
return primitive(schema)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user