Compare commits

..
33 Commits
Author SHA1 Message Date
Kyle Shockey bfe5963978 v3.0.4 2017-03-31 19:26:23 -07:00
Kyle Shockey e0e6ccc6d3 Bump swagger-client to latest 2017-03-31 19:25:17 -07:00
Kyle Shockey 965cfd349c Rebuild dist 2017-03-31 19:19:56 -07:00
shockey c46566a904 Merge pull request #2835 from shockey/ft/cleanup
Removed unused packages from dependencies
2017-03-31 18:08:40 -07:00
Kyle Shockey ed9e94f506 Fix linter problems 2017-03-31 18:05:01 -07:00
Kyle Shockey ade4dd4e68 Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/cleanup 2017-03-31 17:58:02 -07:00
Kyle Shockey a8f9f5c791 Removed unused packages from dependencies 2017-03-31 17:52:00 -07:00
Anna 02d55a096b Merge pull request #2833 from bodnia/fix-2795
fixes #2795
2017-03-31 18:36:22 +03:00
Anna Bodnia d2e20a72f0 fixes #2795 2017-03-31 18:35:52 +03:00
Anna af0088ccca Merge pull request #2831 from bodnia/fix-2796
fix badge async load
2017-03-31 11:19:46 +03:00
Anna Bodnia 879fc4ce04 fix badge async load 2017-03-31 11:19:10 +03:00
Anna 38737da9e9 Merge pull request #2829 from bodnia/fix-2827
#2827 remove online validator badge for specs hosted locally
2017-03-30 18:55:40 +03:00
Anna Bodnia 161dc57cd5 #2827 remove online validator badge for specs hosted locally 2017-03-30 18:55:16 +03:00
Anna 1df4df67c1 Merge pull request #2826 from bodnia/fix-2774
#2774 display scopes for oauth2 password flow
2017-03-30 17:49:59 +03:00
Anna Bodnia 432cd7f965 #2774 display scopes for oauth2 password flow 2017-03-30 17:49:32 +03:00
shockey b34e363ae1 Merge pull request #2823 from shockey/master
Fix dev server
2017-03-30 00:22:09 -07:00
Kyle Shockey 229bd1df9a Fix dev server 2017-03-30 00:16:17 -07:00
Anna ec46a22df5 Merge pull request #2820 from bodnia/fix-badge
fix badge display
2017-03-29 22:20:40 +03:00
Anna Bodnia 0b668ccf2a fix badge display 2017-03-29 22:20:12 +03:00
Anna c38bf2a0b1 Merge pull request #2817 from bodnia/fix-2796
#2796 disable validator (with badge) by removing it from config
2017-03-29 12:38:19 +03:00
Anna Bodnia ded299d891 #2796 disable validator (with badge) by removing it from config 2017-03-29 12:36:38 +03:00
Tony Tam 374b3613d0 Merge pull request #2812 from swagger-api/update-docker
added docker push from travis
2017-03-27 22:28:43 -07:00
Tony Tam eff72c21df added image name 2017-03-27 22:24:05 -07:00
Tony Tam 995ca2bf3d enabled docker service 2017-03-27 22:15:27 -07:00
Tony Tam a09412d712 added docker push from travis 2017-03-27 22:11:24 -07:00
shockey 7d215a9ef7 Merge pull request #2811 from shockey/ft/default-export-standalone
standalone default export
2017-03-27 20:01:18 -07:00
shockey 29ecbea269 Merge pull request #2810 from shockey/master
Version updates
2017-03-27 19:52:37 -07:00
Kyle Shockey 431b67362c Eliminate the need for the ES6 module backflips in Standalone example 2017-03-27 19:51:45 -07:00
Kyle Shockey bd0fbc60dd Merge branch 'master' of github.com:swagger-api/swagger-ui 2017-03-27 19:42:46 -07:00
Anna b8e1f1ceeb Merge pull request #2802 from bodnia/fix-auth-btn
Fix display of auth button not to depend on schemes
2017-03-27 22:58:08 +03:00
Anna Bodnia a13dc1ede1 Fix display of auth button not to depend on schemes 2017-03-27 22:57:27 +03:00
Kyle Shockey 822dda8fc8 Dist rebuild 2017-03-25 21:06:18 -07:00
shockey 85d7ec52e7 Update README.md 2017-03-25 01:04:57 -07:00
18 changed files with 251 additions and 84 deletions
+14
View File
@@ -1,11 +1,15 @@
language: node_js
node_js:
- '6.9'
services:
- docker
branches:
only:
- master
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
before_deploy: "npm run build-core"
env:
- DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
deploy:
provider: npm
email: apiteam@swagger.io
@@ -16,3 +20,13 @@ deploy:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
after_success:
- if [ $DOCKER_HUB_USERNAME ]; then
docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
docker build -t $DOCKER_IMAGE_NAME .;
if [ "$TRAVIS_TAG" != "master" && -z "$TRAVIS_TAG"]; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG;
fi;
docker push $DOCKER_IMAGE_NAME;
fi;
+1 -1
View File
@@ -15,7 +15,7 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
3.0.3 | 2017-03-19 | 2.0 | [tag v3.0.3](https://github.com/swagger-api/swagger-ui/tree/v3.0.3) |
3.0.4 | 2017-03-19 | 2.0 | [tag v3.0.4](https://github.com/swagger-api/swagger-ui/tree/v3.0.4) |
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
+95
View File
@@ -0,0 +1,95 @@
<!-- HTML for dev server -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="../public/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="../public/favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
// Build a system
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
+1 -2
View File
@@ -77,8 +77,7 @@ window.onload = function() {
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
// yay ES6 modules ↘
Array.isArray(SwaggerUIStandalonePreset) ? SwaggerUIStandalonePreset : SwaggerUIStandalonePreset.default
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
+45 -46
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAsdA;AAkoJA;AAyiCA;;;;;AAskCA;AAq7IA;AAo7FA;AA0wGA;AAgmEA;AA+9CA;AA0gDA;AA0rCA;AAm6DA;AAm4IA;;;;;;;;;;;;;;AAmtFA;AAyoIA;AAiuJA;AAglHA;AA+mGA;AAmkEA;AA42DA;AAwxDA;AA69BA;;;;;;AAixEA;AAo2FA;;;;;AA23CA;AA2qFA;AAo2CA;AAihCA;AAomDA;AAiuEA;AAkjGA;;;;;;;;;AAkpBA;AA2zIA;AAg4DA;AAywDA;;;;;;AAyzBA;AA8iHA;AAipGA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAsdA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AAq7IA;AAo7FA;AA0wGA;AAglFA;AA0jFA;AAq9CA;AA6jDA;AAgrCA;AAgtEA;AAgkIA;;;;;;;;;;;;;;AAw4GA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAm+BA;;;;;;AAmsEA;AA2zFA;;;;;AA+1CA;AA2qFA;AAo2CA;AAokCA;AAkhDA;AAwvEA;AAs+FA;;;;;;;;;AA+xBA;AA2zIA;AAg4DA;AA0vDA","sourceRoot":""}
File diff suppressed because one or more lines are too long
+8 -8
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAsoGA;AAy4HA;AA67FA;AA4mCA;AAs+BA;AAsiCA;AAm5BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAsoGA;AAy4HA;AA+7FA;AA2mCA;AAw/BA;AA2hCA;AAs5BA","sourceRoot":""}
+4 -7
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "3.0.3",
"version": "3.0.4",
"main": "dist/swagger-ui.js",
"repository": "git@github.com:swagger-api/swagger-ui.git",
"contributors": [
@@ -22,7 +22,7 @@
"dev": "npm-run-all --parallel hot-server watch open-localhost",
"watch": "webpack --config webpack-watch.config.js --watch --progress",
"open-localhost": "node -e 'require(\"open\")(\"http://localhost:3200\")'",
"hot-server": "webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dist/",
"hot-server": "webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dev-helpers/",
"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",
"deps-size": "webpack -p --config webpack.check.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
"deps-check": "npm run deps-license && npm run deps-size",
@@ -38,13 +38,11 @@
"babel-polyfill": "^6.23.0",
"brace": "0.7.0",
"btoa": "^1.1.2",
"debounce": "1.0.0",
"deep-extend": "0.4.1",
"expect": "1.20.2",
"getbase": "^2.8.2",
"immutable": "^3.x.x",
"js-yaml": "^3.5.5",
"jsonschema": "^1.1.0",
"less": "2.7.1",
"lodash": "4.17.2",
"matcher": "^0.1.2",
@@ -70,12 +68,11 @@
"reselect": "2.5.3",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.0.3",
"swagger-client": "^3.0.4",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",
"xml": "1.0.1",
"yaml-js": "^0.1.3",
"yaml-worker": "^2.1.0"
"yaml-js": "^0.1.3"
},
"devDependencies": {
"autoprefixer": "6.6.1",
+2 -3
View File
@@ -10,14 +10,13 @@ export default class Oauth2 extends React.Component {
static propTypes = {
name: PropTypes.string,
authorized: PropTypes.object,
configs: PropTypes.object,
getComponent: PropTypes.func.isRequired,
schema: PropTypes.object.isRequired,
authSelectors: PropTypes.object.isRequired,
authActions: PropTypes.object.isRequired,
errSelectors: PropTypes.object.isRequired,
errActions: PropTypes.object.isRequired,
getConfigs: PropTypes.function
getConfigs: PropTypes.any
}
constructor(props, context) {
@@ -173,7 +172,7 @@ export default class Oauth2 extends React.Component {
}
{
!isAuthorized && flow !== PASSWORD && scopes && scopes.size ? <div className="scopes">
!isAuthorized && scopes && scopes.size ? <div className="scopes">
<h2>Scopes:</h2>
{ scopes.map((description, name) => {
return (
+4 -1
View File
@@ -168,7 +168,10 @@ class ArrayModel extends Component {
let { required, schema, depth, expandDepth } = this.props
let items = schema.get("items")
return <span>
return <span className="model">
<span className="model-title">
<span className="model-title__text">{ schema.get("title") }</span>
</span>
<Collapse collapsed={ depth > expandDepth } collapsedContent="[...]">
[
<span><Model { ...this.props } schema={ items } required={ false }/></span>
+62 -4
View File
@@ -13,7 +13,7 @@ export default class OnlineValidatorBadge extends React.Component {
let { validatorUrl } = getConfigs()
this.state = {
url: specSelectors.url(),
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
}
}
@@ -23,7 +23,7 @@ export default class OnlineValidatorBadge extends React.Component {
this.setState({
url: specSelectors.url(),
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
})
}
@@ -33,14 +33,72 @@ export default class OnlineValidatorBadge extends React.Component {
if ( typeof spec === "object" && Object.keys(spec).length) return null
if (!this.state.url) {
if (!this.state.url || !this.state.validatorUrl || this.state.url.indexOf("localhost") >= 0
|| this.state.url.indexOf("127.0.0.1") >= 0) {
return null
}
return (<span style={{ float: "right"}}>
<a target="_blank" href={`${ this.state.validatorUrl }/debug?url=${ this.state.url }`}>
<img alt="Online validator badge" src={`${ this.state.validatorUrl }?url=${ this.state.url }`} />
<ValidatorImage src={`${ this.state.validatorUrl }?url=${ this.state.url }`} alt="Online validator badge"/>
</a>
</span>)
}
}
class ValidatorImage extends React.Component {
static propTypes = {
src: PropTypes.string,
alt: PropTypes.string
}
constructor(props) {
super(props)
this.state = {
loaded: false,
error: false
}
}
componentDidMount() {
const img = new Image()
img.onload = () => {
this.setState({
loaded: true
})
}
img.onerror = () => {
this.setState({
error: true
})
}
img.src = this.props.src
}
componentWillReceiveProps(nextProps) {
if (nextProps.src !== this.props.src) {
const img = new Image()
img.onload = () => {
this.setState({
loaded: true
})
}
img.onerror = () => {
this.setState({
error: true
})
}
img.src = nextProps.src
}
}
render() {
if (this.state.error) {
return <img alt={"Error"} />
} else if (!this.state.loaded) {
return <img alt= {"Loading..."} />
}
return <img src={this.props.src} alt={this.props.alt} />
}
}
+1 -1
View File
@@ -14,8 +14,8 @@ module.exports = function SwaggerUI(opts) {
spec: {},
url: "",
layout: "Layout",
validatorUrl: "https://online.swagger.io/validator",
configs: {
validatorUrl: "https://online.swagger.io/validator"
},
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.
+4 -1
View File
@@ -8,6 +8,8 @@ export const PRE_AUTHORIZE_OAUTH2 = "pre_authorize_oauth2"
export const AUTHORIZE_OAUTH2 = "authorize_oauth2"
export const VALIDATE = "validate"
const scopeSeparator = " "
export function showDefinitions(payload) {
return {
type: SHOW_AUTH_POPUP,
@@ -77,7 +79,8 @@ export const authorizePassword = ( auth ) => ( { fn, authActions, errActions } )
query: {
grant_type: "password",
username,
password
password,
scopes: encodeURIComponent(auth.scopes.join(scopeSeparator))
}
}
+1 -1
View File
@@ -14,4 +14,4 @@ let preset = [
}
]
export default preset
module.exports = preset
+1 -1
View File
@@ -79,7 +79,7 @@ export default class StandaloneLayout extends React.Component {
</div>
) : null }
{ !schemes && securityDefinitions ? (
{ (!schemes || !schemes.size) && securityDefinitions ? (
<div className="scheme-container">
<Col className="schemes wrapper" mobile={12}>
{ securityDefinitions ? (
+4 -4
View File
@@ -9,11 +9,11 @@ module.exports = require("./make-webpack-config")({
},
devtool: "eval",
entry: {
'SwaggerUIBundle': [
'swagger-ui-bundle': [
'babel-polyfill',
'./src/core/index.js'
],
'SwaggerUIStandalonePreset': [
'swagger-ui-standalone-preset': [
'./src/standalone/index.js'
]
},
@@ -27,8 +27,8 @@ module.exports = require("./make-webpack-config")({
},
devServer: {
port: 3200,
path: path.join(__dirname, 'dist'),
publicPath: "/dist",
path: path.join(__dirname, 'dev-helpers'),
publicPath: "/",
noInfo: true,
colors: true,
hot: true,