Merge branch 'master' into fix-model-markdown
This commit is contained in:
38
dist/swagger-ui-bundle.js
vendored
38
dist/swagger-ui-bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-bundle.js.map
vendored
2
dist/swagger-ui-bundle.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA2TA;;;;;;AAoIA;AAi7FA;AAmtCA;AAi0IA;AA0oJA;AAgiGA;AA0/FA;AAqkFA;AAqjFA;AAk9CA;AA+jDA;AAwrCA;AA0gFA;;;;;AA+zBA;AAsyJA;;;;;;;;;;;;;;AA64EA;AA4mIA;AAquJA;AA2qHA;AA2mGA;AAiiEA;AAq4DA;AAg3DA;AA8NA;;;;;;AAw8FA;AA07FA;;;;;AAi8CA;AAgsFA;AAs2CA;AA+kCA;AAg8CA;AAg/EA;AAu/BA;AAk0FA;;;;;;;;;AAomDA;AA2zIA;AAu7FA;AAmrFA;AA20EA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA2TA;;;;;;AAoIA;AAi7FA;AAmtCA;AAi0IA;AAioJA;AAswFA;AAisGA;AA0lFA;AA4nFA;AA+9CA;AA+gDA;AAwrCA;AA60EA;;;;;AA2oCA;AAsyJA;;;;;;;;;;;;;;AA64EA;AA4mIA;AAquJA;AA2qHA;AA2mGA;AAiiEA;AAq4DA;AAg3DA;AA8NA;;;;;;AAw8FA;AA07FA;;;;;AAi8CA;AAgsFA;AAs2CA;AAilCA;AA+7CA;AAk/EA;AAi7BA;AAg4FA;;;;;;;;;AA+mDA;AA2zIA;AAu7FA;AAmrFA;AAu0EA","sourceRoot":""}
|
||||||
10
dist/swagger-ui.js
vendored
10
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui.js.map
vendored
2
dist/swagger-ui.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA4yCA;AAoyHA;AAmyHA;AAukGA;AA+9BA;AA2jCA;AA0iCA;AAy4BA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAizCA;AAoyHA;AAmyHA;AAukGA;AA+9BA;AA8jCA;AAyiCA;AA44BA","sourceRoot":""}
|
||||||
@@ -19,7 +19,7 @@ export default class Curl extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<h4>Curl</h4>
|
<h4>Curl</h4>
|
||||||
<div className="copy-paste">
|
<div className="copy-paste">
|
||||||
<textarea onFocus={this.handleFocus} className="curl" style={{ whiteSpace: "normal" }} value={curl}></textarea>
|
<textarea onFocus={this.handleFocus} readOnly="true" className="curl" style={{ whiteSpace: "normal" }} value={curl}></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ class Model extends Component {
|
|||||||
switch(type) {
|
switch(type) {
|
||||||
case "object":
|
case "object":
|
||||||
return <ObjectModel className="object" { ...this.props } schema={ modelSchema }
|
return <ObjectModel className="object" { ...this.props } schema={ modelSchema }
|
||||||
name={ modelName || name }
|
name={ name || modelName }
|
||||||
isRef={ isRef!== undefined ? isRef : !!$$ref }/>
|
isRef={ isRef!== undefined ? isRef : !!$$ref }/>
|
||||||
case "array":
|
case "array":
|
||||||
return <ArrayModel className="array" { ...this.props } schema={ modelSchema } required={ required } />
|
return <ArrayModel className="array" { ...this.props } schema={ modelSchema } required={ required } />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
|
|||||||
let exampleValue
|
let exampleValue
|
||||||
try {
|
try {
|
||||||
exampleValue = example && example.toJS ? example.toJS() : example
|
exampleValue = example && example.toJS ? example.toJS() : example
|
||||||
exampleValue = JSON.stringify(exampleValue)
|
exampleValue = JSON.stringify(exampleValue, null, 2)
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
exampleValue = String(example)
|
exampleValue = String(example)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import win from "./window"
|
||||||
|
|
||||||
export default function curl( request ){
|
export default function curl( request ){
|
||||||
let curlified = []
|
let curlified = []
|
||||||
let type = ""
|
let type = ""
|
||||||
@@ -18,11 +20,13 @@ export default function curl( request ){
|
|||||||
if ( request.get("body") ){
|
if ( request.get("body") ){
|
||||||
|
|
||||||
if(type === "multipart/form-data" && request.get("method") === "POST") {
|
if(type === "multipart/form-data" && request.get("method") === "POST") {
|
||||||
let formDataBody = request.get("body").split("&")
|
for( let [ k,v ] of request.get("body").values()) {
|
||||||
|
|
||||||
for(var data in formDataBody) {
|
|
||||||
curlified.push( "-F" )
|
curlified.push( "-F" )
|
||||||
curlified.push(formDataBody[data])
|
if (v instanceof win.File) {
|
||||||
|
curlified.push( `"${k}=@${v.name};type=${v.type}"` )
|
||||||
|
} else {
|
||||||
|
curlified.push( `"${k}=${v}"` )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
curlified.push( "-d" )
|
curlified.push( "-d" )
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import _memoize from "lodash/memoize"
|
|||||||
import some from "lodash/some"
|
import some from "lodash/some"
|
||||||
import eq from "lodash/eq"
|
import eq from "lodash/eq"
|
||||||
import { memoizedSampleFromSchema, memoizedCreateXMLExample } from "core/plugins/samples/fn"
|
import { memoizedSampleFromSchema, memoizedCreateXMLExample } from "core/plugins/samples/fn"
|
||||||
|
import win from "./window"
|
||||||
|
|
||||||
const DEFAULT_REPONSE_KEY = "default"
|
const DEFAULT_REPONSE_KEY = "default"
|
||||||
|
|
||||||
@@ -34,6 +35,9 @@ export function fromJSOrdered (js) {
|
|||||||
if(isImmutable(js))
|
if(isImmutable(js))
|
||||||
return js // Can't do much here
|
return js // Can't do much here
|
||||||
|
|
||||||
|
if (js instanceof win.File)
|
||||||
|
return js
|
||||||
|
|
||||||
return !isObject(js) ? js :
|
return !isObject(js) ? js :
|
||||||
Array.isArray(js) ?
|
Array.isArray(js) ?
|
||||||
Im.Seq(js).map(fromJSOrdered).toList() :
|
Im.Seq(js).map(fromJSOrdered).toList() :
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ function makeWindow() {
|
|||||||
location: {},
|
location: {},
|
||||||
history: {},
|
history: {},
|
||||||
open: () => {},
|
open: () => {},
|
||||||
close: () => {}
|
close: () => {},
|
||||||
|
File: function() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof window === "undefined") {
|
if(typeof window === "undefined") {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import expect from "expect"
|
import expect from "expect"
|
||||||
import Im from "immutable"
|
import Im from "immutable"
|
||||||
import curl from "core/curlify"
|
import curl from "core/curlify"
|
||||||
|
import win from "core/window"
|
||||||
|
|
||||||
describe("curlify", function() {
|
describe("curlify", function() {
|
||||||
|
|
||||||
@@ -131,12 +132,35 @@ describe("curlify", function() {
|
|||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "multipart/form-data" },
|
headers: { "content-type": "multipart/form-data" },
|
||||||
body: "id=123&name=Sahar"
|
body: [
|
||||||
|
["id", "123"],
|
||||||
|
["name", "Sahar"]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
let curlified = curl(Im.fromJS(req))
|
let curlified = curl(Im.fromJS(req))
|
||||||
|
|
||||||
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F id=123 -F name=Sahar")
|
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F \"id=123\" -F \"name=Sahar\"")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should print a curl with formData and file", function() {
|
||||||
|
var file = new win.File()
|
||||||
|
file.name = "file.txt"
|
||||||
|
file.type = "text/plain"
|
||||||
|
|
||||||
|
var req = {
|
||||||
|
url: "http://example.com",
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "multipart/form-data" },
|
||||||
|
body: [
|
||||||
|
["id", "123"],
|
||||||
|
["file", file]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
let curlified = curl(Im.fromJS(req))
|
||||||
|
|
||||||
|
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F \"id=123\" -F \"file=@file.txt;type=text/plain\"")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl post statement from an object", function() {
|
it("prints a curl post statement from an object", function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user