ESLint fixes
This commit is contained in:
@@ -79,14 +79,15 @@ export default class Response extends React.Component {
|
|||||||
const ContentType = getComponent("contentType")
|
const ContentType = getComponent("contentType")
|
||||||
|
|
||||||
var sampleResponse
|
var sampleResponse
|
||||||
|
var schema
|
||||||
|
|
||||||
if(isOAS3()) {
|
if(isOAS3()) {
|
||||||
let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"])
|
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
|
||||||
var schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
|
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
|
||||||
} else {
|
} else {
|
||||||
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
|
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
|
||||||
var schema = inferSchema(response.toJS())
|
schema = inferSchema(response.toJS())
|
||||||
}
|
}
|
||||||
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
|
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
export default ({ version }) => {
|
const VersionStamp = ({ version }) => {
|
||||||
return <small><pre className="version"> { version } </pre></small>
|
return <small><pre className="version"> { version } </pre></small>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VersionStamp.propTypes = {
|
||||||
|
version: PropTypes.string.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
|
export default VersionStamp
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
export default (props) => {
|
const Callbacks = (props) => {
|
||||||
let { callbacks, getComponent } = props
|
let { callbacks, getComponent } = props
|
||||||
const Markdown = getComponent("Markdown")
|
// const Markdown = getComponent("Markdown")
|
||||||
const Operation = getComponent("operation", true)
|
const Operation = getComponent("operation", true)
|
||||||
|
|
||||||
if(!callbacks) {
|
if(!callbacks) {
|
||||||
@@ -10,10 +11,10 @@ export default (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let callbackElements = callbacks.map((callback, callbackName) => {
|
let callbackElements = callbacks.map((callback, callbackName) => {
|
||||||
return <div>
|
return <div key={callbackName}>
|
||||||
<h2>{callbackName}</h2>
|
<h2>{callbackName}</h2>
|
||||||
{ callback.map((pathItem, pathItemName) => {
|
{ callback.map((pathItem, pathItemName) => {
|
||||||
return <div>
|
return <div key={pathItemName}>
|
||||||
{ pathItem.map((operation, method) => {
|
{ pathItem.map((operation, method) => {
|
||||||
return <Operation
|
return <Operation
|
||||||
operation={operation}
|
operation={operation}
|
||||||
@@ -38,3 +39,11 @@ export default (props) => {
|
|||||||
{callbackElements}
|
{callbackElements}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Callbacks.propTypes = {
|
||||||
|
getComponent: PropTypes.function.isRequired,
|
||||||
|
callbacks: PropTypes.array.isRequired
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Callbacks
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import React, { Component } from "react"
|
import React, { Component } from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
import ImPropTypes from "react-immutable-proptypes"
|
||||||
|
|
||||||
export default class OperationLink extends Component {
|
class OperationLink extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { link, name } = this.props
|
const { link, name } = this.props
|
||||||
|
|
||||||
@@ -26,3 +28,10 @@ function padString(n, string) {
|
|||||||
.map((line, i) => i > 0 ? Array(n + 1).join(" ") + line : line)
|
.map((line, i) => i > 0 ? Array(n + 1).join(" ") + line : line)
|
||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OperationLink.propTypes = {
|
||||||
|
link: ImPropTypes.orderedMap.isRequired,
|
||||||
|
name: PropTypes.String
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OperationLink
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
import ImPropTypes from "react-immutable-proptypes"
|
||||||
import { OrderedMap } from "immutable"
|
import { OrderedMap } from "immutable"
|
||||||
import { getSampleSchema } from "core/utils"
|
import { getSampleSchema } from "core/utils"
|
||||||
|
|
||||||
|
|
||||||
export default ({ requestBody, getComponent, specSelectors, contentType }) => {
|
const RequestBody = ({ requestBody, getComponent, specSelectors, contentType }) => {
|
||||||
const Markdown = getComponent("Markdown")
|
const Markdown = getComponent("Markdown")
|
||||||
const ModelExample = getComponent("modelExample")
|
const ModelExample = getComponent("modelExample")
|
||||||
const HighlightCode = getComponent("highlightCode")
|
const HighlightCode = getComponent("highlightCode")
|
||||||
@@ -29,3 +31,12 @@ export default ({ requestBody, getComponent, specSelectors, contentType }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RequestBody.propTypes = {
|
||||||
|
requestBody: ImPropTypes.orderedMap.isRequired,
|
||||||
|
getComponent: PropTypes.function.isRequired,
|
||||||
|
specSelectors: PropTypes.object.isRequired,
|
||||||
|
contentType: PropTypes.string.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RequestBody
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { Component, PropTypes } from "react"
|
import React, { Component } from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
import { OAS3ComponentWrapFactory } from "../helpers"
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
import { Model } from "core/components/model"
|
import { Model } from "core/components/model"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from "react"
|
|
||||||
import { OAS3ComponentWrapFactory } from "../helpers"
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
|
||||||
// We're disabling the Online Validator Badge until the online validator
|
// We're disabling the Online Validator Badge until the online validator
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import React, { Component, PropTypes } from "react"
|
import React, { Component } from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
import Im, { Map } from "immutable"
|
import Im, { Map } from "immutable"
|
||||||
import ImPropTypes from "react-immutable-proptypes"
|
import ImPropTypes from "react-immutable-proptypes"
|
||||||
import { OAS3ComponentWrapFactory } from "../helpers"
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
|
||||||
const mapRequestBody = (iterable, fn) => iterable.entries().filter(Im.Map.isMap).map((val) => {
|
|
||||||
return fn(val.get(0), val.get(1))
|
|
||||||
})
|
|
||||||
|
|
||||||
// More readable, just iterate over maps, only
|
// More readable, just iterate over maps, only
|
||||||
const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn)
|
const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from "react"
|
|
||||||
import { OAS3ComponentWrapFactory } from "../helpers"
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
|
||||||
export default OAS3ComponentWrapFactory(() => {
|
export default OAS3ComponentWrapFactory(() => {
|
||||||
|
|||||||
@@ -49,8 +49,10 @@ export const spec = state => {
|
|||||||
export const isOAS3 = createSelector(
|
export const isOAS3 = createSelector(
|
||||||
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
|
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
|
||||||
// in the OAS3 plugin, and to ensure that the function is always available.
|
// in the OAS3 plugin, and to ensure that the function is always available.
|
||||||
|
// It's not perfect, but our hybrid (core+plugin code) implementation for OAS3
|
||||||
|
// needs this. //KS
|
||||||
spec,
|
spec,
|
||||||
spec => false
|
() => false
|
||||||
)
|
)
|
||||||
|
|
||||||
export const info = createSelector(
|
export const info = createSelector(
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
env:
|
env:
|
||||||
mocha: true
|
mocha: true
|
||||||
|
rules:
|
||||||
|
"react/prop-types": 1 # bah humbug
|
||||||
|
"no-unused-vars": 1 # unused vars in tests can be useful for indicating a full signature
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ describe("bound system", function(){
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('wrapSelectors', () => {
|
describe("wrapSelectors", () => {
|
||||||
it("should wrap a selector and provide a reference to the original", function(){
|
it("should wrap a selector and provide a reference to the original", function(){
|
||||||
|
|
||||||
// Given
|
// Given
|
||||||
@@ -427,7 +427,7 @@ describe("bound system", function(){
|
|||||||
wrapSelectors: {
|
wrapSelectors: {
|
||||||
wow: (ori, system) => (dogeState) => {
|
wow: (ori, system) => (dogeState) => {
|
||||||
// Then
|
// Then
|
||||||
expect(dogeState.toJS().abc).toEqual('123')
|
expect(dogeState.toJS().abc).toEqual("123")
|
||||||
done()
|
done()
|
||||||
return ori() + " wrapper"
|
return ori() + " wrapper"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user