diff --git a/.gitignore b/.gitignore
index 045d5fea..e4d93b73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ lib/**/*.shim.ngstyle.ts
/dist
/demo/build
.tmp
+compiled
/coverage
.ghpages-tmp
stats.json
diff --git a/.npmignore b/.npmignore
index f66b4783..7d2abb70 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,6 +1,6 @@
.DS_Store
**/.*
-.tmp
+compiled
node_modules
jspm_packages
diff --git a/.travis.yml b/.travis.yml
index c720646e..096618eb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
-- '4.0'
+- '6'
branches:
except:
- releases
@@ -22,9 +22,7 @@ env:
- secure: apiavCfCQngL9Een1m7MIXMf3bqO3rY4YY59TMBl/yFKi80CEsHPHhgVUkl6hC+aM5PeBt/vgjh37rHMX31j/pcSZ4Z8SO/4Bwr36iHfhSxSEuAQog8P07qWqH7wYYWGIVmF682stgl0fYF+GN92sx/6edFVzsWVECf2G7imtICKSTbhKGm3Dhn2JwGnhD7eyfgZ33omgiaswumdu0xABoXDfqSZR+16fC4Ap5rhv3fXO9ndvRNy1STn376nT+my6e86UrQL4aS/S+HNHgIe1BUs+5cOp6Jgw6t0ie7phY0EAiECsRxy9K4e3Dctv9m6+Wma4+vy65MS0zGyrqey6oyV4l827sCOjrD1qcqc9bX6FlMSouVoNfE4ZjINNAbgigTaiLSoDSPcf5I5smkkM2ezzFOMSZwZxNdaNL2LKb97vc8m/ZUkv0sKZyT7oqVL7aJweEivsSHj5l2KR8Z7XrVB1y2eI6GvyTSa/d+CL4dSRzjh8+IRN047YBrdTKD5IkdT0upfoBu14WPUfFmLKxX+iMCslXRWb6kwojhrWNYmZvL65KRAzJ6+eIPDG/W5QUOpYyYT77bLlBQjVo6NmVvl9v3HMECq9CHH0ivKFBGPiKMOx7cJkTax3FuyznOW2WCXB9kTb5Zk9toaiNlSp9L6ll/h2Eyxa6n6sWUgmmM=
addons:
sauce_connect: true
-cache:
- directories:
- - node_modules
+cache: yarn
before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
before_script:
- npm run e2e-server > /dev/null & # kill e2e server
@@ -32,7 +30,7 @@ before_script:
after_script:
- kill %1 # kill e2e server
before_deploy:
-- if [[ ! -z "$TRAVIS_TAG" ]]; then npm run build:prod-module; fi
+- if [[ ! -z "$TRAVIS_TAG" ]]; then npm run build:prod; fi
deploy:
- provider: npm
skip_cleanup: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f2aba7d..3c6ade1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+# 1.7.0 (2017-01-06)
+### Features/Improvements
+* Add support for grouping items in menu via [`x-tagGroups`](https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md#x-taggroups)
+* Support inherited discriminator (only one at the moment)
+* Add support for second-level headings from Markdown docs (by [@jaingaurav](https://github.com/jaingaurav))
+
+### Bug fixes
+* Fix response list for shared schemas (fixes [#177](https://github.com/Rebilly/ReDoc/issues/177))
+* Fix right panel overlaps site-footer
+
+# 1.6.4 (2016-12-28)
+### Bug fixes
+* Fix crash on MS Edge (fixes [#166](https://github.com/Rebilly/ReDoc/issues/166))
+* Uncomment animation after upgrade to the latest ng2 (resolves [#162](https://github.com/Rebilly/ReDoc/issues/162))
+
# 1.6.3 (2016-12-19)
### Bug fixes
* Disable side-menu animation (workaround for [#162](https://github.com/Rebilly/ReDoc/issues/162))
diff --git a/README.md b/README.md
index a3655408..def7a5d1 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# ReDoc
**OpenAPI/Swagger-generated API Reference Documentation**
-[![Build Status](https://travis-ci.org/Rebilly/ReDoc.svg?branch=master)](https://travis-ci.org/Rebilly/ReDoc) [![Coverage Status](https://coveralls.io/repos/Rebilly/ReDoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [![Tested on APIs.guru](http://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![dependencies Status](https://david-dm.org/Rebilly/ReDoc/status.svg)](https://david-dm.org/Rebilly/ReDoc) [![devDependencies Status](https://david-dm.org/Rebilly/ReDoc/dev-status.svg)](https://david-dm.org/Rebilly/ReDoc#info=devDependencies) [![Stories in Ready](https://badge.waffle.io/Rebilly/ReDoc.png?label=ready&title=Ready)](https://waffle.io/Rebilly/ReDoc)
+[![Build Status](https://travis-ci.org/Rebilly/ReDoc.svg?branch=master)](https://travis-ci.org/Rebilly/ReDoc) [![Coverage Status](https://coveralls.io/repos/Rebilly/ReDoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [![Tested on APIs.guru](http://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![Dependency Status](https://gemnasium.com/badges/github.com/Rebilly/ReDoc.svg)](https://gemnasium.com/github.com/Rebilly/ReDoc) [![Stories in Ready](https://badge.waffle.io/Rebilly/ReDoc.png?label=ready&title=Ready)](https://waffle.io/Rebilly/ReDoc)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/Rebilly/redoc.svg)](http://isitmaintained.com/project/Rebilly/redoc "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/REBILLY/REDOC.svg)](http://isitmaintained.com/project/REBILLY/REDOC "Percentage of issues still open")
@@ -17,15 +17,18 @@
## Features
- Extremely easy deployment
-- It’s free and open-source project under MIT license
-- The widest OpenAPI features support (yes, it supports even `discriminator`)
-- Neat **interactive** documentation for nested objects
-
-
-
-- Code samples support (via vendor extension)
+- The widest OpenAPI features support (yes, it supports even `discriminator`)
+![](docs/images/discriminator-demo.gif)
+- Neat **interactive** documentation for nested objects
+![](docs/images/nested-demo.gif)
+- Code samples support (via vendor extension)
+![](docs/images/code-samples-demo.gif)
+- Progressive loading with `lazy-rendering` options
+![](docs/images/progressive-loading-demo.gif)
- Responsive three-panel design with menu/scrolling synchronization
-- Integrate API introduction into side menu - ReDoc takes advantage of markdown headings from OpenAPI description field. It pulls them into side menu and also supports deep linking.
+- Integrate API Introduction into side menu - ReDoc takes advantage of markdown headings from OpenAPI description field. It pulls them into side menu and also supports deep linking.
+- High-level grouping in side-menu via [`x-tagGroups`](docs/redoc-vendor-extensions.md#x-tagGroups) vendor extension
+- Multiple ReDoc instances on single page ([example](demo/examples/multiple-apis/index.html))
## Roadmap
- [x] performance optimizations
@@ -38,7 +41,7 @@
We host the latest and all the previous ReDoc releases on GitHub Pages-based **CDN**:
- particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js
- `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js
-- `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js **[not for production]**
+- `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js this file is updated with each release of ReDoc and may introduce breaking changes. **Not recommended to use in production.** Use particular release or `v1.x.x`.
## Deployment
diff --git a/bower.json b/bower.json
index e21e0317..d3d14e62 100644
--- a/bower.json
+++ b/bower.json
@@ -26,6 +26,7 @@
"**/.*",
"node_modules",
"tests",
+ "compiled",
"lib",
"demo",
"build",
diff --git a/build/resource-override.js b/build/resource-override.js
new file mode 100644
index 00000000..e69de29b
diff --git a/build/webpack.common.js b/build/webpack.common.js
new file mode 100644
index 00000000..c24c5e03
--- /dev/null
+++ b/build/webpack.common.js
@@ -0,0 +1,133 @@
+const webpack = require('webpack');
+
+const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
+const StringReplacePlugin = require("string-replace-webpack-plugin");
+const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
+const ngcWebpack = require('ngc-webpack');
+
+const VERSION = JSON.stringify(require('../package.json').version);
+
+const root = require('./helpers').root;
+
+module.exports = function (options) {
+ const conf = {
+ performance: { hints: false },
+
+ output: {
+ path: root('dist'),
+ filename: '[name].js',
+ sourceMapFilename: '[name].[id].map',
+ chunkFilename: '[id].chunk.js'
+ },
+
+ resolve: {
+ extensions: ['.ts', '.js', '.json', '.css'],
+ alias: {
+ http: 'stream-http',
+ https: 'stream-http'
+ }
+ },
+
+ externals: {
+ 'jquery': 'jquery',
+ 'esprima': 'esprima' // optional dep of ys-yaml not needed for redoc
+ },
+
+ module: {
+ exprContextCritical: false,
+ rules: [
+ {
+ enforce: 'pre',
+ test: /\.ts$/,
+ exclude: [
+ /node_modules/
+ ],
+ loader: StringReplacePlugin.replace({
+ replacements: [
+ {
+ pattern: /styleUrls:\s*\[\s*'([\w\.\/-]*)\.css'\s*\][\s,]*$/gm,
+ replacement: function (match, p1, offset, string) {
+ return `styleUrls: ['${p1}.scss'],`;
+ }
+ },
+ {
+ pattern: /(\.\/components\/Redoc\/redoc-initial-styles\.css)/gm,
+ replacement: function (match, p1, offset, string) {
+ return p1.replace('.css', '.scss');
+ }
+ }
+ ]
+ })
+ },
+ {
+ enforce: 'pre',
+ test: /\.js$/,
+ loader: 'source-map-loader',
+ exclude: [
+ /node_modules/
+ ]
+ },
+ {
+ test: /\.json$/,
+ use: 'json-loader'
+ },
+ {
+ test: /lib[\\\/].*\.css$/,
+ loaders: ['raw-loader'],
+ exclude: [/redoc-initial-styles\.css$/]
+ }, {
+ test: /\.css$/,
+ loaders: ['style-loader', 'css-loader?-import'],
+ exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
+ },
+ {
+ test: /lib[\\\/].*\.scss$/,
+ loaders: ['raw-loader', "sass-loader"],
+ exclude: [/redoc-initial-styles\.scss$/]
+ },
+ {
+ test: /\.scss$/,
+ loaders: ['style-loader', 'css-loader?-import', "sass-loader"],
+ exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.scss$/]
+ },
+ {
+ test: /\.html$/,
+ loader: 'raw-loader'
+ }
+ ],
+
+ },
+
+ plugins: [
+ new CheckerPlugin(),
+ new webpack.DefinePlugin({
+ 'IS_PRODUCTION': options.IS_PRODUCTION,
+ 'LIB_VERSION': VERSION,
+ 'AOT': options.AOT
+ }),
+
+ new StringReplacePlugin()
+ ],
+ node: {
+ global: true,
+ crypto: 'empty',
+ fs: 'empty',
+ process: true,
+ module: false,
+ clearImmediate: false,
+ setImmediate: false
+ }
+ };
+
+ if (options.AOT) {
+ conf.plugins.push(
+ new ngcWebpack.NgcWebpackPlugin({
+ disable: !options.AOT,
+ tsConfig: root('tsconfig.webpack.json'),
+ resourceOverride: root('build/resource-override.js')
+ })
+ );
+ }
+
+ return conf;
+}
diff --git a/build/webpack.dev.js b/build/webpack.dev.js
index ca8cf7c7..fe46d15e 100644
--- a/build/webpack.dev.js
+++ b/build/webpack.dev.js
@@ -1,41 +1,24 @@
const webpack = require('webpack');
-const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
+const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const StringReplacePlugin = require("string-replace-webpack-plugin");
const root = require('./helpers').root;
const VERSION = JSON.stringify(require('../package.json').version);
const IS_PRODUCTION = process.env.NODE_ENV === "production";
-// TODO Refactor common parts of config
-module.exports = {
+const webpackMerge = require('webpack-merge'); // used to merge webpack configs
+const commonConfig = require('./webpack.common.js');
+
+module.exports = webpackMerge(commonConfig({
+ IS_PRODUCTION: process.env.NODE_ENV === "production",
+ AOT: false
+}), {
devtool: '#inline-source-map',
- performance: { hints: false },
- resolve: {
- extensions: ['.ts', '.js', '.json', '.css'],
- alias: {
- http: 'stream-http',
- https: 'stream-http'
- }
- },
- externals: {
- 'jquery': 'jquery',
- 'esprima': 'esprima' // optional dep of ys-yaml not needed for redoc
- },
- node: {
- fs: "empty",
- crypto: "empty",
- global: true,
- process: true,
- module: false,
- clearImmediate: false,
- setImmediate: false
- },
entry: {
- 'redoc': './lib/index.ts',
+ 'polyfills': './lib/polyfills.ts',
'vendor': './lib/vendor.ts',
- 'polyfills': './lib/polyfills.ts'
+ 'redoc': './lib/index.ts',
},
-
devServer: {
contentBase: root('demo'),
watchContentBase: true,
@@ -47,87 +30,22 @@ module.exports = {
hot: false,
stats: 'errors-only'
},
-
- output: {
- path: root('dist'),
- filename: '[name].js',
- sourceMapFilename: '[name].[id].map',
- chunkFilename: '[id].chunk.js',
- // devtoolModuleFilenameTemplate: "[resource-path]",
- // devtoolFallbackModuleFilenameTemplate: "[resource-path]?[hash]",
- },
-
module: {
- exprContextCritical: false,
- rules: [{
- enforce: 'pre',
- test: /\.js$/,
- loader: 'source-map-loader',
- exclude: [
- /node_modules/
- ]
- }, {
- enforce: 'pre',
- test: /\.ts$/,
- exclude: [
- /node_modules/
- ],
- loader: StringReplacePlugin.replace({
- replacements: [
- {
- pattern: /styleUrls:\s*\[\s*'([\w\.\/-]*)\.css'\s*\][\s,]*$/gm,
- replacement: function (match, p1, offset, string) {
- return `styleUrls: ['${p1}.scss'],`;
- }
- },
- {
- pattern: /(\.\/components\/Redoc\/redoc-initial-styles\.css)/gm,
- replacement: function (match, p1, offset, string) {
- return p1.replace('.css', '.scss');
- }
- }
- ]
- })
- }, {
- test: /\.ts$/,
- loaders: [
- 'awesome-typescript-loader',
- 'angular2-template-loader'
- ],
- exclude: [/\.(spec|e2e)\.ts$/]
- }, {
- test: /lib[\\\/].*\.scss$/,
- loaders: ['raw-loader', "sass-loader"],
- exclude: [/redoc-initial-styles\.scss$/]
- }, {
- test: /\.scss$/,
- loaders: ['style-loader', 'css-loader?-import', "sass-loader"],
- exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.scss$/]
- }, {
- test: /\.css$/,
- loaders: ['style-loader', 'css-loader?-import'],
- }, {
- test: /\.html$/,
- loader: 'raw-loader'
- }]
+ rules: [
+ {
+ test: /\.ts$/,
+ use: [
+ 'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}',
+ 'angular2-template-loader',
+ ],
+ exclude: [/\.(spec|e2e)\.ts$/]
+ },
+ ]
},
-
plugins: [
- new webpack.HotModuleReplacementPlugin(),
-
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor', 'polyfills'],
minChunks: Infinity
- }),
-
- new webpack.DefinePlugin({
- 'IS_PRODUCTION': IS_PRODUCTION,
- 'LIB_VERSION': VERSION,
- 'AOT': IS_PRODUCTION
- }),
-
- new ForkCheckerPlugin(),
-
- new StringReplacePlugin()
- ],
-}
+ })
+ ]
+})
diff --git a/build/webpack.prod.js b/build/webpack.prod.js
index baeee310..1b517d66 100644
--- a/build/webpack.prod.js
+++ b/build/webpack.prod.js
@@ -11,31 +11,15 @@ const BANNER =
const IS_MODULE = process.env.IS_MODULE != null;
-const config = {
- context: root(),
- devtool: 'source-map',
- performance: { hints: false },
+const webpackMerge = require('webpack-merge'); // used to merge webpack configs
+const commonConfig = require('./webpack.common.js');
+
+const config = webpackMerge(commonConfig({
+ IS_PRODUCTION: true,
+ AOT: true
+}), {
+ devtool: 'source-map',
- resolve: {
- extensions: ['.ts', '.js', '.json', '.css'],
- alias: {
- http: 'stream-http',
- https: 'stream-http'
- }
- },
- externals: {
- 'jquery': 'jquery',
- 'esprima': 'esprima' // optional dep of ys-yaml not needed for redoc
- },
- node: {
- fs: "empty",
- crypto: "empty",
- global: true,
- process: true,
- module: false,
- clearImmediate: false,
- setImmediate: false
- },
entry: {
'redoc': IS_MODULE ? ['./lib/vendor.ts', './lib/redoc.module.ts'] : ['./lib/polyfills.ts', './lib/vendor.ts', './lib/index.ts']
},
@@ -48,34 +32,18 @@ const config = {
libraryTarget: 'umd',
umdNamedDefine: true
},
-
module: {
- exprContextCritical: false,
- rules: [{
- enforce: 'pre',
- test: /\.js$/,
- loader: 'source-map-loader',
- exclude: [
- /node_modules/
- ]
- }, {
- test: /node_modules\/.*\.ngfactory\.ts$/,
- loader: 'awesome-typescript-loader'
- }, {
- test: /\.ts$/,
- loader: 'awesome-typescript-loader',
- exclude: /(node_modules)/,
- }, {
- test: /lib[\\\/].*\.css$/,
- loaders: ['raw-loader'],
- exclude: [/redoc-initial-styles\.css$/]
- }, {
- test: /\.css$/,
- loaders: ['style-loader', 'css-loader?-import'],
- exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
- }]
+ rules: [
+ {
+ test: /\.ts$/,
+ use: [
+ 'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}',
+ 'angular2-template-loader',
+ ],
+ exclude: [/\.(spec|e2e)\.ts$/]
+ }
+ ]
},
-
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
@@ -84,7 +52,8 @@ const config = {
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
- screw_ie8: true
+ screw_ie8: true,
+ negate_iife: false // for lazy v8
},
mangle: { screw_ie8 : true },
output: {
@@ -92,14 +61,9 @@ const config = {
},
sourceMap: true
}),
- new webpack.BannerPlugin(BANNER),
- new webpack.DefinePlugin({
- 'IS_PRODUCTION': true,
- 'LIB_VERSION': VERSION,
- 'AOT': true
- })
- ],
-}
+ new webpack.BannerPlugin(BANNER)
+ ]
+})
if (IS_MODULE) {
config.externals = {
@@ -114,17 +78,6 @@ if (IS_MODULE) {
'rxjs': 'rxjs',
'zone.js/dist/zone': 'zone.js/dist/zone'
};
-
- config.module.rules.push({
- test: /\.ts$/,
- loader: 'angular2-template-loader',
- exclude: [/\.(spec|e2e)\.ts$/]
- });
-
- config.module.rules.push({
- test: /\.html$/,
- loader: 'raw-loader'
- });
}
module.exports = config;
diff --git a/build/webpack.test.js b/build/webpack.test.js
index 3b76fa98..e1296d74 100644
--- a/build/webpack.test.js
+++ b/build/webpack.test.js
@@ -1,73 +1,31 @@
const webpack = require('webpack');
const root = require('./helpers').root;
-const VERSION = JSON.stringify(require('../package.json').version);
+const webpackMerge = require('webpack-merge'); // used to merge webpack configs
+const commonConfig = require('./webpack.common.js');
-module.exports = {
-
+module.exports = webpackMerge(commonConfig({
+ IS_PRODUCTION: true,
+ AOT: false
+}), {
devtool: 'inline-source-map',
- performance: { hints: false },
- resolve: {
- extensions: ['.ts', '.js', '.json', '.css'],
- alias: {
- http: 'stream-http',
- https: 'stream-http'
- }
- },
- externals: {
- 'jquery': 'jquery',
- 'esprima': 'esprima' // optional dep of ys-yaml not needed for redoc
- },
- node: {
- fs: "empty",
- crypto: "empty",
- global: true,
- process: true,
- module: false,
- clearImmediate: false,
- setImmediate: false
- },
-
- output: {
- path: root('dist'),
- filename: '[name].js',
- sourceMapFilename: '[name].map',
- chunkFilename: '[id].chunk.js'
- },
module: {
exprContextCritical: false,
- rules: [{
- enforce: 'pre',
- test: /\.js$/,
- loader: 'source-map-loader',
- exclude: [
- /node_modules/
- ]
- },{
+ rules: [
+ {
test: /\.ts$/,
- loaders: [
- 'awesome-typescript-loader'
- ]
- }, {
+ use: 'awesome-typescript-loader'
+ },
+ {
test: /\.ts$/,
- loaders: [
- 'angular2-template-loader'
+ use: [
+ 'angular2-template-loader',
],
exclude: [/\.(spec|e2e)\.ts$/]
- }, {
- test: /lib[\\\/].*\.css$/,
- loaders: ['raw-loader'],
- exclude: [/redoc-initial-styles\.css$/]
- }, {
- test: /\.css$/,
- loaders: ['style-loader', 'css-loader?-import'],
- exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
- }, {
- test: /\.html$/,
- loader: 'raw-loader'
- }, {
+ },
+ {
/**
* Instruments JS files with Istanbul for subsequent code coverage reporting.
* Instrument only testing sources.
@@ -85,11 +43,6 @@ module.exports = {
},
plugins: [
- new webpack.DefinePlugin({
- 'IS_PRODUCTION': false,
- 'LIB_VERSION': VERSION,
- 'AOT': 'false'
- }),
new webpack.LoaderOptionsPlugin({
test: /\.ts$/,
sourceMap: false,
@@ -106,4 +59,4 @@ module.exports = {
/(?:[^\\\/]*(?:[\\\/]|$))*[^\\\/]*\.css$/ // ignore css files
])
],
-}
+})
diff --git a/demo/examples/multiple-apis/index.html b/demo/examples/multiple-apis/index.html
new file mode 100644
index 00000000..6e55532b
--- /dev/null
+++ b/demo/examples/multiple-apis/index.html
@@ -0,0 +1,79 @@
+
+
+