From 73f89fc2fd44c2f3e4926eb5bf555285a6c87545 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 19 Jul 2017 20:16:53 -0500 Subject: [PATCH 01/18] Added href attribute to tags with deprecated xlinkHref attribute. --- src/core/components/auth/authorization-popup.jsx | 2 +- src/core/components/auth/authorize-btn.jsx | 2 +- src/core/components/auth/authorize-operation-btn.jsx | 2 +- src/core/components/models.jsx | 2 +- src/core/components/operations.jsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/components/auth/authorization-popup.jsx b/src/core/components/auth/authorization-popup.jsx index 887a06a5..0746bcb5 100644 --- a/src/core/components/auth/authorization-popup.jsx +++ b/src/core/components/auth/authorization-popup.jsx @@ -23,7 +23,7 @@ export default class AuthorizationPopup extends React.Component {

Available authorizations

diff --git a/src/core/components/auth/authorize-btn.jsx b/src/core/components/auth/authorize-btn.jsx index b7266bce..6106dfd6 100644 --- a/src/core/components/auth/authorize-btn.jsx +++ b/src/core/components/auth/authorize-btn.jsx @@ -25,7 +25,7 @@ export default class AuthorizeBtn extends React.Component { { showPopup && } diff --git a/src/core/components/auth/authorize-operation-btn.jsx b/src/core/components/auth/authorize-operation-btn.jsx index 2753bffe..7c2f2448 100644 --- a/src/core/components/auth/authorize-operation-btn.jsx +++ b/src/core/components/auth/authorize-operation-btn.jsx @@ -24,7 +24,7 @@ export default class AuthorizeOperationBtn extends React.Component { return ( diff --git a/src/core/components/models.jsx b/src/core/components/models.jsx index c61ae0c9..f31c6c4a 100644 --- a/src/core/components/models.jsx +++ b/src/core/components/models.jsx @@ -25,7 +25,7 @@ export default class Models extends Component {

layoutActions.show("models", !showModels)}> Models - +

diff --git a/src/core/components/operations.jsx b/src/core/components/operations.jsx index c9031651..8e1ccded 100644 --- a/src/core/components/operations.jsx +++ b/src/core/components/operations.jsx @@ -91,7 +91,7 @@ export default class Operations extends React.Component { From d95c6523ffca600ae7a4e8383989a800e9f73da0 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 24 Jul 2017 23:30:31 -0700 Subject: [PATCH 02/18] Add CONTRIBUTING.md --- CONTRIBUTING.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..8ee83573 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,54 @@ +## Contributing to Swagger-UI + +#### Environment setup + +0. Install Node.js (4 or newer) and npm (3 or newer). +1. Fork Swagger-UI, and clone your fork. +2. Run `npm install` in your Swagger-UI directory. +3. Run `npm run dev`. `localhost:3200` should open automatically. +4. You're ready to go! + +#### Branching model + +Feature branches should be prefixed with `ft/`. + +Bugfix branches should be prefixed with `bug/`. + +After the forward slash, include a short description of what you're fixing. For example: `bug/fix-everything-that-was-broken`. + +If there's an issue filed that you're addressing in your branch, include the issue number directly after the forward slash. For example: `bug/1234-fix-all-the-other-things`. + +#### Filing issues + +- **Do** include the Swagger-UI build you're using - you can find this by opening your console and checking `window.versions.swaggerUi` +- **Do** include a spec that demonstrates the issue you're experiencing. +- **Do** include screenshots, if needed. GIFs are even better! +- **Do** place code inside of a pre-formatted container by surrounding the code with triple backticks. +- **Don't** open tickets discussing issues with the Swagger/OpenAPI specification itself, or for issues with projects that use Swagger-UI. +- **Don't** open an issue without searching the issue tracker for duplicates first. + +#### Committing + +- Break your commits into logical atomic units. Well-segmented commits make it _much_ easier for others to step through your changes. +- Limit your subject (first) line to 50 characters (GitHub truncates more than 70). +- Provide a body if you'd like to explain your commit in detail. +- Separate the subject from the body with a blank line, for readability. +- Capitalize the beginning of your subject line. +- Do not end the subject line with a period. +- Use the imperative mood in your subject lines, as if you were giving the code an order in your subject line. + - This mimics what Git does for you automatically: "Merge develop", "Revert f570ffc", etc + - Simple trick... your subject line should complete this sentence: `If applied, this commit will [your subject line].` +- Don't use [magic GitHub words]() in your commits to close issues - do that in the pull request for your code instead. + +_Adapted from [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/#seven-rules)._ + +#### Making pull requests + +- **Do** summarize your changes in the PR body. If in doubt, write a bullet-point list titled `This PR does the following:`. +- **Do** include references to issues that your PR solves, and use [magic GitHub words]() to close those issues automatically when your PR is merged. +- **Do** include tests that cover new or changed functionality. +- **Do** be careful to follow our ESLint style rules. We recommend installing an ESLint plugin if you use a graphical code editor. +- **Do** make sure that tests and the linter are passing by running `npm test` locally, otherwise we can't merge your pull request. +- **Don't** include any changes to files in the `dist/` directory - we update those files only during releases. +- **Don't** mention maintainers in your original PR body - we probably would've seen it anyway, so it just increases the noise in our inboxes. Do feel free to ping maintainers if a week has passed and you've heard nothing from us. +- **Don't** open PRs for custom functionality that only serves a small subset of our users - custom functionality should be implemented outside of our codebase, via a plugin. From 09d3f5ad6c19b63a06a10a180665a4656c09fdc7 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 24 Jul 2017 23:31:54 -0700 Subject: [PATCH 03/18] Add Github link --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ee83573..10decc8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,14 +38,14 @@ If there's an issue filed that you're addressing in your branch, include the iss - Use the imperative mood in your subject lines, as if you were giving the code an order in your subject line. - This mimics what Git does for you automatically: "Merge develop", "Revert f570ffc", etc - Simple trick... your subject line should complete this sentence: `If applied, this commit will [your subject line].` -- Don't use [magic GitHub words]() in your commits to close issues - do that in the pull request for your code instead. +- Don't use [magic GitHub words](https://help.github.com/articles/closing-issues-using-keywords/) in your commits to close issues - do that in the pull request for your code instead. _Adapted from [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/#seven-rules)._ #### Making pull requests - **Do** summarize your changes in the PR body. If in doubt, write a bullet-point list titled `This PR does the following:`. -- **Do** include references to issues that your PR solves, and use [magic GitHub words]() to close those issues automatically when your PR is merged. +- **Do** include references to issues that your PR solves, and use [magic GitHub words](https://help.github.com/articles/closing-issues-using-keywords/) to close those issues automatically when your PR is merged. - **Do** include tests that cover new or changed functionality. - **Do** be careful to follow our ESLint style rules. We recommend installing an ESLint plugin if you use a graphical code editor. - **Do** make sure that tests and the linter are passing by running `npm test` locally, otherwise we can't merge your pull request. From 962464980f4b59e57956856a8a4d9a2f147b5aba Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 24 Jul 2017 23:34:28 -0700 Subject: [PATCH 04/18] Add information on version branches --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10decc8f..823392ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,9 @@ Feature branches should be prefixed with `ft/`. Bugfix branches should be prefixed with `bug/`. -After the forward slash, include a short description of what you're fixing. For example: `bug/fix-everything-that-was-broken`. +Version branches should be prefixed with `v/`. + +After the forward slash, include a short description of what you're fixing. For example: `bug/fix-everything-that-was-broken`. For versions, add the version that will be released via the branch, for example: `v/1.2.3`. If there's an issue filed that you're addressing in your branch, include the issue number directly after the forward slash. For example: `bug/1234-fix-all-the-other-things`. From 624f491510c321e96f879a273a776b4b0abffe44 Mon Sep 17 00:00:00 2001 From: shockey Date: Mon, 24 Jul 2017 23:39:20 -0700 Subject: [PATCH 05/18] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 823392ce..6f682ff7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,7 @@ ## Contributing to Swagger-UI +We love contributions from our community of users! This document explains our guidelines and workflows. Please take care to follow them, as it helps us keep things moving smoothly. + #### Environment setup 0. Install Node.js (4 or newer) and npm (3 or newer). From 403598ec7810fef928f213eae67e4a0cb846252c Mon Sep 17 00:00:00 2001 From: shockey Date: Tue, 25 Jul 2017 23:13:44 -0700 Subject: [PATCH 06/18] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f682ff7..a48d5bf3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ We love contributions from our community of users! This document explains our gu #### Environment setup 0. Install Node.js (4 or newer) and npm (3 or newer). -1. Fork Swagger-UI, and clone your fork. +1. Make a fork of Swagger-UI on GitHub, then clone your fork to your machine. 2. Run `npm install` in your Swagger-UI directory. 3. Run `npm run dev`. `localhost:3200` should open automatically. 4. You're ready to go! From 5e96821c0515158b7d1f44ab6fd28b06db0271f7 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 3 Aug 2017 17:13:38 -0700 Subject: [PATCH 07/18] Add writeOnly logic --- src/core/plugins/samples/fn.js | 45 +++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/core/plugins/samples/fn.js b/src/core/plugins/samples/fn.js index d4f46c1b..f2233554 100644 --- a/src/core/plugins/samples/fn.js +++ b/src/core/plugins/samples/fn.js @@ -9,7 +9,7 @@ const primitives = { "number": () => 0, "number_float": () => 0.0, "integer": () => 0, - "boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true + "boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true } const primitive = (schema) => { @@ -96,7 +96,7 @@ export const inferSchema = (thing) => { export const sampleXmlFromSchema = (schema, config={}) => { let objectifySchema = objectify(schema) let { type, properties, additionalProperties, items, example } = objectifySchema - let { includeReadOnly } = config + let { includeReadOnly, includeWriteOnly } = config let defaultValue = objectifySchema.default let res = {} let _attr = {} @@ -177,27 +177,32 @@ export const sampleXmlFromSchema = (schema, config={}) => { example = example || {} for (let propName in props) { - if ( !props[propName].readOnly || includeReadOnly ) { - props[propName].xml = props[propName].xml || {} + if ( props[propName].readOnly && !includeReadOnly ) { + continue + } + if ( props[propName].writeOnly && !includeWriteOnly ) { + continue + } - if (props[propName].xml.attribute) { - let enumAttrVal = Array.isArray(props[propName].enum) && props[propName].enum[0] - let attrExample = props[propName].example - let attrDefault = props[propName].default - _attr[props[propName].xml.name || propName] = attrExample!== undefined && attrExample - || example[propName] !== undefined && example[propName] || attrDefault !== undefined && attrDefault - || enumAttrVal || primitive(props[propName]) + props[propName].xml = props[propName].xml || {} + + if (props[propName].xml.attribute) { + let enumAttrVal = Array.isArray(props[propName].enum) && props[propName].enum[0] + let attrExample = props[propName].example + let attrDefault = props[propName].default + _attr[props[propName].xml.name || propName] = attrExample!== undefined && attrExample + || example[propName] !== undefined && example[propName] || attrDefault !== undefined && attrDefault + || enumAttrVal || primitive(props[propName]) + } else { + props[propName].xml.name = props[propName].xml.name || propName + props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName] + let t = sampleXmlFromSchema(props[propName]) + if (Array.isArray(t)) { + res[displayName] = res[displayName].concat(t) } else { - props[propName].xml.name = props[propName].xml.name || propName - props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName] - let t = sampleXmlFromSchema(props[propName]) - if (Array.isArray(t)) { - res[displayName] = res[displayName].concat(t) - } else { - res[displayName].push(t) - } - + res[displayName].push(t) } + } } From 37f9d5aa29c7f0eb1b4f25c6c47cf31ab03545e9 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 3 Aug 2017 17:13:58 -0700 Subject: [PATCH 08/18] Add tests --- test/core/plugins/samples/fn.js | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/test/core/plugins/samples/fn.js b/test/core/plugins/samples/fn.js index a2d01876..e5032b50 100644 --- a/test/core/plugins/samples/fn.js +++ b/test/core/plugins/samples/fn.js @@ -554,6 +554,69 @@ describe("createXMLExample", function () { expect(sut(definition, { includeReadOnly: false })).toEqual(expected) }) + it("returns object with readonly fields for parameter, with includeReadOnly", function () { + var expected = "\n\n\t0\n\tstring\n" + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + dog: { + readOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + expect(sut(definition, { includeReadOnly: true })).toEqual(expected) + }) + + it("returns object without writeonly fields for parameter", function () { + var expected = "\n\n\t0\n" + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + dog: { + writeOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + expect(sut(definition)).toEqual(expected) + }) + + it("returns object with writeonly fields for parameter, with includeWriteOnly", function () { + var expected = "\n\n\t0\n\tstring\n" + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + dog: { + writeOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + expect(sut(definition, { includeWriteOnly: true })).toEqual(expected) + }) + it("returns object with passed property as attribute", function () { var expected = "\n\n\tstring\n" var definition = { From 9af5d2dc66045ef04e832be29beef842d6cc1e83 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 3 Aug 2017 17:23:16 -0700 Subject: [PATCH 09/18] Add writeOnly support to sampleFromSchema; add tests for the same --- src/core/plugins/samples/fn.js | 10 +++- test/core/plugins/samples/fn.js | 101 +++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 4 deletions(-) diff --git a/src/core/plugins/samples/fn.js b/src/core/plugins/samples/fn.js index f2233554..a729600c 100644 --- a/src/core/plugins/samples/fn.js +++ b/src/core/plugins/samples/fn.js @@ -27,7 +27,7 @@ const primitive = (schema) => { export const sampleFromSchema = (schema, config={}) => { let { type, example, properties, additionalProperties, items } = objectify(schema) - let { includeReadOnly } = config + let { includeReadOnly, includeWriteOnly } = config if(example !== undefined) return example @@ -46,9 +46,13 @@ export const sampleFromSchema = (schema, config={}) => { let props = objectify(properties) let obj = {} for (var name in props) { - if ( !props[name].readOnly || includeReadOnly ) { - obj[name] = sampleFromSchema(props[name], { includeReadOnly: includeReadOnly }) + if ( props[name].readOnly && !includeReadOnly ) { + continue } + if ( props[name].writeOnly && !includeWriteOnly ) { + continue + } + obj[name] = sampleFromSchema(props[name], { includeReadOnly: includeReadOnly }) } if ( additionalProperties === true ) { diff --git a/test/core/plugins/samples/fn.js b/test/core/plugins/samples/fn.js index e5032b50..12ec783f 100644 --- a/test/core/plugins/samples/fn.js +++ b/test/core/plugins/samples/fn.js @@ -1,6 +1,105 @@ -import { createXMLExample } from "corePlugins/samples/fn" +import { createXMLExample, sampleFromSchema } from "corePlugins/samples/fn" import expect from "expect" +describe("sampleFromSchema", function() { + it("returns object with no readonly fields for parameter", function () { + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + readOnlyDog: { + readOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + var expected = { + id: 0 + } + + expect(sampleFromSchema(definition, { includeReadOnly: false })).toEqual(expected) + }) + + it("returns object with readonly fields for parameter, with includeReadOnly", function () { + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + readOnlyDog: { + readOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + var expected = { + id: 0, + readOnlyDog: "string" + } + + expect(sampleFromSchema(definition, { includeReadOnly: true })).toEqual(expected) + }) + + it("returns object without writeonly fields for parameter", function () { + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + writeOnlyDog: { + writeOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + var expected = { + id: 0 + } + + expect(sampleFromSchema(definition)).toEqual(expected) + }) + + it("returns object with writeonly fields for parameter, with includeWriteOnly", function () { + var definition = { + type: "object", + properties: { + id: { + type: "integer" + }, + writeOnlyDog: { + writeOnly: true, + type: "string" + } + }, + xml: { + name: "animals" + } + } + + var expected = { + id: 0, + writeOnlyDog: "string" + } + + expect(sampleFromSchema(definition, { includeWriteOnly: true })).toEqual(expected) + }) +}) describe("createXMLExample", function () { var sut = createXMLExample From 15b70b6f2deeb2543cbe3bf0f18fd77136203e03 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 3 Aug 2017 17:42:04 -0700 Subject: [PATCH 10/18] Set writeOnly flags in correct places --- src/core/components/param-body.jsx | 4 +++- src/core/components/response.jsx | 9 +++++++-- src/core/plugins/oas3/components/request-body.jsx | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/core/components/param-body.jsx b/src/core/components/param-body.jsx index e64a65cc..48373f5f 100644 --- a/src/core/components/param-body.jsx +++ b/src/core/components/param-body.jsx @@ -69,7 +69,9 @@ export default class ParamBody extends PureComponent { let { param, fn:{inferSchema} } = this.props let schema = inferSchema(param.toJS()) - return getSampleSchema(schema, xml) + return getSampleSchema(schema, xml, { + includeWriteOnly: true + }) } onChange = (value, { isEditBox, isXml }) => { diff --git a/src/core/components/response.jsx b/src/core/components/response.jsx index 95602c64..818b4337 100644 --- a/src/core/components/response.jsx +++ b/src/core/components/response.jsx @@ -83,11 +83,16 @@ export default class Response extends React.Component { if(isOAS3()) { let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"]) - sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, { includeReadOnly: true }) : null + sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, { + includeReadOnly: true + }) : null schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null } else { schema = inferSchema(response.toJS()) - sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null + sampleResponse = schema ? getSampleSchema(schema, contentType, { + includeReadOnly: true, + includeWriteOnly: true // writeOnly has no filtering effect in swagger 2.0 + }) : null } let example = getExampleComponent( sampleResponse, examples, HighlightCode ) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index cce3b9f3..2cbf491a 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -16,7 +16,9 @@ const RequestBody = ({ requestBody, getComponent, specSelectors, contentType }) const mediaTypeValue = requestBodyContent.get(contentType) - const sampleSchema = getSampleSchema(mediaTypeValue.get("schema").toJS(), contentType) + const sampleSchema = getSampleSchema(mediaTypeValue.get("schema").toJS(), contentType, { + includeWriteOnly: true + }) return
{ requestBodyDescription && From 5aa7f307bf03ee40fb8c1222fba4eb16a929ef7a Mon Sep 17 00:00:00 2001 From: Minasokoni Date: Wed, 9 Aug 2017 22:47:53 -0700 Subject: [PATCH 11/18] changed radius on input in topbar --- src/style/_topbar.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/style/_topbar.scss b/src/style/_topbar.scss index d3b76aa6..4bded694 100644 --- a/src/style/_topbar.scss +++ b/src/style/_topbar.scss @@ -43,6 +43,7 @@ margin: 0; border: 2px solid #547f00; + border-radius: 4px 0 0 4px; outline: none; } From 964d5287351234bd8821e61cea6b82a0140a18bd Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 10 Aug 2017 18:26:45 -0700 Subject: [PATCH 12/18] Replace valueSeq with entrySeq --- src/core/curlify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/curlify.js b/src/core/curlify.js index 2564ed92..328830c1 100644 --- a/src/core/curlify.js +++ b/src/core/curlify.js @@ -20,7 +20,7 @@ export default function curl( request ){ if ( request.get("body") ){ if(type === "multipart/form-data" && request.get("method") === "POST") { - for( let [ k,v ] of request.get("body").values()) { + for( let [ k,v ] of request.get("body").entrySeq()) { curlified.push( "-F" ) if (v instanceof win.File) { curlified.push( `"${k}=@${v.name};type=${v.type}"` ) From 168e2030409350463ae1ac504c6bbca59eafe9e0 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 10 Aug 2017 18:27:03 -0700 Subject: [PATCH 13/18] Use hash for body in formData tests I couldn't find any instances of body being an array when testing formData with real specs... I think this was a mistake. --- test/core/curlify.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/core/curlify.js b/test/core/curlify.js index 82ee6a8a..8084bd6e 100644 --- a/test/core/curlify.js +++ b/test/core/curlify.js @@ -132,10 +132,10 @@ describe("curlify", function() { url: "http://example.com", method: "POST", headers: { "content-type": "multipart/form-data" }, - body: [ - ["id", "123"], - ["name", "Sahar"] - ] + body: { + id: "123", + name: "Sahar" + } } let curlified = curl(Im.fromJS(req)) @@ -152,10 +152,10 @@ describe("curlify", function() { url: "http://example.com", method: "POST", headers: { "content-type": "multipart/form-data" }, - body: [ - ["id", "123"], - ["file", file] - ] + body: { + id: "123", + file + } } let curlified = curl(Im.fromJS(req)) From b464d2c9770fc89617edc21be9022c08eab8ed8f Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 10 Aug 2017 18:39:43 -0700 Subject: [PATCH 14/18] pass entire config to recursive sample calls --- src/core/plugins/samples/fn.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/plugins/samples/fn.js b/src/core/plugins/samples/fn.js index a729600c..9f166f20 100644 --- a/src/core/plugins/samples/fn.js +++ b/src/core/plugins/samples/fn.js @@ -52,14 +52,14 @@ export const sampleFromSchema = (schema, config={}) => { if ( props[name].writeOnly && !includeWriteOnly ) { continue } - obj[name] = sampleFromSchema(props[name], { includeReadOnly: includeReadOnly }) + obj[name] = sampleFromSchema(props[name], config) } if ( additionalProperties === true ) { obj.additionalProp1 = {} } else if ( additionalProperties ) { let additionalProps = objectify(additionalProperties) - let additionalPropVal = sampleFromSchema(additionalProps, { includeReadOnly: includeReadOnly }) + let additionalPropVal = sampleFromSchema(additionalProps, config) for (let i = 1; i < 4; i++) { obj["additionalProp" + i] = additionalPropVal @@ -69,7 +69,7 @@ export const sampleFromSchema = (schema, config={}) => { } if(type === "array") { - return [ sampleFromSchema(items, { includeReadOnly: includeReadOnly }) ] + return [ sampleFromSchema(items, config) ] } if(schema["enum"]) { From eb159232f91a2abcdc96cee639e03cc81a6a427c Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 10 Aug 2017 18:42:09 -0700 Subject: [PATCH 15/18] Shorten commiting section --- CONTRIBUTING.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a48d5bf3..3acb80b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,12 +36,8 @@ If there's an issue filed that you're addressing in your branch, include the iss - Break your commits into logical atomic units. Well-segmented commits make it _much_ easier for others to step through your changes. - Limit your subject (first) line to 50 characters (GitHub truncates more than 70). - Provide a body if you'd like to explain your commit in detail. -- Separate the subject from the body with a blank line, for readability. -- Capitalize the beginning of your subject line. -- Do not end the subject line with a period. -- Use the imperative mood in your subject lines, as if you were giving the code an order in your subject line. - - This mimics what Git does for you automatically: "Merge develop", "Revert f570ffc", etc - - Simple trick... your subject line should complete this sentence: `If applied, this commit will [your subject line].` +- Capitalize the beginning of your subject line, and do not end the subject line with a period. +- Your subject line should complete this sentence: `If applied, this commit will [your subject line].` - Don't use [magic GitHub words](https://help.github.com/articles/closing-issues-using-keywords/) in your commits to close issues - do that in the pull request for your code instead. _Adapted from [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/#seven-rules)._ From 1eab4b3b2046bb8949d943ff6e377709624755bd Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 10 Aug 2017 22:55:41 -0700 Subject: [PATCH 16/18] Display OAS3 parameter types --- src/core/components/parameter-row.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/components/parameter-row.jsx b/src/core/components/parameter-row.jsx index 77581242..04466a38 100644 --- a/src/core/components/parameter-row.jsx +++ b/src/core/components/parameter-row.jsx @@ -82,10 +82,11 @@ export default class ParameterRow extends Component { let schema = param.get("schema") + let type = isOAS3 && isOAS3() ? param.getIn(["schema", "type"]) : param.get("type") let isFormData = inType === "formData" let isFormDataSupported = "FormData" in win let required = param.get("required") - let itemType = param.getIn(["items", "type"]) + let itemType = param.getIn(isOAS3 && isOAS3() ? ["schema", "items", "type"] : ["items", "type"]) let parameter = specSelectors.getParameter(pathMethod, param.get("name")) let value = parameter ? parameter.get("value") : "" @@ -96,7 +97,7 @@ export default class ParameterRow extends Component { { param.get("name") } { !required ? null :  * }
-
{ param.get("type") } { itemType && `[${itemType}]` }
+
{ type } { itemType && `[${itemType}]` }
{ isOAS3 && isOAS3() && param.get("deprecated") ? "deprecated": null }
From c237f2563821bcd268d951bdeac4722c973e6b4a Mon Sep 17 00:00:00 2001 From: Owen Conti Date: Fri, 11 Aug 2017 15:55:19 -0600 Subject: [PATCH 17/18] Introduce React.Perf in all non-production builds. --- package.json | 2 +- src/core/index.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b51fcc43..ead1f7f7 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "promise-worker": "^1.1.1", "prop-types": "^15.5.10", "react": "^15.4.0", - "react-addons-perf": "0.14.8", + "react-addons-perf": "15.4.2", "react-addons-shallow-compare": "0.14.8", "react-addons-test-utils": "^15.4.0", "react-collapse": "2.3.1", diff --git a/src/core/index.js b/src/core/index.js index 3dbcede4..9d9c0ac3 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -6,6 +6,11 @@ import ApisPreset from "core/presets/apis" import * as AllPlugins from "core/plugins/all" import { parseSearch } from "core/utils" +if (process.env.NODE_ENV !== "production") { + const Perf = require("react-addons-perf") + window.Perf = Perf +} + // eslint-disable-next-line no-undef const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION, HOSTNAME, BUILD_TIME } = buildInfo From c1f37035bb5b1fbcf9152e47c7c0cd1969cebd19 Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 11 Aug 2017 16:28:10 -0700 Subject: [PATCH 18/18] Use `react` semver mask for `react-addons-perf` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ead1f7f7..5051fe22 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "promise-worker": "^1.1.1", "prop-types": "^15.5.10", "react": "^15.4.0", - "react-addons-perf": "15.4.2", + "react-addons-perf": "^15.4.0", "react-addons-shallow-compare": "0.14.8", "react-addons-test-utils": "^15.4.0", "react-collapse": "2.3.1",