Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
253573200a | ||
|
|
024b7db81e | ||
|
|
5b1dbec9b0 | ||
|
|
64f99356a5 | ||
|
|
b3e80cc500 | ||
|
|
53ea2003c1 | ||
|
|
a037c7205b | ||
|
|
63d5f164c6 | ||
|
|
2e816e0440 |
@@ -0,0 +1,7 @@
|
||||
/.git
|
||||
/.github
|
||||
/dev-helpers
|
||||
/docs
|
||||
/src
|
||||
/swagger-ui-dist-package
|
||||
/test
|
||||
@@ -18,7 +18,7 @@ or anything that violates the specifications.
|
||||
<!--- Provide a general summary of the issue in the title above -->
|
||||
|
||||
<!---
|
||||
If you aren't sure what Swagger-UI version, see this guide: https://github.com/swagger-api/swagger-ui/blob/master/docs/version-detection.md
|
||||
If you aren't sure what Swagger-UI version, see this guide: https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/version-detection.md
|
||||
--->
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
!package.json
|
||||
!dist/swagger-ui.js
|
||||
!dist/swagger-ui.js.map
|
||||
!dist/swagger-ui-standalone-preset.js
|
||||
!dist/swagger-ui-standalone-preset.js.map
|
||||
!dist/swagger-ui.css
|
||||
!dist/swagger-ui.css.map
|
||||
!dist/oauth2-redirect.html
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ ENV OAUTH_REALM "**None**"
|
||||
ENV OAUTH_APP_NAME "**None**"
|
||||
ENV OAUTH_ADDITIONAL_PARAMS "**None**"
|
||||
ENV SWAGGER_JSON "/app/swagger.json"
|
||||
ENV PORT 80
|
||||
ENV PORT 8080
|
||||
ENV BASE_URL ""
|
||||
|
||||
RUN apk add --update nginx
|
||||
|
||||
@@ -22,7 +22,7 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20
|
||||
|
||||
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
|
||||
------------------ | ------------ | -------------------------- | -----
|
||||
3.9.0 | 2018-01-05 | 2.0, 3.0 | [tag v3.9.0](https://github.com/swagger-api/swagger-ui/tree/v3.9.0)
|
||||
3.9.1 | 2018-01-12 | 2.0, 3.0 | [tag v3.9.1](https://github.com/swagger-api/swagger-ui/tree/v3.9.1)
|
||||
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
|
||||
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)
|
||||
|
||||
Vendored
+9
-9
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+4
-1
@@ -36,7 +36,7 @@ if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
|
||||
fi
|
||||
|
||||
if [[ -f $SWAGGER_JSON ]]; then
|
||||
cp $SWAGGER_JSON $NGINX_ROOT
|
||||
cp -s $SWAGGER_JSON $NGINX_ROOT
|
||||
REL_PATH="./$(basename $SWAGGER_JSON)"
|
||||
sed -i "s|http://petstore.swagger.io/v2/swagger.json|$REL_PATH|g" $INDEX_FILE
|
||||
sed -i "s|http://example.com/api|$REL_PATH|g" $INDEX_FILE
|
||||
@@ -53,4 +53,7 @@ if [[ -n "$VALIDATOR_URL" ]]; then
|
||||
unset TMP_VU
|
||||
fi
|
||||
|
||||
# replace the PORT that nginx listens on if supplied
|
||||
if [[ -n "${PORT}" ]]; then sed -i "s|8080|${PORT}|g" /etc/nginx/nginx.conf; fi
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
|
||||
@@ -37,7 +37,7 @@ app.listen(3000)
|
||||
```
|
||||
|
||||
The module also exports `SwaggerUIBundle` and `SwaggerUIStandalonePreset`, so
|
||||
if you're in a JavaScript project that can't handle a tranditional npm module,
|
||||
if you're in a JavaScript project that can't handle a traditional npm module,
|
||||
you could do something like this:
|
||||
|
||||
```js
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "swagger-ui",
|
||||
"version": "3.9.0",
|
||||
"version": "3.9.1",
|
||||
"main": "dist/swagger-ui.js",
|
||||
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
||||
"contributors": [
|
||||
@@ -82,7 +82,7 @@
|
||||
"scroll-to-element": "^2.0.0",
|
||||
"serialize-error": "2.0.0",
|
||||
"shallowequal": "0.2.2",
|
||||
"swagger-client": "^3.4.4",
|
||||
"swagger-client": "^3.4.5",
|
||||
"url-parse": "^1.1.8",
|
||||
"whatwg-fetch": "0.11.1",
|
||||
"worker-loader": "^0.7.1",
|
||||
|
||||
@@ -8,13 +8,14 @@ export default class ModelCollapse extends Component {
|
||||
children: PropTypes.any,
|
||||
title: PropTypes.element,
|
||||
modelName: PropTypes.string,
|
||||
onToggle: PropTypes.func.isRequired
|
||||
onToggle: PropTypes.func
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
collapsedContent: "{...}",
|
||||
expanded: false,
|
||||
title: null
|
||||
title: null,
|
||||
onToggle: () => {}
|
||||
}
|
||||
|
||||
constructor(props, context) {
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class ObjectModel extends Component {
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
expanded: PropTypes.bool,
|
||||
onToggle: PropTypes.func.isRequired,
|
||||
onToggle: PropTypes.func,
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
name: PropTypes.string,
|
||||
isRef: PropTypes.bool,
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import formatXml from "xml-but-prettier"
|
||||
import lowerCase from "lodash/lowerCase"
|
||||
import { extractFileNameFromContentDispositionHeader } from "core/utils"
|
||||
|
||||
export default class ResponseBody extends React.Component {
|
||||
|
||||
@@ -70,12 +71,13 @@ export default class ResponseBody extends React.Component {
|
||||
let fileName = url.substr(url.lastIndexOf("/") + 1)
|
||||
let download = [type, fileName, href].join(":")
|
||||
|
||||
// Use filename from response header
|
||||
// Use filename from response header,
|
||||
// First check if filename is quoted (e.g. contains space), if no, fallback to not quoted check
|
||||
let disposition = headers["content-disposition"] || headers["Content-Disposition"]
|
||||
if (typeof disposition !== "undefined") {
|
||||
let responseFilename = /filename=([^;]*);?/i.exec(disposition)
|
||||
if (responseFilename !== null && responseFilename.length > 1) {
|
||||
download = responseFilename[1]
|
||||
let responseFilename = extractFileNameFromContentDispositionHeader(disposition)
|
||||
if (responseFilename !== null) {
|
||||
download = responseFilename
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -342,6 +342,17 @@ export function mapToList(map, keyNames="key", collectedKeys=Im.Map()) {
|
||||
return list
|
||||
}
|
||||
|
||||
export function extractFileNameFromContentDispositionHeader(value){
|
||||
let responseFilename = /filename="([^;]*);?"/i.exec(value)
|
||||
if (responseFilename === null) {
|
||||
responseFilename = /filename=([^;]*);?/i.exec(value)
|
||||
}
|
||||
if (responseFilename !== null && responseFilename.length > 1) {
|
||||
return responseFilename[1]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// PascalCase, aka UpperCamelCase
|
||||
export function pascalCase(str) {
|
||||
return upperFirst(camelCase(str))
|
||||
@@ -433,6 +444,7 @@ export const validateDateTime = (val) => {
|
||||
}
|
||||
|
||||
export const validateGuid = (val) => {
|
||||
val = val.toString().toLowerCase()
|
||||
if (!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}[)}]?$/.test(val)) {
|
||||
return "Value must be a Guid"
|
||||
}
|
||||
|
||||
+23
-1
@@ -18,7 +18,8 @@ import {
|
||||
getAcceptControllingResponse,
|
||||
createDeepLinkPath,
|
||||
escapeDeepLinkPath,
|
||||
sanitizeUrl
|
||||
sanitizeUrl,
|
||||
extractFileNameFromContentDispositionHeader
|
||||
} from "core/utils"
|
||||
import win from "core/window"
|
||||
|
||||
@@ -90,6 +91,26 @@ describe("utils", function() {
|
||||
|
||||
})
|
||||
|
||||
describe("extractFileNameFromContentDispositionHeader", function(){
|
||||
it("should extract quoted filename", function(){
|
||||
let cdHeader = "attachment; filename=\"file name.jpg\""
|
||||
let expectedResult = "file name.jpg"
|
||||
expect(extractFileNameFromContentDispositionHeader(cdHeader)).toEqual(expectedResult)
|
||||
})
|
||||
|
||||
it("should extract filename", function(){
|
||||
let cdHeader = "attachment; filename=filename.jpg"
|
||||
let expectedResult = "filename.jpg"
|
||||
expect(extractFileNameFromContentDispositionHeader(cdHeader)).toEqual(expectedResult)
|
||||
})
|
||||
|
||||
it("should not extract filename and return null", function(){
|
||||
let cdHeader = "attachment; no file name provided"
|
||||
let expectedResult = null
|
||||
expect(extractFileNameFromContentDispositionHeader(cdHeader)).toEqual(expectedResult)
|
||||
})
|
||||
})
|
||||
|
||||
describe("validateMaximum", function() {
|
||||
let errorMessage = "Value must be less than Maximum"
|
||||
|
||||
@@ -238,6 +259,7 @@ describe("utils", function() {
|
||||
it("doesn't return for valid guid", function() {
|
||||
expect(validateGuid("8ce4811e-cec5-4a29-891a-15d1917153c1")).toBeFalsy()
|
||||
expect(validateGuid("{8ce4811e-cec5-4a29-891a-15d1917153c1}")).toBeFalsy()
|
||||
expect(validateGuid("8CE4811E-CEC5-4A29-891A-15D1917153C1")).toBeFalsy()
|
||||
})
|
||||
|
||||
it("returns a message for invalid input'", function() {
|
||||
|
||||
Reference in New Issue
Block a user