Skip to content

Commit 633fa10

Browse files
committed
# 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
2 parents a6a3aff + 2fd371b commit 633fa10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+346
-549
lines changed

.eslintrc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"parser": "babel-eslint",
3+
4+
"env": {
5+
"browser": true,
6+
"node": true,
7+
"es6": true
8+
},
9+
10+
"parserOptions": {
11+
"ecmaFeatures": {
12+
"jsx": true
13+
}
14+
},
15+
16+
"extends": ["eslint:recommended", "plugin:react/recommended"],
17+
18+
"plugins": [
19+
"react"
20+
],
21+
22+
"rules": {
23+
"semi": [2, "never"],
24+
"strict": 0,
25+
"quotes": 2,
26+
"no-unused-vars": 2,
27+
"no-multi-spaces": 1,
28+
"camelcase": 1,
29+
"no-use-before-define": [2,"nofunc"],
30+
"no-underscore-dangle": 0,
31+
"no-unused-expressions": 1,
32+
"comma-dangle": 0,
33+
"no-console": ["error", { allow: ["warn", "error"] }],
34+
"react/jsx-no-bind": 1,
35+
"react/display-name": 0
36+
}
37+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
.deps_check
44
.DS_Store
55
npm-debug.log
6+
.eslintcache

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
**This is the new version of swagger-ui, 3.x. Want to learn more? Check out our [FAQ](http://swagger.io/new-ui-faq/).**
88

9+
As a brand new version, written from the ground up, there are some known issues and unimplemented features. Check out the [Known Issues](#known-issues) section for more details.
10+
911
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
1012

1113
## Compatibility
@@ -41,10 +43,21 @@ If you just want to see your specs, open `public/index.html` in your browser dir
4143

4244
If you'd like to make modifications to the codebase, run the dev server with: `npm run dev`.
4345

44-
4546
##### Browser support
4647
Swagger UI works in the latest versions of Chrome, Safari, Firefox, Edge and IE11.
4748

49+
### Known Issues
50+
51+
To help with the migration, here are the currently known issues with 3.X. This list will update regularly, and will not include features that were not implemented in previous versions.
52+
53+
- Currently, the only configuration options available are the `url` and `spec`.
54+
- The JSON Form Editor is not implemented.
55+
- Shebang URL support for operations is missing.
56+
- Support for `collectionFormat` is partial.
57+
- l10n (translations) is not implemented.
58+
- Relative path support for external files is not implemented.
59+
60+
4861
## CORS Support
4962

5063
CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + JavaScript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.

dist/swagger-ui-bundle.js

Lines changed: 38 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
2626
"deps-license": "license-checker --production --csv --out $npm_package_config_deps_check_dir/licenses.csv && license-checker --development --csv --out $npm_package_config_deps_check_dir/licenses-dev.csv",
2727
"deps-size": "webpack -p --config webpack.check.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
2828
"deps-check": "npm run deps-license && npm run deps-size",
29-
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core"
29+
"lint": "eslint --cache --ext '.js,.jsx' src test",
30+
"lint-errors": "eslint --cache --quiet --ext '.js,.jsx' src test",
31+
"lint-fix": "eslint --cache --ext '.js,.jsx' src test --fix",
32+
"test": "npm run lint-errors && npm run just-test-in-node",
33+
"test-in-node": "npm run lint-errors && npm run just-test-in-node",
34+
"just-test": "karma start --config karma.conf.js",
35+
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components"
3036
},
3137
"dependencies": {
38+
"babel-polyfill": "^6.23.0",
3239
"brace": "0.7.0",
3340
"btoa": "^1.1.2",
3441
"debounce": "1.0.0",
@@ -46,7 +53,7 @@
4653
"react": "^15.4.0",
4754
"react-addons-perf": "0.14.8",
4855
"react-addons-shallow-compare": "0.14.8",
49-
"react-addons-test-utils": "0.14.8",
56+
"react-addons-test-utils": "^15.4.0",
5057
"react-collapse": "2.3.1",
5158
"react-dom": "^15.4.0",
5259
"react-height": "^2.0.0",
@@ -84,11 +91,19 @@
8491
"css-loader": "0.22.0",
8592
"deep-extend": "^0.4.1",
8693
"deepmerge": "^1.3.2",
94+
"enzyme": "^2.7.1",
95+
"eslint": "^2.13.1",
96+
"eslint-plugin-react": "^6.10.3",
8797
"extract-text-webpack-plugin": "0.8.2",
8898
"file-loader": "0.8.4",
8999
"html-webpack-plugin": "^2.28.0",
90100
"imports-loader": "0.6.5",
91101
"json-loader": "0.5.3",
102+
"karma": "^0.13.22",
103+
"karma-chrome-launcher": "^0.2.3",
104+
"karma-mocha": "^0.2.2",
105+
"karma-sourcemap-loader": "^0.3.7",
106+
"karma-webpack": "1.8.0",
92107
"less": "2.5.3",
93108
"less-loader": "2.2.1",
94109
"license-checker": "^8.0.4",

src/core/components/auth/authorize-btn.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class AuthorizeBtn extends React.Component {
66
}
77

88
onClick =() => {
9-
let { authActions, authSelectors, errActions} = this.props
9+
let { authActions, authSelectors } = this.props
1010
let definitions = authSelectors.definitionsToAuthorize()
1111

1212
authActions.showDefinitions(definitions)

src/core/components/auth/auths.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ export default class Auths extends React.Component {
4242
}
4343

4444
render() {
45-
let { definitions, getComponent, authSelectors, errSelectors, specSelectors } = this.props
45+
let { definitions, getComponent, authSelectors, errSelectors } = this.props
4646
const ApiKeyAuth = getComponent("apiKeyAuth")
4747
const BasicAuth = getComponent("basicAuth")
4848
const Oauth2 = getComponent("oauth2", true)
4949
const Button = getComponent("Button")
50-
const JumpToPath = getComponent("JumpToPath", true)
5150

52-
let specStr = specSelectors.specStr()
5351
let authorized = authSelectors.authorized()
5452

5553
let authorizedAuth = definitions.filter( (definition, key) => {

src/core/components/auth/oauth2.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default class Oauth2 extends React.Component {
1616
authSelectors: PropTypes.object.isRequired,
1717
authActions: PropTypes.object.isRequired,
1818
errSelectors: PropTypes.object.isRequired,
19-
errActions: PropTypes.object.isRequired
19+
errActions: PropTypes.object.isRequired,
20+
getConfigs: PropTypes.function
2021
}
2122

2223
constructor(props, context) {

src/core/components/content-type.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PropTypes } from "react"
22
import ImPropTypes from "react-immutable-proptypes"
3-
import { fromJS } from 'immutable'
3+
import { fromJS } from "immutable"
44

55
const noop = ()=>{}
66

src/core/components/errors.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { PropTypes } from "react"
2-
import Im, { List } from "immutable"
2+
import { List } from "immutable"
33
import Collapse from "react-collapse"
4-
import sortBy from "lodash/sortBy"
54

65
export default class Errors extends React.Component {
76

src/core/components/execute.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { Component, PropTypes } from "react"
2-
import { fromJS } from "immutable"
32

43
export default class Execute extends Component {
54

@@ -29,9 +28,6 @@ export default class Execute extends Component {
2928
onChangeProducesWrapper = ( val ) => this.props.specActions.changeProducesValue([this.props.path, this.props.method], val)
3029

3130
render(){
32-
let { getComponent, operation, specActions, path, method } = this.props
33-
const ContentType = getComponent( "contentType" )
34-
3531
return (
3632
<button className="btn execute opblock-control__btn" onClick={ this.onClick }>
3733
Execute

src/core/components/layout-utils.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { PropTypes } from "react"
22
import OriCollapse from "react-collapse"
33
import _Markdown from "react-remarkable"
44

5-
const noop = () => {}
6-
75
function xclass(...args) {
86
return args.filter(a => !!a).join(" ").trim()
97
}
@@ -44,12 +42,14 @@ export class Col extends React.Component {
4442
const {
4543
hide,
4644
keepContents,
47-
48-
mobile, /* we don't want these in the final component, since React now complains. So we extract them */
45+
/* we don't want these in the `rest` object that passes to the final component,
46+
since React now complains. So we extract them */
47+
/* eslint-disable no-unused-vars */
48+
mobile,
4949
tablet,
5050
desktop,
5151
large,
52-
52+
/* eslint-enable no-unused-vars */
5353
...rest
5454
} = this.props
5555

src/core/components/model.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { Component, PropTypes } from "react"
22
import ImPropTypes from "react-immutable-proptypes"
3-
import isObject from "lodash/isObject"
43
import { List } from "immutable"
54
const braceOpen = "{"
65
const braceClose = "}"
@@ -128,7 +127,6 @@ class Primitive extends Component {
128127
let format = schema.get("format")
129128
let xml = schema.get("xml")
130129
let enumArray = schema.get("enum")
131-
let description = schema.get("description")
132130
let properties = schema.filter( ( v, key) => ["enum", "type", "format", "$$ref"].indexOf(key) === -1 )
133131
let style = required ? { fontWeight: "bold" } : {}
134132
let propStyle = { color: "#999", fontStyle: "italic" }
@@ -251,9 +249,6 @@ export default class ModelComponent extends Component {
251249
}
252250

253251
render(){
254-
let { name, schema } = this.props
255-
let title = schema.get("title") || name
256-
257252
return <div className="model-box">
258253
<Model { ...this.props } depth={ 1 } expandDepth={ this.props.expandDepth || 0 }/>
259254
</div>

src/core/components/models.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ import React, { Component, PropTypes } from "react"
44
export default class Models extends Component {
55
static propTypes = {
66
getComponent: PropTypes.func,
7-
specSelectors: PropTypes.object
7+
specSelectors: PropTypes.object,
8+
layoutSelectors: PropTypes.object,
9+
layoutActions: PropTypes.object
810
}
911

1012
render(){
1113
let { specSelectors, getComponent, layoutSelectors, layoutActions } = this.props
1214
let definitions = specSelectors.definitions()
13-
let showModels = layoutSelectors.isShown('models', true)
15+
let showModels = layoutSelectors.isShown("models", true)
1416

1517
const Model = getComponent("model")
1618
const Collapse = getComponent("Collapse")
1719

1820
if (!definitions.size) return null
1921

2022
return <section className={ showModels ? "models is-open" : "models"}>
21-
<h4 onClick={() => layoutActions.show('models', !showModels)}>
23+
<h4 onClick={() => layoutActions.show("models", !showModels)}>
2224
<span>Models</span>
2325
<svg width="20" height="20">
2426
<use xlinkHref="#large-arrow" />

src/core/components/online-validator-badge.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import React from "react"
1+
import React, { PropTypes } from "react"
22

33
export default class OnlineValidatorBadge extends React.Component {
4+
static propTypes = {
5+
getComponent: PropTypes.func.isRequired,
6+
getConfigs: PropTypes.func.isRequired,
7+
specSelectors: PropTypes.object.isRequired
8+
}
9+
410
constructor(props, context) {
511
super(props, context)
612
let { specSelectors, getConfigs } = props
@@ -31,7 +37,7 @@ export default class OnlineValidatorBadge extends React.Component {
3137
return null
3238
}
3339

34-
return (<span style={{ float: "right"}}>
40+
return (<span style={{ float: "right"}}>
3541
<a target="_blank" href={`${ this.state.validatorUrl }/debug?url=${ this.state.url }`}>
3642
<img alt="Online validator badge" src={`${ this.state.validatorUrl }?url=${ this.state.url }`} />
3743
</a>

src/core/components/operation.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { PropTypes } from "react"
2-
import { Map, fromJS } from "immutable"
32
import shallowCompare from "react-addons-shallow-compare"
43
import { getList } from "core/utils"
54
import * as CustomPropTypes from "core/proptypes"
@@ -112,9 +111,7 @@ export default class Operation extends React.Component {
112111
specActions,
113112
specSelectors,
114113
authActions,
115-
authSelectors,
116-
layoutSelectors,
117-
layoutActions,
114+
authSelectors
118115
} = this.props
119116

120117
let summary = operation.get("summary")

src/core/components/operations.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { PropTypes } from "react"
2-
import {presets} from "react-motion"
32

43
export default class Operations extends React.Component {
54

@@ -33,7 +32,6 @@ export default class Operations extends React.Component {
3332

3433
const Operation = getComponent("operation")
3534
const Collapse = getComponent("Collapse")
36-
const Schemes = getComponent("schemes")
3735

3836
let showSummary = layoutSelectors.showSummary()
3937

src/core/components/overview.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default class Overview extends React.Component {
3030
{
3131
taggedOps.map( (tagObj, tag) => {
3232
let operations = tagObj.get("operations")
33-
let tagDetails = tagObj.get("tagDetails")
3433

3534
let showTagId = ["overview-tags", tag]
3635
let showTag = layoutSelectors.isShown(showTagId, true)
@@ -45,7 +44,7 @@ export default class Overview extends React.Component {
4544
<Collapse isOpened={showTag} animated>
4645
{
4746
operations.map( op => {
48-
let { path, method, operation, id } = op.toObject() // toObject is shallow
47+
let { path, method, id } = op.toObject() // toObject is shallow
4948
let showOpIdPrefix = "operations"
5049
let showOpId = id
5150
let shown = layoutSelectors.isShown([showOpIdPrefix, showOpId])

src/core/components/param-body.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component, PropTypes } from "react"
22
import shallowCompare from "react-addons-shallow-compare"
3-
import { Set, fromJS, List } from "immutable"
3+
import { fromJS, List } from "immutable"
44
import { getSampleSchema } from "core/utils"
55

66
const NOOP = Function.prototype
@@ -50,7 +50,7 @@ export default class ParamBody extends Component {
5050
}
5151

5252
updateValues = (props) => {
53-
let { specSelectors, pathMethod, param, isExecute, consumesValue="", onChangeConsumes } = props
53+
let { specSelectors, pathMethod, param, isExecute, consumesValue="" } = props
5454
let parameter = specSelectors ? specSelectors.getParameter(pathMethod, param.get("name")) : {}
5555
let isXml = /xml/i.test(consumesValue)
5656
let paramValue = isXml ? parameter.get("value_xml") : parameter.get("value")

src/core/components/parameters.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component, PropTypes } from "react"
22
import ImPropTypes from "react-immutable-proptypes"
3-
import Im, { fromJS } from "immutable"
3+
import Im from "immutable"
44

55
// More readable, just iterate over maps, only
66
const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn)
@@ -87,7 +87,7 @@ export default class Parameters extends Component {
8787
</thead>
8888
<tbody>
8989
{
90-
eachMap(parameters, (parameter, k) => (
90+
eachMap(parameters, (parameter) => (
9191
<ParameterRow fn={ fn }
9292
getComponent={ getComponent }
9393
param={ parameter }

src/core/components/response.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PropTypes } from "react"
2-
import { fromJS } from 'immutable'
2+
import { fromJS } from "immutable"
33
import { getSampleSchema } from "core/utils"
44

55
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {

0 commit comments

Comments
 (0)