Skip to content

Commit 2caa915

Browse files
authored
Merge branch 'master' into bug/3100-sub-objects-as-required
2 parents a18c100 + 0c28a50 commit 2caa915

37 files changed

+580
-602
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ displayOperationId | Controls the display of operationId in operations list. The
146146
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
147147
maxDisplayedTags | If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
148148
filter | If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be true/false to enable or disable, or an explicit filter string in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag.
149+
deepLinking | If set to `true`, enables dynamic deep linking for tags and operations. [Docs](https://github.com/swagger-api/swagger-ui/blob/master/docs/deep-linking.md)
149150

150151
### Plugins
151152

@@ -235,6 +236,10 @@ Access-Control-Allow-Headers: Content-Type, api_key, Authorization
235236

236237
Only headers with these names will be allowed to be sent by Swagger-UI.
237238

239+
## Security contact
240+
241+
Please disclose any security-related issues or vulnerabilities by emailing [[email protected]](mailto:[email protected]), instead of using the public issue tracker.
242+
238243
## License
239244

240245
Copyright 2017 SmartBear Software

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
const ui = SwaggerUIBundle({
7777
url: "http://petstore.swagger.io/v2/swagger.json",
7878
dom_id: '#swagger-ui',
79+
deepLinking: true,
7980
presets: [
8081
SwaggerUIBundle.presets.apis,
8182
SwaggerUIStandalonePreset

make-webpack-config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ module.exports = function(rules, options) {
6161
}
6262

6363
if( specialOptions.minimize ) {
64-
6564
plugins.push(
6665
new webpack.optimize.UglifyJsPlugin({
6766
sourceMap: true,

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"karma-sourcemap-loader": "^0.3.7",
110110
"karma-webpack": "2.0.3",
111111
"less": "2.7.2",
112-
"less-loader": "4.0.4",
113112
"license-checker": "^11.0.0",
114113
"mocha": "^3.4.2",
115114
"node-sass": "^4.5.0",

src/core/components/info.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Path extends React.Component {
1515

1616
return (
1717
<pre className="base-url">
18-
[ Base url: {host}{basePath}]
18+
[ Base URL: {host}{basePath} ]
1919
</pre>
2020
)
2121
}

src/core/components/layout-utils.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export class Select extends React.Component {
129129
value: PropTypes.any,
130130
onChange: PropTypes.func,
131131
multiple: PropTypes.bool,
132-
allowEmptyValue: PropTypes.bool
132+
allowEmptyValue: PropTypes.bool,
133+
className: PropTypes.string
133134
}
134135

135136
static defaultProps = {
@@ -142,7 +143,7 @@ export class Select extends React.Component {
142143

143144
let value
144145

145-
if (props.value !== undefined) {
146+
if (props.value) {
146147
value = props.value
147148
} else {
148149
value = props.multiple ? [""] : ""
@@ -178,7 +179,7 @@ export class Select extends React.Component {
178179
let value = this.state.value.toJS ? this.state.value.toJS() : this.state.value
179180

180181
return (
181-
<select multiple={ multiple } value={ value } onChange={ this.onChange } >
182+
<select className={this.props.className} multiple={ multiple } value={ value } onChange={ this.onChange } >
182183
{ allowEmptyValue ? <option value="">--</option> : null }
183184
{
184185
allowedValues.map(function (item, key) {

src/core/components/models.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export default class Models extends Component {
2424
return <section className={ showModels ? "models is-open" : "models"}>
2525
<h4 onClick={() => layoutActions.show("models", !showModels)}>
2626
<span>Models</span>
27-
<svg width="20" height="20">
28-
<use xlinkHref="#large-arrow" />
27+
<svg className="arrow" width="20" height="20">
28+
<use xlinkHref={showModels ? "#large-arrow-down" : "#large-arrow"} />
2929
</svg>
3030
</h4>
3131
<Collapse isOpened={showModels}>

src/core/components/schemes.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export default class Schemes extends React.Component {
1919
}
2020

2121
componentWillReceiveProps(nextProps) {
22-
if ( this.props.operationScheme && !nextProps.schemes.has(this.props.operationScheme) ) {
23-
//fire 'change' event if our selected scheme is no longer an option
22+
if ( !this.props.operationScheme || !nextProps.schemes.has(this.props.operationScheme) ) {
23+
// if we don't have a selected operationScheme or if our selected scheme is no longer an option,
24+
// then fire 'change' event and select the first scheme in the list of options
2425
this.setScheme(nextProps.schemes.first())
2526
}
2627
}

src/core/json-schema-components.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export class JsonSchema_string extends Component {
5757

5858
if ( enumValue ) {
5959
const Select = getComponent("Select")
60-
return (<Select allowedValues={ enumValue }
60+
return (<Select className={ errors.length ? "invalid" : ""}
61+
allowedValues={ enumValue }
6162
value={ value }
6263
allowEmptyValue={ !required }
6364
onChange={ this.onEnumChange }/>)
@@ -121,6 +122,7 @@ export class JsonSchema_array extends PureComponent {
121122
render() {
122123
let { getComponent, required, schema, fn } = this.props
123124

125+
let errors = schema.errors || []
124126
let itemSchema = fn.inferSchema(schema.items)
125127

126128
const JsonSchemaForm = getComponent("JsonSchemaForm")
@@ -131,19 +133,17 @@ export class JsonSchema_array extends PureComponent {
131133

132134
if ( enumValue ) {
133135
const Select = getComponent("Select")
134-
return (<Select multiple={ true }
136+
return (<Select className={ errors.length ? "invalid" : ""}
137+
multiple={ true }
135138
value={ value }
136139
allowedValues={ enumValue }
137140
allowEmptyValue={ !required }
138141
onChange={ this.onEnumChange }/>)
139142
}
140143

141-
let errors = schema.errors || []
142-
143144
return (
144145
<div>
145-
{ !value || value.count() < 1 ?
146-
(errors.length ? <span style={{ color: "red", fortWeight: "bold" }}>{ errors[0] }</span> : null) :
146+
{ !value || value.count() < 1 ? null :
147147
value.map( (item,i) => {
148148
let schema = Object.assign({}, itemSchema)
149149
if ( errors.length ) {
@@ -153,12 +153,12 @@ export class JsonSchema_array extends PureComponent {
153153
return (
154154
<div key={i} className="json-schema-form-item">
155155
<JsonSchemaForm fn={fn} getComponent={getComponent} value={item} onChange={(val) => this.onItemChange(val, i)} schema={schema} />
156-
<Button className="json-schema-form-item-remove" onClick={()=> this.removeItem(i)} > - </Button>
156+
<Button className="btn btn-sm json-schema-form-item-remove" onClick={()=> this.removeItem(i)} > - </Button>
157157
</div>
158158
)
159159
}).toArray()
160160
}
161-
<Button className="json-schema-form-item-add" onClick={this.addItem}> Add item </Button>
161+
<Button className={`btn btn-sm json-schema-form-item-add ${errors.length ? "invalid" : null}`} onClick={this.addItem}> Add item </Button>
162162
</div>
163163
)
164164
}
@@ -170,12 +170,14 @@ export class JsonSchema_boolean extends Component {
170170

171171
onEnumChange = (val) => this.props.onChange(val)
172172
render() {
173-
let { getComponent, required, value } = this.props
173+
let { getComponent, value, schema } = this.props
174+
let errors = schema.errors || []
174175
const Select = getComponent("Select")
175176

176-
return (<Select value={ String(value) }
177+
return (<Select className={ errors.length ? "invalid" : ""}
178+
value={ String(value) }
177179
allowedValues={ fromJS(["true", "false"]) }
178-
allowEmptyValue={ !required }
180+
allowEmptyValue={true}
179181
onChange={ this.onEnumChange }/>)
180182
}
181183
}

src/core/path-translator.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)