Merge branch 'master' into bug/3555-multipart-curl
This commit is contained in:
66
.github/issue_template.md
vendored
66
.github/issue_template.md
vendored
@@ -1,3 +1,63 @@
|
|||||||
When reporting an issue, please provide the following details:
|
<!---
|
||||||
- swagger-ui version
|
Thanks for filing an issue 😄 ! Before you submit, please read the following:
|
||||||
- a swagger file reproducing the issue
|
|
||||||
|
Search open/closed issues before submitting since someone might have asked the same thing before!
|
||||||
|
|
||||||
|
Issues on GitHub are only related to problems of Swagger-UI itself. We'll try to offer support
|
||||||
|
here for your use case, but we can't offer help with projects that use Swagger-UI indirectly,
|
||||||
|
like Springfox or swagger-node.
|
||||||
|
|
||||||
|
Likewise, we can't accept features or bugs in the Swagger/OpenAPI specifications themselves,
|
||||||
|
or anything that violates the specifications.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--- Provide a general summary of the issue in the title above -->
|
||||||
|
|
||||||
|
|
||||||
|
| Q | A
|
||||||
|
| ------------------------------- | -------
|
||||||
|
| Bug or feature request? |
|
||||||
|
| Which Swagger/OpenAPI version? |
|
||||||
|
| Which Swagger-UI version? |
|
||||||
|
| How did you install Swagger-UI? |
|
||||||
|
| Which broswer & version? |
|
||||||
|
| Which operating system? |
|
||||||
|
|
||||||
|
|
||||||
|
### Demonstration API definition
|
||||||
|
<!--- If you're describing a bug, please provide an API definition that reproduces your problem -->
|
||||||
|
<!--- If you have link to a demo repo please link that! -->
|
||||||
|
|
||||||
|
<!--- If your spec is large, please put it into a Gist (https://gist.github.com) instead of pasting it here. -->
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
your: "API definition goes here"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration (browser query string, constructor, config.yaml)
|
||||||
|
<!--- If describing a bug, tell us what your configuration looks like -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"your": { "constructorConfig": "here" }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`?yourQueryStringConfig=here`
|
||||||
|
|
||||||
|
### Expected Behavior
|
||||||
|
<!--- If you're describing a bug, tell us what should happen -->
|
||||||
|
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||||
|
|
||||||
|
### Current Behavior
|
||||||
|
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||||
|
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||||
|
|
||||||
|
### Possible Solution
|
||||||
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
|
<!--- or ideas how to implement the addition or change -->
|
||||||
|
|
||||||
|
### Context
|
||||||
|
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||||
|
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||||
|
|||||||
@@ -69,7 +69,10 @@ export default class BaseLayout extends React.Component {
|
|||||||
<div className="scheme-container">
|
<div className="scheme-container">
|
||||||
<Col className="schemes wrapper" mobile={12}>
|
<Col className="schemes wrapper" mobile={12}>
|
||||||
{ schemes && schemes.size ? (
|
{ schemes && schemes.size ? (
|
||||||
<Schemes schemes={ schemes } specActions={ specActions } />
|
<Schemes
|
||||||
|
currentScheme={specSelectors.operationScheme()}
|
||||||
|
schemes={ schemes }
|
||||||
|
specActions={ specActions } />
|
||||||
) : null }
|
) : null }
|
||||||
|
|
||||||
{ securityDefinitions ? (
|
{ securityDefinitions ? (
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ export default class Operation extends PureComponent {
|
|||||||
path={ path }
|
path={ path }
|
||||||
method={ method }
|
method={ method }
|
||||||
specActions={ specActions }
|
specActions={ specActions }
|
||||||
operationScheme={ operationScheme } />
|
currentScheme={ operationScheme } />
|
||||||
</div> : null
|
</div> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ export default class Schemes extends React.Component {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
specActions: PropTypes.object.isRequired,
|
specActions: PropTypes.object.isRequired,
|
||||||
schemes: PropTypes.object.isRequired,
|
schemes: PropTypes.object.isRequired,
|
||||||
|
currentScheme: PropTypes.string.isRequired,
|
||||||
path: PropTypes.string,
|
path: PropTypes.string,
|
||||||
method: PropTypes.string,
|
method: PropTypes.string,
|
||||||
operationScheme: PropTypes.string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
@@ -19,8 +19,8 @@ export default class Schemes extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if ( !this.props.operationScheme || !nextProps.schemes.has(this.props.operationScheme) ) {
|
if ( !this.props.currentScheme || !nextProps.schemes.includes(this.props.currentScheme) ) {
|
||||||
// if we don't have a selected operationScheme or if our selected scheme is no longer an option,
|
// if we don't have a selected currentScheme or if our selected scheme is no longer an option,
|
||||||
// then fire 'change' event and select the first scheme in the list of options
|
// then fire 'change' event and select the first scheme in the list of options
|
||||||
this.setScheme(nextProps.schemes.first())
|
this.setScheme(nextProps.schemes.first())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,35 +7,66 @@ import { fromJS } from "immutable"
|
|||||||
import Schemes from "components/schemes"
|
import Schemes from "components/schemes"
|
||||||
|
|
||||||
describe("<Schemes/>", function(){
|
describe("<Schemes/>", function(){
|
||||||
it("calls props.specActions.setScheme() when no operationScheme is selected", function(){
|
it("calls props.specActions.setScheme() when no currentScheme is selected", function(){
|
||||||
|
|
||||||
|
let setSchemeSpy = createSpy()
|
||||||
|
|
||||||
// Given
|
// Given
|
||||||
let props = {
|
let props = {
|
||||||
specActions: {
|
specActions: {
|
||||||
setScheme: createSpy()
|
setScheme: setSchemeSpy
|
||||||
},
|
},
|
||||||
schemes: fromJS([
|
schemes: fromJS([
|
||||||
"http",
|
"http",
|
||||||
"https"
|
"https"
|
||||||
]),
|
]),
|
||||||
operationScheme: undefined,
|
currentScheme: undefined,
|
||||||
path: "/test",
|
path: "/test",
|
||||||
method: "get"
|
method: "get"
|
||||||
}
|
}
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let wrapper = shallow(<Schemes {...props}/>)
|
let wrapper = shallow(<Schemes {...props}/>)
|
||||||
|
|
||||||
// Then operationScheme should default to first scheme in options list
|
// Then currentScheme should default to first scheme in options list
|
||||||
expect(props.specActions.setScheme).toHaveBeenCalledWith("http", "/test" , "get")
|
expect(props.specActions.setScheme).toHaveBeenCalledWith("http", "/test" , "get")
|
||||||
|
|
||||||
// When the operationScheme is no longer in the list of options
|
// When the currentScheme is no longer in the list of options
|
||||||
props.schemes = fromJS([
|
props.schemes = fromJS([
|
||||||
"https"
|
"https"
|
||||||
])
|
])
|
||||||
wrapper.setProps(props)
|
wrapper.setProps(props)
|
||||||
|
|
||||||
// Then operationScheme should default to first scheme in options list
|
// Then currentScheme should default to first scheme in options list, again
|
||||||
expect(props.specActions.setScheme).toHaveBeenCalledWith("https", "/test", "get")
|
expect(props.specActions.setScheme).toHaveBeenCalledWith("https", "/test", "get")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("doesn't call props.specActions.setScheme() when schemes hasn't changed", function(){
|
||||||
|
|
||||||
|
let setSchemeSpy = createSpy()
|
||||||
|
|
||||||
|
// Given
|
||||||
|
let props = {
|
||||||
|
specActions: {
|
||||||
|
setScheme: setSchemeSpy
|
||||||
|
},
|
||||||
|
schemes: fromJS([
|
||||||
|
"http",
|
||||||
|
"https"
|
||||||
|
]),
|
||||||
|
currentScheme: "https"
|
||||||
|
}
|
||||||
|
|
||||||
|
// When
|
||||||
|
let wrapper = shallow(<Schemes {...props}/>)
|
||||||
|
|
||||||
|
// Should be called initially, to set the global state
|
||||||
|
expect(setSchemeSpy.calls.length).toEqual(1)
|
||||||
|
|
||||||
|
// After an update
|
||||||
|
wrapper.instance().componentWillReceiveProps(props)
|
||||||
|
|
||||||
|
// Should not be called again, since `currentScheme` is in schemes
|
||||||
|
expect(setSchemeSpy.calls.length).toEqual(1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user