Merge branch 'operationId'
# Conflicts: # src/core/components/operation.jsx
This commit is contained in:
16
README.md
16
README.md
@@ -15,7 +15,8 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
|
|||||||
|
|
||||||
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
||||||
------------------ | ------------ | -------------------------- | ----- | ------
|
------------------ | ------------ | -------------------------- | ----- | ------
|
||||||
3.0.12 | 2017-03-19 | 2.0 | [tag v3.0.12](https://github.com/swagger-api/swagger-ui/tree/v3.0.12) |
|
3.0.13 | 2017-06-02 | 2.0 | [tag
|
||||||
|
v3.0.13](https://github.com/swagger-api/swagger-ui/tree/v3.0.13) |
|
||||||
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.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) |
|
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) |
|
||||||
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
||||||
@@ -41,7 +42,9 @@ Will start nginx with swagger-ui on port 80.
|
|||||||
|
|
||||||
If you just want to see your specs, open `dist/index.html` in your browser directly from your filesystem.
|
If you just want to see your specs, open `dist/index.html` in your browser directly from your filesystem.
|
||||||
|
|
||||||
If you'd like to make modifications to the codebase, run the dev server with: `npm run dev`.
|
If you'd like to make modifications to the codebase, run the dev server with: `npm run dev`. A development server will open on `3200`.
|
||||||
|
|
||||||
|
If you'd like to rebuild the `/dist` folder with your codebase changes, run `npm run build`.
|
||||||
|
|
||||||
##### Browser support
|
##### Browser support
|
||||||
Swagger UI works in the latest versions of Chrome, Safari, Firefox, Edge and IE11.
|
Swagger UI works in the latest versions of Chrome, Safari, Firefox, Edge and IE11.
|
||||||
@@ -81,11 +84,11 @@ default `client_id` and `client_secret`, `realm`, an application name `appName`,
|
|||||||
|
|
||||||
Config Name | Description
|
Config Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
client_id | Default clientId. MUST be a string
|
client_id | Default clientId. MUST be a string
|
||||||
client_secret | Default clientSecret. MUST be a string
|
client_secret | Default clientSecret. MUST be a string
|
||||||
realm | realm query parameter (for oauth1) added to `authorizationUrl` and `tokenUrl` . MUST be a string
|
realm | realm query parameter (for oauth1) added to `authorizationUrl` and `tokenUrl` . MUST be a string
|
||||||
appName | application name, displayed in authorization popup. MUST be a string
|
appName | application name, displayed in authorization popup. MUST be a string
|
||||||
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
|
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
|
||||||
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
|
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -117,6 +120,7 @@ operationsSorter | Apply a sort to the operation list of each API. It can be 'al
|
|||||||
configUrl | Configs URL
|
configUrl | Configs URL
|
||||||
parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable
|
parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable
|
||||||
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
|
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
|
||||||
|
docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'.
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|
||||||
@@ -136,7 +140,7 @@ let preset = [
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Configs plugin
|
#### Configs plugin
|
||||||
Configs plugin allows to fetch external configs instead of passing them to `SwaggerUIBundle`. Fetched configs support two formats: JSON or yaml. The plugin is enabled by default.
|
Configs plugin allows to fetch external configs instead of passing them to `SwaggerUIBundle`. Fetched configs support two formats: JSON or yaml. The plugin is enabled by default.
|
||||||
There are three options of passing config:
|
There are three options of passing config:
|
||||||
- add a query parameter `config` with URL to a server where the configs are hosted. For ex. http://petstore.swagger.io/?config=http://localhost:3001/config.yaml
|
- add a query parameter `config` with URL to a server where the configs are hosted. For ex. http://petstore.swagger.io/?config=http://localhost:3001/config.yaml
|
||||||
- add a config `configUrl` with URL to SwaggerUIBundle
|
- add a config `configUrl` with URL to SwaggerUIBundle
|
||||||
|
|||||||
96
dist/swagger-ui-bundle.js
vendored
96
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;;;;;;;;;;;;;;;;;;;;;;;;;;AAseA;AAkoJA;AAwiCA;AAo9GA;AAw5HA;AAkvGA;AAy7EA;AAoqDA;AAm/CA;AA6jDA;AAk/CA;;;;;AAw2CA;AAmwJA;;;;;;;;;;;;;;AA8sEA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AA45EA;AAu/FA;;;;;;AA04FA;AAk7FA;;;;;AAy/CA;AA2qFA;AAw2CA;AA6kCA;AA68CA;AA+wEA;AA47FA;;;;;;;;;AA48BA;AA2zIA;AAk4DA;AA8mDA;;;;;;AA+9BA;AA8iHA;AAipGA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAyTA;;;;;;AAoIA;AAi7FA;AAmtCA;AAi0IA;AA0oJA;AAgwFA;AAyrGA;AA0lFA;AA4nFA;AA+9CA;AA+gDA;AAwrCA;AA60EA;;;;;AA6oCA;AAsyJA;;;;;;;;;;;;;;AA64EA;AA4mIA;AAquJA;AA2qHA;AA2mGA;AAiiEA;AAq4DA;AAg3DA;AAoPA;;;;;;AAk7FA;AA07FA;;;;;AAi8CA;AAgsFA;AAs2CA;AAglCA;AAu9CA;AAy8EA;AAsiCA;AA+yFA;;;;;;;;;AAgkDA;AA2zIA;AAu7FA;AAmrFA;AAu0EA","sourceRoot":""}
|
||||||
20
dist/swagger-ui-standalone-preset.js
vendored
20
dist/swagger-ui-standalone-preset.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-standalone-preset.js.map
vendored
2
dist/swagger-ui-standalone-preset.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA+PA;AAyiGA;AAwxFA;;;;;;AA0bA;AAkvFA;AAu+CA;AAo+CA;AAgrCA;AAgyEA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA8QA;AAmvGA;AAuxFA;;;;;;AAocA;AAkvFA;AAu+CA;AAo+CA;AAgrCA;AAuyEA","sourceRoot":""}
|
||||||
2
dist/swagger-ui.css
vendored
2
dist/swagger-ui.css
vendored
File diff suppressed because one or more lines are too long
14
dist/swagger-ui.js
vendored
14
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;;;;;;AA0yCA;AAoyHA;AAgyHA;AAykGA;AA48BA;AAokCA;AA8iCA;AAs6BA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA0yCA;AAoyHA;AAmyHA;AAykGA;AA+9BA;AA6iCA;AAojCA;AAu5BA","sourceRoot":""}
|
||||||
7033
package-lock.json
generated
Normal file
7033
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger-ui",
|
"name": "swagger-ui",
|
||||||
"version": "3.0.12",
|
"version": "3.0.13",
|
||||||
"main": "dist/swagger-ui.js",
|
"main": "dist/swagger-ui.js",
|
||||||
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"build-core": "webpack --config webpack-dist.config.js --colors",
|
"build-core": "webpack --config webpack-dist.config.js --colors",
|
||||||
"build-standalone": "webpack --config webpack-dist-standalone.config.js --colors",
|
"build-standalone": "webpack --config webpack-dist-standalone.config.js --colors",
|
||||||
"predev": "npm install",
|
"predev": "npm install",
|
||||||
"dev": "npm-run-all --parallel hot-server watch open-localhost",
|
"dev": "npm-run-all --parallel hot-server open-localhost",
|
||||||
"watch": "webpack --config webpack-watch.config.js --watch --progress",
|
"watch": "webpack --config webpack-watch.config.js --watch --progress",
|
||||||
"open-localhost": "node -e 'require(\"open\")(\"http://localhost:3200\")'",
|
"open-localhost": "node -e 'require(\"open\")(\"http://localhost:3200\")'",
|
||||||
"hot-server": "webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dev-helpers/",
|
"hot-server": "webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dev-helpers/",
|
||||||
@@ -67,9 +67,10 @@
|
|||||||
"redux-immutable": "3.0.8",
|
"redux-immutable": "3.0.8",
|
||||||
"redux-logger": "*",
|
"redux-logger": "*",
|
||||||
"reselect": "2.5.3",
|
"reselect": "2.5.3",
|
||||||
|
"sanitize-html": "^1.14.1",
|
||||||
"serialize-error": "2.0.0",
|
"serialize-error": "2.0.0",
|
||||||
"shallowequal": "0.2.2",
|
"shallowequal": "0.2.2",
|
||||||
"swagger-client": "~3.0.12",
|
"swagger-client": "~3.0.13",
|
||||||
"url-parse": "^1.1.8",
|
"url-parse": "^1.1.8",
|
||||||
"whatwg-fetch": "0.11.1",
|
"whatwg-fetch": "0.11.1",
|
||||||
"worker-loader": "^0.7.1",
|
"worker-loader": "^0.7.1",
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ export default class ApiKeyAuth extends React.Component {
|
|||||||
<h4>Api key authorization<JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
<h4>Api key authorization<JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
||||||
{ value && <h6>Authorized</h6>}
|
{ value && <h6>Authorized</h6>}
|
||||||
<Row>
|
<Row>
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
|
<Markdown source={ schema.get("description") } />
|
||||||
source={ schema.get("description") } />
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<p>Name: <code>{ schema.get("name") }</code></p>
|
<p>Name: <code>{ schema.get("name") }</code></p>
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ export default class BasicAuth extends React.Component {
|
|||||||
<h4>Basic authorization<JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
<h4>Basic authorization<JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
||||||
{ username && <h6>Authorized</h6> }
|
{ username && <h6>Authorized</h6> }
|
||||||
<Row>
|
<Row>
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
|
<Markdown source={ schema.get("description") } />
|
||||||
source={ schema.get("description") } />
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<label>Username:</label>
|
<label>Username:</label>
|
||||||
|
|||||||
@@ -102,8 +102,7 @@ export default class Oauth2 extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<h4>OAuth2.0 <JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
<h4>OAuth2.0 <JumpToPath path={[ "securityDefinitions", name ]} /></h4>
|
||||||
{ !this.state.appName ? null : <h5>Application: { this.state.appName } </h5> }
|
{ !this.state.appName ? null : <h5>Application: { this.state.appName } </h5> }
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
|
<Markdown source={ schema.get("description") } />
|
||||||
source={ schema.get("description") } />
|
|
||||||
|
|
||||||
{ isAuthorized && <h6>Authorized</h6> }
|
{ isAuthorized && <h6>Authorized</h6> }
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default class Info extends React.Component {
|
|||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<div className="description">
|
<div className="description">
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}} source={ description } />
|
<Markdown source={ description } />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import React, { PropTypes } from "react"
|
import React, { PropTypes } from "react"
|
||||||
import OriCollapse from "react-collapse"
|
import OriCollapse from "react-collapse"
|
||||||
import _Markdown from "react-remarkable"
|
|
||||||
|
|
||||||
function xclass(...args) {
|
function xclass(...args) {
|
||||||
return args.filter(a => !!a).join(" ").trim()
|
return args.filter(a => !!a).join(" ").trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Markdown = _Markdown
|
|
||||||
|
|
||||||
export class Container extends React.Component {
|
export class Container extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
let { fullscreen, full, ...rest } = this.props
|
let { fullscreen, full, ...rest } = this.props
|
||||||
@@ -73,7 +70,7 @@ export class Col extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let classes = xclass(rest.className, "clear", ...classesAr)
|
let classes = xclass(rest.className, ...classesAr)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section {...rest} style={{display: hide ? "none": null}} className={classes}/>
|
<section {...rest} style={{display: hide ? "none": null}} className={classes}/>
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export default class Operation extends React.Component {
|
|||||||
|
|
||||||
allowTryItOut: PropTypes.bool,
|
allowTryItOut: PropTypes.bool,
|
||||||
|
|
||||||
|
displayOperationId: PropTypes.bool,
|
||||||
|
|
||||||
response: PropTypes.object,
|
response: PropTypes.object,
|
||||||
request: PropTypes.object,
|
request: PropTypes.object,
|
||||||
|
|
||||||
@@ -27,13 +29,15 @@ export default class Operation extends React.Component {
|
|||||||
specSelectors: PropTypes.object.isRequired,
|
specSelectors: PropTypes.object.isRequired,
|
||||||
layoutActions: PropTypes.object.isRequired,
|
layoutActions: PropTypes.object.isRequired,
|
||||||
layoutSelectors: PropTypes.object.isRequired,
|
layoutSelectors: PropTypes.object.isRequired,
|
||||||
fn: PropTypes.object.isRequired
|
fn: PropTypes.object.isRequired,
|
||||||
|
getConfigs: PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
showSummary: true,
|
showSummary: true,
|
||||||
response: null,
|
response: null,
|
||||||
allowTryItOut: true,
|
allowTryItOut: true,
|
||||||
|
displayOperationId: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
@@ -76,8 +80,10 @@ export default class Operation extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isShown =() => {
|
isShown =() => {
|
||||||
let { layoutSelectors, isShownKey } = this.props
|
let { layoutSelectors, isShownKey, getConfigs } = this.props
|
||||||
return layoutSelectors.isShown(isShownKey, false ) // Here is where we set the default
|
let { docExpansion } = getConfigs()
|
||||||
|
|
||||||
|
return layoutSelectors.isShown(isShownKey, docExpansion === "full" ) // Here is where we set the default
|
||||||
}
|
}
|
||||||
|
|
||||||
onTryoutClick =() => {
|
onTryoutClick =() => {
|
||||||
@@ -105,6 +111,7 @@ export default class Operation extends React.Component {
|
|||||||
response,
|
response,
|
||||||
request,
|
request,
|
||||||
allowTryItOut,
|
allowTryItOut,
|
||||||
|
displayOperationId,
|
||||||
|
|
||||||
fn,
|
fn,
|
||||||
getComponent,
|
getComponent,
|
||||||
@@ -123,7 +130,7 @@ export default class Operation extends React.Component {
|
|||||||
let produces = operation.get("produces")
|
let produces = operation.get("produces")
|
||||||
let schemes = operation.get("schemes")
|
let schemes = operation.get("schemes")
|
||||||
let parameters = getList(operation, ["parameters"])
|
let parameters = getList(operation, ["parameters"])
|
||||||
let operationId = operation.get("operationId")
|
let operationId = operation.get("__originalOperationId")
|
||||||
|
|
||||||
const Responses = getComponent("responses")
|
const Responses = getComponent("responses")
|
||||||
const Parameters = getComponent( "parameters" )
|
const Parameters = getComponent( "parameters" )
|
||||||
@@ -149,7 +156,6 @@ export default class Operation extends React.Component {
|
|||||||
<div className={deprecated ? "opblock opblock-deprecated" : shown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`} id={isShownKey} >
|
<div className={deprecated ? "opblock opblock-deprecated" : shown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`} id={isShownKey} >
|
||||||
<div className={`opblock-summary opblock-summary-${method}`} onClick={this.toggleShown} >
|
<div className={`opblock-summary opblock-summary-${method}`} onClick={this.toggleShown} >
|
||||||
<span className="opblock-summary-method">{method.toUpperCase()}</span>
|
<span className="opblock-summary-method">{method.toUpperCase()}</span>
|
||||||
|
|
||||||
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
|
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
|
||||||
<span>{path}</span>
|
<span>{path}</span>
|
||||||
<JumpToPath path={jumpToKey} />
|
<JumpToPath path={jumpToKey} />
|
||||||
@@ -160,7 +166,9 @@ export default class Operation extends React.Component {
|
|||||||
{ summary }
|
{ summary }
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{ operationId ? <span className="opblock-summary-operation-id">{operationId}</span> : null }
|
|
||||||
|
{ displayOperationId && operationId ? <span className="opblock-summary-path">{operationId}</span> : null }
|
||||||
|
|
||||||
{
|
{
|
||||||
(!security || !security.count()) ? null :
|
(!security || !security.count()) ? null :
|
||||||
<AuthorizeOperationBtn authActions={ authActions }
|
<AuthorizeOperationBtn authActions={ authActions }
|
||||||
@@ -175,7 +183,7 @@ export default class Operation extends React.Component {
|
|||||||
{ description &&
|
{ description &&
|
||||||
<div className="opblock-description-wrapper">
|
<div className="opblock-description-wrapper">
|
||||||
<div className="opblock-description">
|
<div className="opblock-description">
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}} source={ description } />
|
<Markdown source={ description } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ export default class Operations extends React.Component {
|
|||||||
layoutActions: PropTypes.object.isRequired,
|
layoutActions: PropTypes.object.isRequired,
|
||||||
authActions: PropTypes.object.isRequired,
|
authActions: PropTypes.object.isRequired,
|
||||||
authSelectors: PropTypes.object.isRequired,
|
authSelectors: PropTypes.object.isRequired,
|
||||||
|
displayOperationId: PropTypes.bool,
|
||||||
|
getConfigs: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
displayOperationId: false
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -25,6 +27,8 @@ export default class Operations extends React.Component {
|
|||||||
layoutActions,
|
layoutActions,
|
||||||
authActions,
|
authActions,
|
||||||
authSelectors,
|
authSelectors,
|
||||||
|
displayOperationId,
|
||||||
|
getConfigs,
|
||||||
fn
|
fn
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
@@ -34,6 +38,8 @@ export default class Operations extends React.Component {
|
|||||||
const Collapse = getComponent("Collapse")
|
const Collapse = getComponent("Collapse")
|
||||||
|
|
||||||
let showSummary = layoutSelectors.showSummary()
|
let showSummary = layoutSelectors.showSummary()
|
||||||
|
let { docExpansion } = getConfigs()
|
||||||
|
displayOperationId = getConfigs().displayOperationId
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -43,7 +49,7 @@ export default class Operations extends React.Component {
|
|||||||
let tagDescription = tagObj.getIn(["tagDetails", "description"], null)
|
let tagDescription = tagObj.getIn(["tagDetails", "description"], null)
|
||||||
|
|
||||||
let isShownKey = ["operations-tag", tag]
|
let isShownKey = ["operations-tag", tag]
|
||||||
let showTag = layoutSelectors.isShown(isShownKey, true)
|
let showTag = layoutSelectors.isShown(isShownKey, docExpansion === "full" || docExpansion === "list")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={showTag ? "opblock-tag-section is-open" : "opblock-tag-section"} key={"operation-" + tag}>
|
<div className={showTag ? "opblock-tag-section is-open" : "opblock-tag-section"} key={"operation-" + tag}>
|
||||||
@@ -87,6 +93,8 @@ export default class Operations extends React.Component {
|
|||||||
request={ request }
|
request={ request }
|
||||||
allowTryItOut={allowTryItOut}
|
allowTryItOut={allowTryItOut}
|
||||||
|
|
||||||
|
displayOperationId={displayOperationId}
|
||||||
|
|
||||||
specActions={ specActions }
|
specActions={ specActions }
|
||||||
specSelectors={ specSelectors }
|
specSelectors={ specSelectors }
|
||||||
|
|
||||||
@@ -98,6 +106,7 @@ export default class Operations extends React.Component {
|
|||||||
|
|
||||||
getComponent={ getComponent }
|
getComponent={ getComponent }
|
||||||
fn={fn}
|
fn={fn}
|
||||||
|
getConfigs={ getConfigs }
|
||||||
/>
|
/>
|
||||||
}).toArray()
|
}).toArray()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ export default class ParameterRow extends Component {
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td className="col parameters-col_description">
|
<td className="col parameters-col_description">
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
|
<Markdown source={ param.get("description") }/>
|
||||||
source={ param.get("description") }/>
|
|
||||||
{(isFormData && !isFormDataSupported) && <div>Error: your browser does not support FormData</div>}
|
{(isFormData && !isFormDataSupported) && <div>Error: your browser does not support FormData</div>}
|
||||||
|
|
||||||
{ bodyParam || !isExecute ? null
|
{ bodyParam || !isExecute ? null
|
||||||
|
|||||||
6
src/core/components/providers/README.md
Normal file
6
src/core/components/providers/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Providers
|
||||||
|
|
||||||
|
Providers are generic bridges to third-party components. They provide two benefits:
|
||||||
|
|
||||||
|
1. ability for plugins to override third-party components, because providers are loaded through `getComponent`
|
||||||
|
2. allows us to avoid painting ourselves into a corner with a third-party component
|
||||||
17
src/core/components/providers/markdown.jsx
Normal file
17
src/core/components/providers/markdown.jsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import React, { PropTypes } from "react"
|
||||||
|
import Remarkable from "react-remarkable"
|
||||||
|
import sanitize from "sanitize-html"
|
||||||
|
|
||||||
|
function Markdown({ source }) {
|
||||||
|
const sanitized = sanitize(source)
|
||||||
|
return <Remarkable
|
||||||
|
options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
|
||||||
|
source={sanitized}
|
||||||
|
></Remarkable>
|
||||||
|
}
|
||||||
|
|
||||||
|
Markdown.propTypes = {
|
||||||
|
source: PropTypes.string.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Markdown
|
||||||
@@ -76,7 +76,7 @@ export default class Response extends React.Component {
|
|||||||
<td className="col response-col_description">
|
<td className="col response-col_description">
|
||||||
|
|
||||||
<div className="response-col_description__inner">
|
<div className="response-col_description__inner">
|
||||||
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}} source={ response.get( "description" ) } />
|
<Markdown source={ response.get( "description" ) } />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ example ? (
|
{ example ? (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { parseSeach, filterConfigs } from "core/utils"
|
|||||||
|
|
||||||
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
||||||
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
|
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
|
||||||
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro" ]
|
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" ]
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
|
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
|
||||||
@@ -24,9 +24,11 @@ module.exports = function SwaggerUI(opts) {
|
|||||||
spec: {},
|
spec: {},
|
||||||
url: "",
|
url: "",
|
||||||
layout: "BaseLayout",
|
layout: "BaseLayout",
|
||||||
|
docExpansion: "list",
|
||||||
validatorUrl: "https://online.swagger.io/validator",
|
validatorUrl: "https://online.swagger.io/validator",
|
||||||
configs: {},
|
configs: {},
|
||||||
custom: {},
|
custom: {},
|
||||||
|
displayOperationId: false,
|
||||||
|
|
||||||
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.
|
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.
|
||||||
// Instead, we can compile the first plugin ( it can be a collection of plugins ), then batch the rest.
|
// Instead, we can compile the first plugin ( it can be a collection of plugins ), then batch the rest.
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ export const specResolved = createSelector(
|
|||||||
// Default Spec ( as an object )
|
// Default Spec ( as an object )
|
||||||
export const spec = state => {
|
export const spec = state => {
|
||||||
let res = specResolved(state)
|
let res = specResolved(state)
|
||||||
if(res.count() < 1)
|
|
||||||
res = specJson(state)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ import Model from "core/components/model"
|
|||||||
import Models from "core/components/models"
|
import Models from "core/components/models"
|
||||||
import TryItOutButton from "core/components/try-it-out-button"
|
import TryItOutButton from "core/components/try-it-out-button"
|
||||||
|
|
||||||
|
import Markdown from "core/components/providers/markdown"
|
||||||
|
|
||||||
import BaseLayout from "core/components/layouts/base"
|
import BaseLayout from "core/components/layouts/base"
|
||||||
|
|
||||||
import * as LayoutUtils from "core/components/layout-utils"
|
import * as LayoutUtils from "core/components/layout-utils"
|
||||||
@@ -89,6 +91,7 @@ export default function() {
|
|||||||
model: Model,
|
model: Model,
|
||||||
models: Models,
|
models: Models,
|
||||||
TryItOutButton,
|
TryItOutButton,
|
||||||
|
Markdown,
|
||||||
BaseLayout
|
BaseLayout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
&.execute
|
&.execute
|
||||||
{
|
{
|
||||||
animation: pulse 2s infinite;
|
animation: swagger-ui-pulse 2s infinite;
|
||||||
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #4990e2;
|
border-color: #4990e2;
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes pulse
|
@keyframes swagger-ui-pulse
|
||||||
{
|
{
|
||||||
0%
|
0%
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,13 +13,18 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p
|
p, li, table
|
||||||
{
|
{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
@include text_body();
|
@include text_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5
|
||||||
|
{
|
||||||
|
@include text_body();
|
||||||
|
}
|
||||||
|
|
||||||
code
|
code
|
||||||
{
|
{
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ module.exports = require("./make-webpack-config")({
|
|||||||
devtool: "eval",
|
devtool: "eval",
|
||||||
entry: {
|
entry: {
|
||||||
'swagger-ui-bundle': [
|
'swagger-ui-bundle': [
|
||||||
|
'webpack/hot/dev-server',
|
||||||
'babel-polyfill',
|
'babel-polyfill',
|
||||||
'./src/core/index.js'
|
'./src/core/index.js',
|
||||||
],
|
],
|
||||||
'swagger-ui-standalone-preset': [
|
'swagger-ui-standalone-preset': [
|
||||||
'./src/standalone/index.js'
|
'webpack/hot/dev-server',
|
||||||
|
'./src/standalone/index.js',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
|||||||
Reference in New Issue
Block a user