Skip to content
Merged

v3.12.0 #4282

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bc1b1f5
Use `parameterWithMeta` to get parameter data in <ParameterRow>
shockey Mar 1, 2018
10026bc
Merge branch 'master' into master
shockey Mar 1, 2018
2303493
Prefer specPath when fetching resolved subtrees in OperationContainer
shockey Mar 1, 2018
9bd89c3
Add test for OAS3 callback rendering
shockey Mar 1, 2018
973d87e
Merge branch 'master' of github.com:swagger-api/swagger-ui
shockey Mar 1, 2018
c456871
Remove debugger statement
shockey Mar 1, 2018
5f91867
Pass base resolution URL directly to Swagger-Client subtree resolver
shockey Mar 1, 2018
dff8802
Merge branch 'master' of github.com:swagger-api/swagger-ui
shockey Mar 1, 2018
417e071
Remove accidental comment
shockey Mar 1, 2018
5bd24b1
Migrate additional options
shockey Mar 1, 2018
941327a
Merge branch 'master' of github.com:swagger-api/swagger-ui
shockey Mar 1, 2018
4e1cf67
Don't default to empty Map when getting subtree
shockey Mar 3, 2018
750ee1a
Merge branch 'master' of github.com:swagger-api/swagger-ui
shockey Mar 3, 2018
77c6272
fix(validateParam): check for ImList type before using count method
shockey Mar 3, 2018
e5fa0e7
Use `replaceState` to update `urls.primaryName`
shockey Mar 3, 2018
1172ba2
Add `fn.opsFilter` docs and internal API versioning note
shockey Mar 3, 2018
9b57b79
restrict `x-example` functionality to Swagger 2.0
shockey Mar 3, 2018
e0de3fd
polish Authorize + Close buttons
shockey Mar 3, 2018
a0e85a4
add tachyons; use it for padding the new Reset button
shockey Mar 3, 2018
066bb0e
v3.12.0
shockey Mar 3, 2018
1b63d54
rebuild dist
shockey Mar 3, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20

Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
------------------ | ------------ | -------------------------- | -----
3.11.0 | 2018-02-09 | 2.0, 3.0 | [tag v3.11.0](https://github.com/swagger-api/swagger-ui/tree/v3.11.0)
3.12.0 | 2018-03-02 | 2.0, 3.0 | [tag v3.12.0](https://github.com/swagger-api/swagger-ui/tree/v3.12.0)
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
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)
Expand Down
34 changes: 14 additions & 20 deletions dist/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui-standalone-preset.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/swagger-ui.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui.js.map

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions docs/customization/plug-points.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Plug points

Swagger-UI exposes most of its internal logic through the plugin system.

Often, it is beneficial to override the core internals to achieve custom behavior.

### Note: Semantic Versioning

Swagger-UI's internal APIs are _not_ part of our public contract, which means that they can change without the major version changing.

If your custom plugins wrap, extend, override, or consume any internal core APIs, we recommend specifying a specific minor version of Swagger-UI to use in your application, because they will _not_ change between patch versions.

If you're installing Swagger-UI via NPM, for example, you can do this by using a tilde:

```js
{
"dependencies": {
"swagger-ui": "~3.11.0"
}
}
```

### `fn.opsFilter`

When using the `filter` option, tag names will be filtered by the user-provided value. If you'd like to customize this behavior, you can override the default `opsFilter` function.

For example, you can implement a multiple-phrase filter:

```js
const MultiplePhraseFilterPlugin = function() {
return {
fn: {
opsFilter: (taggedOps, phrase) => {
const phrases = phrase.split(", ")

return taggedOps.filter((val, key) => {
return phrases.some(item => key.indexOf(item) > -1)
})
}
}
}
}
```
16 changes: 16 additions & 0 deletions docs/customization/plugin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

A plugin is a function that returns an object - more specifically, the object may contain functions and components that augment and modify Swagger-UI's functionality.

### Note: Semantic Versioning

Swagger-UI's internal APIs are _not_ part of our public contract, which means that they can change without the major version changing.

If your custom plugins wrap, extend, override, or consume any internal core APIs, we recommend specifying a specific minor version of Swagger-UI to use in your application, because they will _not_ change between patch versions.

If you're installing Swagger-UI via NPM, for example, you can do this by using a tilde:

```js
{
"dependencies": {
"swagger-ui": "~3.11.0"
}
}
```

### Format

A plugin return value may contain any of these keys, where `stateKey` is a name for a piece of state:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "3.11.0",
"version": "3.12.0",
"main": "dist/swagger-ui.js",
"repository": "git@github.com:swagger-api/swagger-ui.git",
"contributors": [
Expand Down Expand Up @@ -83,7 +83,7 @@
"scroll-to-element": "^2.0.0",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.5.0",
"swagger-client": "^3.5.1",
"url-parse": "^1.1.8",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",
Expand Down Expand Up @@ -144,6 +144,7 @@
"standard": "^10.0.2",
"standard-loader": "^6.0.1",
"style-loader": "0.18.2",
"tachyons-sass": "^4.9.2",
"url-loader": "0.5.9",
"webpack": "^2.6.1",
"webpack-bundle-size-analyzer": "^2.5.0"
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/auth/auths.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export default class Auths extends React.Component {
}).toArray()
}
<div className="auth-btn-wrapper">
<Button className="btn modal-btn auth btn-done" onClick={ this.close }>Close</Button>
{
nonOauthDefinitions.size === authorizedAuth.size ? <Button className="btn modal-btn auth" onClick={ this.logoutClick }>Logout</Button>
: <Button type="submit" className="btn modal-btn auth authorize">Authorize</Button>
}
<Button className="btn modal-btn auth btn-done" onClick={ this.close }>Close</Button>
</div>
</form>
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/parameter-row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class ParameterRow extends Component {
let value = parameter ? parameter.get("value") : ""

if( param.get("in") !== "body" ) {
if ( xExampleValue !== undefined && value === undefined ) {
if ( xExampleValue !== undefined && value === undefined && specSelectors.isSwagger2() ) {
this.onChangeWrapper(xExampleValue)
} else if ( defaultValue !== undefined && value === undefined ) {
this.onChangeWrapper(defaultValue)
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/oas3/components/request-body-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default class RequestBodyEditor extends PureComponent {

}
{ userDidModify &&
<Button className="btn" onClick={() => { this.resetValueToSample(mediaType) }}>Reset</Button>
<Button className="btn ml3" onClick={() => { this.resetValueToSample(mediaType) }}>Reset</Button>
}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export function extractFileNameFromContentDispositionHeader(value){
if (responseFilename !== null && responseFilename.length > 1) {
return responseFilename[1]
}
return null
return null
}

// PascalCase, aka UpperCamelCase
Expand Down Expand Up @@ -559,7 +559,7 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
} else if ( type === "array" ) {
let itemType

if ( !value.count() ) { return errors }
if ( !listCheck || !value.count() ) { return errors }

itemType = paramDetails.getIn(["items", "type"])

Expand Down
5 changes: 4 additions & 1 deletion src/plugins/topbar/topbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default class Topbar extends React.Component {
setSearch = (spec) => {
let search = parseSearch()
search["urls.primaryName"] = spec.name
window.location.search = serializeSearch(search)
const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}`
if(window && window.history && window.history.pushState) {
window.history.replaceState(null, "", `${newUrl}?${serializeSearch(search)}`)
}
}

setSelectedUrl = (selectedUrl) => {
Expand Down
1 change: 1 addition & 0 deletions src/style/_authorize.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
.authorize
{
padding-right: 20px;
margin-right: 10px;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.swagger-ui
{
@import '~tachyons-sass/tachyons.scss';
@import 'mixins';
@import 'variables';
@import 'colors';
Expand Down