Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/3135-request-duration

This commit is contained in:
Owen Conti
2017-06-26 19:58:07 -06:00
11 changed files with 78 additions and 88 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAitFA;;;;;;AAoIA;AAy2FA;AA8iCA;AA6lJA;AA8vIA;AA8iFA;AAi4GA;AA8jFA;AAu0FA;AA89CA;AAy9CA;AA+qCA;AAs0EA;;;;;AAw/CA;AA8zJA;;;;;;;;;;;;;;AAyoFA;AA+lIA;AA4oJA;AAqvHA;AAsvGA;AA2iEA;AAy5DA;AA65DA;AAAA;;;;;;AAk8GA;AA2nHA;;;;;AAkoDA;AAgsFA;AA6kDA;AAq3CA;AA4wFA;AAk3CA;AA8iFA;;;;;;;;;AA2qEA;AA2zIA;AAu7FA;AAmrFA;AAwiHA","sourceRoot":""} {"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AA+4CA;;;;;;AAoIA;AAy2FA;AA8iCA;AA6lJA;AA81IA;AAwuGA;AA01FA;AAkjFA;AAs3FA;AAi+CA;AA29CA;AAmtCA;AAuyEA;;;;;AAwiDA;AA8zJA;;;;;;;;;;;;;;AAyoFA;AA+lIA;AA4oJA;AAqvHA;AA8nGA;AA+iEA;AAw3DA;AA4nDA;AAknBA;;;;;;AAg1FA;AAggGA;;;;;AA23CA;AAgsFA;AA6kDA;AA01CA;AA8yFA;AA61CA;AA0jFA;;;;;;;;;AA6pEA;AA2zIA;AAu7FA;AAmrFA;AAq/EA","sourceRoot":""}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;AA+uFA;;;;;AAyOA;AAo7GA;AAw0FA;;;;;;AAmZA;AAivFA;AAu+CA;AAo+CA;AAirCA;AAuyEA","sourceRoot":""} {"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA+tEA;AAo7GA;AAw0FA;;;;;;AAmZA;AAivFA;AAu+CA;AAo+CA;AAirCA;AAuyEA","sourceRoot":""}

18
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAylFA;;;;;;AAg5CA;AA2pHA;AA6qIA;AAi+FA;AAyvDA;AAmzCA;AA+xCA","sourceRoot":""} {"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AA+nEA;;;;;;AAmgBA;AA2pHA;AA0pIA;AA09FA;AA0+CA;AAs0CA;AAgvCA","sourceRoot":""}

View File

@@ -1,11 +1,10 @@
import React, { PropTypes } from "react" import React, { PureComponent, PropTypes } from "react"
import shallowCompare from "react-addons-shallow-compare"
import { getList } from "core/utils" import { getList } from "core/utils"
import * as CustomPropTypes from "core/proptypes" import * as CustomPropTypes from "core/proptypes"
//import "less/opblock" //import "less/opblock"
export default class Operation extends React.Component { export default class Operation extends PureComponent {
static propTypes = { static propTypes = {
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,
method: 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 =() => { toggleShown =() => {
let { layoutActions, isShownKey } = this.props let { layoutActions, isShownKey } = this.props
layoutActions.show(isShownKey, !this.isShown()) layoutActions.show(isShownKey, !this.isShown())

View File

@@ -1,11 +1,10 @@
import React, { Component, PropTypes } from "react" import React, { PureComponent, PropTypes } from "react"
import shallowCompare from "react-addons-shallow-compare"
import { fromJS, List } from "immutable" import { fromJS, List } from "immutable"
import { getSampleSchema } from "core/utils" import { getSampleSchema } from "core/utils"
const NOOP = Function.prototype const NOOP = Function.prototype
export default class ParamBody extends Component { export default class ParamBody extends PureComponent {
static propTypes = { static propTypes = {
param: PropTypes.object, param: PropTypes.object,
@@ -41,10 +40,6 @@ export default class ParamBody extends Component {
this.updateValues.call(this, this.props) this.updateValues.call(this, this.props)
} }
shouldComponentUpdate(props, state) {
return shallowCompare(this, props, state)
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
this.updateValues.call(this, nextProps) this.updateValues.call(this, nextProps)
} }

View File

@@ -5,14 +5,16 @@ import { getSampleSchema } from "core/utils"
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => { const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
if ( examples && examples.size ) { if ( examples && examples.size ) {
return examples.entrySeq().map( ([ key, example ]) => { return examples.entrySeq().map( ([ key, example ]) => {
let exampleValue let exampleValue = example
if ( example.toJS ) {
try { try {
exampleValue = example && example.toJS ? example.toJS() : example exampleValue = JSON.stringify(example.toJS(), null, 2)
exampleValue = JSON.stringify(exampleValue, null, 2)
} }
catch(e) { catch(e) {
exampleValue = String(example) exampleValue = String(example)
} }
}
return (<div key={ key }> return (<div key={ key }>
<h5>{ key }</h5> <h5>{ key }</h5>
<HighlightCode className="example" value={ exampleValue } /> <HighlightCode className="example" value={ exampleValue } />

View File

@@ -1,5 +1,4 @@
import React, { PropTypes, Component } from "react" import React, { PropTypes, PureComponent, Component } from "react"
import shallowCompare from "react-addons-shallow-compare"
import { List, fromJS } from "immutable" import { List, fromJS } from "immutable"
//import "less/json-schema-form" //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 propTypes = JsonSchemaPropShape
static defaultProps = JsonSchemaDefaultProps static defaultProps = JsonSchemaDefaultProps
@@ -89,10 +88,6 @@ export class JsonSchema_array extends Component {
this.setState({value: props.value}) this.setState({value: props.value})
} }
shouldComponentUpdate(props, state) {
return shallowCompare(this, props, state)
}
onChange = () => this.props.onChange(this.state.value) onChange = () => this.props.onChange(this.state.value)
onItemChange = (itemVal, i) => { onItemChange = (itemVal, i) => {

View File

@@ -9,7 +9,7 @@ const primitives = {
"number": () => 0, "number": () => 0,
"number_float": () => 0.0, "number_float": () => 0.0,
"integer": () => 0, "integer": () => 0,
"boolean": () => true "boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
} }
const primitive = (schema) => { const primitive = (schema) => {
@@ -74,6 +74,10 @@ export const sampleFromSchema = (schema, config={}) => {
return normalizeArray(schema["enum"])[0] return normalizeArray(schema["enum"])[0]
} }
if (type === "file") {
return
}
return primitive(schema) return primitive(schema)
} }