Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f50bbec
improve: error message when rendering XML example (via #5253)
alanyst Apr 10, 2019
1dd87ce
fix: refuse to render non-string Markdown field values (via #5295)
shockey Apr 10, 2019
0c04c1c
housekeeping: allow overriding `swagger-ui-react` version` (via #5300)
shockey Apr 13, 2019
4152241
release: v3.22.0
swaggerhub-bot Apr 13, 2019
7e27714
housekeeping: force release-it to base version bumps on package manif…
shockey Apr 13, 2019
c38bf85
release: v3.22.1
swaggerhub-bot Apr 13, 2019
58d48f7
improvement: OAS3 $ref friendly-name regex in model.jsx (via #5334)
May 2, 2019
96c444e
improvement: relax schema description styling so Markdown can be effe…
May 16, 2019
5d25a0b
improvement: add `isShown` check to <ModelCollapse />'s prop `expande…
May 16, 2019
5628ff0
security: CVE-2018-20834 (via #5368)
shockey May 22, 2019
54c045f
release: v3.22.2
swaggerhub-bot May 22, 2019
57402ec
release: v3.22.3
swaggerhub-bot Jun 8, 2019
6a384ce
Update README.md
JonathanParrilla Jun 17, 2019
adb5a5b
Update README.md
JonathanParrilla Jun 17, 2019
22247db
Update README.md
JonathanParrilla Jun 17, 2019
04236f9
Update README.md
JonathanParrilla Jun 17, 2019
fbf501b
Update README.md
JonathanParrilla Jun 17, 2019
d3de58a
Update README.md
JonathanParrilla Jun 17, 2019
f7c1329
Update README.md
JonathanParrilla Jun 17, 2019
332ddae
Merge pull request #5407 from swagger-api/badgetest
JonathanParrilla Jun 17, 2019
23d7260
feat: Multiple Examples for OpenAPI 3 Parameters, Request Bodies, and…
shockey Jun 29, 2019
97b9c3e
release: v3.23.0
swaggerhub-bot Jun 29, 2019
60eb7e2
housekeeping add configuration for Lock Threads bot (via #5437)
shockey Jul 1, 2019
9ea7fd9
housekeeping: use double newline in lock message (via #5438)
shockey Jul 1, 2019
daf680c
housekeeping: silence lock bot for initial wave of actions (#5439)
shockey Jul 2, 2019
17ba2c6
housekeeping: refactor color variable names and values (via #5420)
Rody-Kirwan Jul 3, 2019
21bb452
housekeeping: address inconsistently truncated JS asset responses wit…
shockey Jul 8, 2019
9f10ab1
housekeeping: cypress standalone failures (via #5446)
shockey Jul 8, 2019
835d135
housekeeping(deps-dev): bump open from 0.0.5 to 6.0.0 (via #5449)
dependabot[bot] Jul 9, 2019
9935ea3
housekeeping: upgrade to babel@7 (via #5450)
shockey Jul 10, 2019
88204da
housekeeping: upgrade to webpack@4 (via #5454)
shockey Jul 11, 2019
7479253
housekeeping: migrate to release-it v11 (via #5335)
webpro Jul 12, 2019
eaa1f4a
bug: enum Select crashes when selecting the empty value (via #5463)
shockey Jul 13, 2019
9749a47
fix: Swagger 2.0 `Response.examples` (via #5464)
shockey Jul 13, 2019
a9493a2
fix: Swagger 2.0 `Response.examples`, again (via #5465)
shockey Jul 13, 2019
60397d6
release: v3.23.1
swaggerhub-bot Jul 13, 2019
47b992f
housekeeping: fail React flavor release if a step fails (via #5466)
shockey Jul 13, 2019
d542f98
housekeeping(flavor-react): point babel to root `.babelrc` (via #5467)
shockey Jul 19, 2019
be5e057
housekeeping: npm audit resolutions (via #5457)
shockey Jul 19, 2019
8822a72
Change Swagger-UI -> Swagger UI in docs (#5479)
hkosova Jul 19, 2019
f73260b
housekeeping: configure Renovate (via #5481)
renovate[bot] Jul 19, 2019
09e24e4
housekeeping(deps): [email protected] (via #5483)
renovate[bot] Jul 19, 2019
e435122
Allow this to run in a non-root enviroment
ctron Apr 2, 2019
f53e611
Merge pull request #5476 from ctron/feature/non_root_1
JonathanParrilla Jul 29, 2019
e895fb5
fix: use `null` as a notSetValue for examplesForMediaType (via #5503)
shockey Jul 30, 2019
39f8ceb
fix: empty ModelExample rendering in a Response w/o `content` (via #…
shockey Jul 30, 2019
7c1f9ce
release: v3.23.2
swaggerhub-bot Jul 30, 2019
4cab9e4
fix: move `@babel/runtime-corejs2` to production dependencies (via #5…
shockey Jul 30, 2019
fb47aa2
release: v3.23.3
swaggerhub-bot Jul 30, 2019
5346512
housekeeping(dev-deps): babel [email protected] (via #5487)
renovate[bot] Jul 30, 2019
97260cf
housekeeping: more `npm audit` resolutions (via #5509)
shockey Jul 30, 2019
2af696d
housekeeping: `@kyleshockey/js-yaml` -> `js-yaml` (via #5511)
shockey Jul 31, 2019
c2058b9
housekeeping: create `.github/SECURITY.md` (via #5514)
shockey Aug 2, 2019
877ee38
housekeeping: non-breaking dependency updates (via #5515)
shockey Aug 2, 2019
551007f
release: v3.23.4
swaggerhub-bot Aug 3, 2019
1b0efbe
Grammar syntax correction (#5512)
ryan-stephen Aug 6, 2019
c27a613
fix: remove problematic Markdown optimization (via #5520)
shockey Aug 7, 2019
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
73 changes: 34 additions & 39 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,51 +1,46 @@
{
"presets": [
"es2015",
"react",
"stage-0"
[
"@babel/env",
{
"targets": {
"browsers": [
/* benefit of C/S/FF/Edge only? */
"> 1%",
"last 2 versions",
"Firefox ESR",
"not dead",
]
},
"useBuiltIns": "entry",
"corejs": "2"
}
],
"@babel/preset-react"
],
"plugins": [
"transform-runtime",
"babel-plugin-transform-es2015-constants",
["@babel/plugin-transform-runtime", {
"corejs": "2"
}],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
["transform-react-remove-prop-types", {
"additionalLibraries": ["react-immutable-proptypes"]
}],
[
"module-alias",
[
{
"expose": "root",
"src": "."
},
{
"expose": "components",
"src": "src/core/components"
},
{
"expose": "containers",
"src": "src/core/containers"
},
{
"expose": "core",
"src": "src/core"
},
{
"expose": "plugins",
"src": "src/plugins"
},
{
"expose": "img",
"src": "src/img"
},
{
"expose": "corePlugins",
"src": "src/core/plugins"
},
{
"expose": "less",
"src": "src/less"
"babel-plugin-module-resolver",
{
"alias": {
"root": ".",
"components": "./src/core/components",
"containers": "./src/core/containers",
"core": "./src/core",
"plugins": "./src/plugins",
"img": "./src/img",
"corePlugins": "./src/core/plugins",
"less": "./src/less",
}
]
}
]
]
}
15 changes: 15 additions & 0 deletions .github/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
daysUntilLock: 365
skipCreatedBefore: 2017-03-29 # initial release of Swagger UI 3.0.0
exemptLabels: []
lockLabel: "locked-by: lock-bot"
setLockReason: false
only: issues
lockComment: false
# lockComment: |
# Locking due to inactivity.

# This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

# If you think you're experiencing something similar to what you've found here: please [open a new issue](https://github.com/swagger-api/swagger-ui/issues/new/choose), follow the template, and reference this issue in your report.

# Thanks!
5 changes: 5 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
semi: false
trailingComma: es5
endOfLine: lf
requirePragma: true
insertPragma: true
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ COPY ./dist/* /usr/share/nginx/html/
COPY ./docker/run.sh /usr/share/nginx/
COPY ./docker/configurator /usr/share/nginx/configurator

RUN chmod +x /usr/share/nginx/run.sh
RUN chmod +x /usr/share/nginx/run.sh && \
chmod -R a+rw /usr/share/nginx && \
chmod -R a+rw /etc/nginx && \
chmod -R a+rw /var && \
chmod -R a+rw /var/run

EXPOSE 8080

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# <img src="https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SWU-logo-clr.png" height="80">

[![NPM version](https://badge.fury.io/js/swagger-ui.svg)](http://badge.fury.io/js/swagger-ui)
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/badge/icon?subject=jenkins%20build)](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/)

**👉🏼 Want to score an easy open-source contribution?** Check out our [Good first issue](https://github.com/swagger-api/swagger-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%22) label.

Expand Down
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

If you believe you've found an exploitable security issue in Swagger UI,
**please don't create a public issue**.


## Supported versions

This is the list of versions of `swagger-ui` which are
currently being supported with security updates.

| Version | Supported | Notes |
| -------- | ------------------ | ---------------------- |
| 3.x | :white_check_mark: | |
| 2.x | :x: | End-of-life as of 2017 |

## Reporting a vulnerability

To report a vulnerability please send an email with the details to [[email protected]](mailto:[email protected]).

We'll acknowledge receipt of your report ASAP, and set expectations on how we plan to handle it.
85 changes: 63 additions & 22 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.

14 changes: 11 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.

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

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.

4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Swagger-UI
# Swagger UI

Welcome to the Swagger-UI documentation!
Welcome to the Swagger UI documentation!

A table of contents can be found at `SUMMARY.md`.
2 changes: 1 addition & 1 deletion docs/book.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"title": "Swagger-UI"
"title": "Swagger UI"
}
4 changes: 2 additions & 2 deletions docs/customization/custom-layout.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Creating a custom layout

**Layouts** are a special type of component that Swagger-UI uses as the root component for the entire application. You can define custom layouts in order to have high-level control over what ends up on the page.
**Layouts** are a special type of component that Swagger UI uses as the root component for the entire application. You can define custom layouts in order to have high-level control over what ends up on the page.

By default, Swagger-UI uses `BaseLayout`, which is built into the application. You can specify a different layout to be used by passing the layout's name as the `layout` parameter to Swagger-UI. Be sure to provide your custom layout as a component to Swagger-UI.
By default, Swagger UI uses `BaseLayout`, which is built into the application. You can specify a different layout to be used by passing the layout's name as the `layout` parameter to Swagger UI. Be sure to provide your custom layout as a component to Swagger UI.

<br>

Expand Down
14 changes: 7 additions & 7 deletions docs/customization/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Prior art

Swagger-UI leans heavily on concepts and patterns found in React and Redux.
Swagger UI leans heavily on concepts and patterns found in React and Redux.

If you aren't already familiar, here's some suggested reading:

Expand All @@ -17,7 +17,7 @@ In the following documentation, we won't take the time to define the fundamental

### The System

The _system_ is the heart of the Swagger-UI application. At runtime, it's a JavaScript object that holds many things:
The _system_ is the heart of the Swagger UI application. At runtime, it's a JavaScript object that holds many things:

- React components
- Bound Redux actions and reducers
Expand All @@ -27,11 +27,11 @@ The _system_ is the heart of the Swagger-UI application. At runtime, it's a Java
- References to the React and Immutable.js libraries (`system.React`, `system.Im`)
- User-defined helper functions

The system is built up when Swagger-UI is called by iterating through ("compiling") each plugin that Swagger-UI has been given, through the `presets` and `plugins` configuration options.
The system is built up when Swagger UI is called by iterating through ("compiling") each plugin that Swagger UI has been given, through the `presets` and `plugins` configuration options.

### Presets

Presets are arrays of plugins, which are provided to Swagger-UI through the `presets` configuration option. All plugins within presets are compiled before any plugins provided via the `plugins` configuration option. Consider the following example:
Presets are arrays of plugins, which are provided to Swagger UI through the `presets` configuration option. All plugins within presets are compiled before any plugins provided via the `plugins` configuration option. Consider the following example:

```javascript
const MyPreset = [FirstPlugin, SecondPlugin, ThirdPlugin]
Expand All @@ -43,7 +43,7 @@ SwaggerUI({
})
```

By default, Swagger-UI includes the internal `ApisPreset`, which contains a set of plugins that provide baseline functionality for Swagger-UI. If you specify your own `presets` option, you need to add the ApisPreset manually, like so:
By default, Swagger UI includes the internal `ApisPreset`, which contains a set of plugins that provide baseline functionality for Swagger UI. If you specify your own `presets` option, you need to add the ApisPreset manually, like so:

```javascript
SwaggerUI({
Expand All @@ -54,15 +54,15 @@ SwaggerUI({
})
```

The need to provide the `apis` preset when adding other presets is an artifact of Swagger-UI's original design, and will likely be removed in the next major version.
The need to provide the `apis` preset when adding other presets is an artifact of Swagger UI's original design, and will likely be removed in the next major version.

### getComponent

`getComponent` is a helper function injected into every container component, which is used to get references to components provided by the plugin system.

All components should be loaded through `getComponent`, since it allows other plugins to modify the component. It is preferred over a conventional `import` statement.

Container components in Swagger-UI can be loaded by passing `true` as the second argument to `getComponent`, like so:
Container components in Swagger UI can be loaded by passing `true` as the second argument to `getComponent`, like so:

```javascript
getComponent("ContainerComponentName", true)
Expand Down
8 changes: 4 additions & 4 deletions docs/customization/plug-points.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Plug points

Swagger-UI exposes most of its internal logic through the plugin system.
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.
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 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:
If you're installing Swagger UI via NPM, for example, you can do this by using a tilde:

```js
{
Expand Down
18 changes: 9 additions & 9 deletions docs/customization/plugin-api.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Plugins

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.
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.
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 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:
If you're installing Swagger UI via NPM, for example, you can do this by using a tilde:

```js
{
Expand Down Expand Up @@ -96,7 +96,7 @@ Once an action has been defined, you can use it anywhere that you can get a syst
system.exampleActions.updateFavoriteColor("blue")
```

The Action interface enables the creation of new Redux action creators within a piece of state in the Swagger-UI system.
The Action interface enables the creation of new Redux action creators within a piece of state in the Swagger UI system.

This action creator function will be exposed to container components as `exampleActions.updateFavoriteColor`. When this action creator is called, the return value (which should be a [Flux Standard Action](https://github.com/acdlite/flux-standard-action)) will be passed to the `example` reducer, which we'll define in the next section.

Expand Down Expand Up @@ -225,7 +225,7 @@ A Wrap Action's first argument is `oriAction`, which is the action being wrapped
This mechanism is useful for conditionally overriding built-in behaviors, or listening to actions.

```javascript
// FYI: in an actual Swagger-UI, `updateSpec` is already defined in the core code
// FYI: in an actual Swagger UI, `updateSpec` is already defined in the core code
// it's just here for clarity on what's behind the scenes
const MySpecPlugin = function(system) {
return {
Expand All @@ -251,9 +251,9 @@ const MyWrapActionPlugin = function(system) {
spec: {
wrapActions: {
updateSpec: (oriAction, system) => (str) => {
// here, you can hand the value to some function that exists outside of Swagger-UI
// here, you can hand the value to some function that exists outside of Swagger UI
console.log("Here is my API definition", str)
return oriAction(str) // don't forget! otherwise, Swagger-UI won't update
return oriAction(str) // don't forget! otherwise, Swagger UI won't update
}
}
}
Expand All @@ -273,7 +273,7 @@ This interface is useful for controlling what data flows into components. We use
```javascript
import { createSelector } from 'reselect'

// FYI: in an actual Swagger-UI, the `url` spec selector is already defined
// FYI: in an actual Swagger UI, the `url` spec selector is already defined
// it's just here for clarity on what's behind the scenes
const MySpecPlugin = function(system) {
return {
Expand Down
6 changes: 3 additions & 3 deletions docs/development/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Any of the scripts below can be run by typing `npm run <script name>` in the pro
Script name | Description
--- | ---
`dev` | Spawn a hot-reloading dev server on port 3200.
`deps-check` | Generate a size and licensing report on Swagger-UI's dependencies.
`deps-check` | Generate a size and licensing report on Swagger UI's dependencies.
`lint` | Report ESLint style errors and warnings.
`lint-errors` | Report ESLint style errors, without warnings.
`lint-fix` | Attempt to fix style errors automatically.
`watch` | Rebuild the core files in `/dist` when the source code changes. Useful for `npm link` with Swagger-Editor.
`watch` | Rebuild the core files in `/dist` when the source code changes. Useful for `npm link` with Swagger Editor.

### Building
Script name | Description
Expand All @@ -19,12 +19,12 @@ Script name | Description
`build-bundle` | Build `swagger-ui-bundle.js` only.
`build-core` | Build `swagger-ui.(js\|css)` only.
`build-standalone` | Build `swagger-ui-standalone-preset.js` only.
`build-stylesheets` | Build `swagger-ui.css` only.

### Testing
Script name | Description
--- | ---
`test` | Run unit tests in Node and run ESLint in errors-only mode.
`just-test` | Run unit tests in the browser with Karma.
`just-test-in-node` | Run unit tests in Node.
`just-check-coverage` | Generate a code coverage report with NYC.
`e2e` | Run end-to-end tests (requires JDK and Selenium).
4 changes: 2 additions & 2 deletions docs/development/setting-up.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setting up a dev environment

Swagger-UI includes a development server that provides hot module reloading and unminified stack traces, for easier development.
Swagger UI includes a development server that provides hot module reloading and unminified stack traces, for easier development.

### Prerequisites

Expand All @@ -20,5 +20,5 @@ Swagger-UI includes a development server that provides hot module reloading and

## Bonus points

- Swagger-UI includes an ESLint rule definition. If you use a graphical editor, consider installing an ESLint plugin, which will point out syntax and style errors for you as you code.
- Swagger UI includes an ESLint rule definition. If you use a graphical editor, consider installing an ESLint plugin, which will point out syntax and style errors for you as you code.
- The linter runs as part of the PR test sequence, so don't think you can get away with not paying attention to it!
Loading