diff --git a/.gitignore b/.gitignore index e4d93b73..51a2fb0f 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ compiled /coverage .ghpages-tmp stats.json +/package-lock.json diff --git a/.travis.yml b/.travis.yml index 421cd2f5..93032cf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,13 +25,8 @@ addons: sauce_connect: true 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 - - sleep 3 # give server time to start -after_script: - - kill %1 # kill e2e server before_deploy: -- if [[ ! -z "$TRAVIS_TAG" ]]; then npm run build:prod; fi +- if [[ ! -z "$TRAVIS_TAG" ]]; then npm run build:all; fi deploy: - provider: npm skip_cleanup: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a4fb29f..aed0b4a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ + +# [1.17.0](https://github.com/Rebilly/ReDoc/compare/v1.16.1...v1.17.0) (2017-08-02) + + +### Bug Fixes + +* copy code-samples included \n\r characters ([cd962fa](https://github.com/Rebilly/ReDoc/commit/cd962fa)), closes [#296](https://github.com/Rebilly/ReDoc/issues/296) +* enum with single value not shown in non-body params ([87d9abd](https://github.com/Rebilly/ReDoc/commit/87d9abd)), closes [#284](https://github.com/Rebilly/ReDoc/issues/284) +* handle case where items is array in indexer ([5e5db72](https://github.com/Rebilly/ReDoc/commit/5e5db72)), closes [#304](https://github.com/Rebilly/ReDoc/issues/304) +* output dates as ISO 8601 strings in JSON Formatter ([#313](https://github.com/Rebilly/ReDoc/issues/313)) ([86d8179](https://github.com/Rebilly/ReDoc/commit/86d8179)) +* make padding between h2 sections smaller ([2c89536](https://github.com/Rebilly/ReDoc/commit/2c89536)), closes [#291](https://github.com/Rebilly/ReDoc/issues/291) +* ready-only for nested objects samples ([be41d6d](https://github.com/Rebilly/ReDoc/commit/be41d6d)), closes [#300](https://github.com/Rebilly/ReDoc/issues/300) + + +### Features + +* add `hide-loading` option ([2ebca4b](https://github.com/Rebilly/ReDoc/commit/2ebca4b)), closes [#315](https://github.com/Rebilly/ReDoc/issues/315) +* add special rendering for deprecated operations ([#290](https://github.com/Rebilly/ReDoc/issues/290)) ([2748aac](https://github.com/Rebilly/ReDoc/commit/2748aac)) +* export angular module ** ([ef5101b](https://github.com/Rebilly/ReDoc/commit/ef5101b)) +* support for xml samples in response when there is no schema in response ([eb7089b](https://github.com/Rebilly/ReDoc/commit/eb7089b)), closes [#307](https://github.com/Rebilly/ReDoc/issues/307) + + + # [1.16.0](https://github.com/Rebilly/ReDoc/compare/v1.15.0...v1.16.0) (2017-05-12) diff --git a/README.md b/README.md index f10f44c5..469c6a23 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ ReDoc makes use of the following [vendor extensions](http://swagger.io/specifica * `required-props-first` - show required properties first ordered in the same order as in `required` array. * `no-auto-auth` - do not inject Authentication section automatically * `path-in-middle-panel` - show path link and HTTP verb in the middle panel instead of the right one +* `hide-loading` - do not show loading animation. Useful for small docs ## Advanced usage Instead of adding `spec-url` attribute to the `` element you can initialize ReDoc via globally exposed `Redoc` object: diff --git a/build/join-module-css.js b/build/join-module-css.js new file mode 100644 index 00000000..c41e2b25 --- /dev/null +++ b/build/join-module-css.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +'use strict'; +require('shelljs/global'); + +set('-e'); +set('-v'); + + +cat([ + 'lib/components/Redoc/redoc-initial-styles.css', + 'node_modules/perfect-scrollbar/dist/css/perfect-scrollbar.css', + 'node_modules/dropkickjs/build/css/dropkick.css', + 'node_modules/prismjs/themes/prism-dark.css', + 'node_modules/hint.css/hint.base.css' +]).to('dist/redoc.css') diff --git a/build/run_tests.js b/build/run_tests.js index dc8b232c..805b4ef5 100755 --- a/build/run_tests.js +++ b/build/run_tests.js @@ -8,6 +8,10 @@ function isPR() { return process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false'; } +function isCI() { + return !!process.env.CI; +} + if (process.env.JOB === 'e2e-guru') { if (isPR()) { console.log('Skiping E2E tests on PR'); @@ -20,6 +24,10 @@ if (process.env.JOB === 'e2e-guru') { console.log('Skiping E2E tests on PR'); return; } + if (!isCI()) { + console.log('Skiping E2E tests locally. Use `npm run e2e` to run'); + return; + } console.log('Starting Basic E2E'); exec('npm run e2e'); } diff --git a/build/webpack.dev.js b/build/webpack.dev.js index fe46d15e..6c544102 100644 --- a/build/webpack.dev.js +++ b/build/webpack.dev.js @@ -10,13 +10,12 @@ 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 + IS_PRODUCTION: IS_PRODUCTION, + AOT: IS_PRODUCTION }), { devtool: '#inline-source-map', entry: { 'polyfills': './lib/polyfills.ts', - 'vendor': './lib/vendor.ts', 'redoc': './lib/index.ts', }, devServer: { @@ -35,7 +34,7 @@ module.exports = webpackMerge(commonConfig({ { test: /\.ts$/, use: [ - 'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}', + 'awesome-typescript-loader', 'angular2-template-loader', ], exclude: [/\.(spec|e2e)\.ts$/] diff --git a/build/webpack.prod.js b/build/webpack.prod.js index 1b517d66..aaf8e904 100644 --- a/build/webpack.prod.js +++ b/build/webpack.prod.js @@ -21,7 +21,7 @@ const config = webpackMerge(commonConfig({ devtool: 'source-map', entry: { - 'redoc': IS_MODULE ? ['./lib/vendor.ts', './lib/redoc.module.ts'] : ['./lib/polyfills.ts', './lib/vendor.ts', './lib/index.ts'] + 'redoc': IS_MODULE ? ['./lib/redoc.module.ts'] : ['./lib/polyfills.ts', './lib/index.ts'] }, output: { @@ -37,7 +37,7 @@ const config = webpackMerge(commonConfig({ { test: /\.ts$/, use: [ - 'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}', + 'awesome-typescript-loader', 'angular2-template-loader', ], exclude: [/\.(spec|e2e)\.ts$/] @@ -52,8 +52,7 @@ const config = webpackMerge(commonConfig({ new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, - screw_ie8: true, - negate_iife: false // for lazy v8 + screw_ie8: true }, mangle: { screw_ie8 : true }, output: { @@ -61,6 +60,7 @@ const config = webpackMerge(commonConfig({ }, sourceMap: true }), + new webpack.optimize.ModuleConcatenationPlugin(), new webpack.BannerPlugin(BANNER) ] }) diff --git a/build/webpack.test.js b/build/webpack.test.js index 551b1b4c..5f01ccd2 100644 --- a/build/webpack.test.js +++ b/build/webpack.test.js @@ -27,12 +27,6 @@ module.exports = webpackMerge(commonConfig({ exclude: [/\.(spec|e2e)\.ts$/] }, { - /** - * Instruments JS files with Istanbul for subsequent code coverage reporting. - * Instrument only testing sources. - * - * See: https://github.com/deepsweet/istanbul-instrumenter-loader - */ enforce: 'post', test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader', include: root('lib'), diff --git a/demo/examples/multiple-apis/index.html b/demo/examples/multiple-apis/index.html index 6e55532b..1b12cbdc 100644 --- a/demo/examples/multiple-apis/index.html +++ b/demo/examples/multiple-apis/index.html @@ -15,13 +15,13 @@ width: 100%; z-index: 100; } - ul#links_container { + #links_container { margin: 0; padding: 0; background-color: #0033a0; } - li { + #links_container li { display: inline-block; padding: 10px; color: white; diff --git a/demo/index-gh.html b/demo/index-gh.html index 5835dfc9..04e0e3ec 100644 --- a/demo/index-gh.html +++ b/demo/index-gh.html @@ -4,8 +4,8 @@ ReDoc - - + + diff --git a/demo/index.html b/demo/index.html index 8ef1e02a..29bfdf66 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,8 +4,8 @@ ReDoc - - + + @@ -32,14 +32,5 @@ - diff --git a/demo/swagger.yaml b/demo/swagger.yaml index 63a0bcbb..7ffec750 100644 --- a/demo/swagger.yaml +++ b/demo/swagger.yaml @@ -336,6 +336,7 @@ paths: summary: Finds Pets by tags description: 'Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.' operationId: findPetsByTags + deprecated: true produces: - application/xml - application/json diff --git a/lib/bootstrap.dev.ts b/lib/bootstrap.dev.ts index 296618d7..0ae0cee2 100644 --- a/lib/bootstrap.dev.ts +++ b/lib/bootstrap.dev.ts @@ -1,6 +1,7 @@ +import { NgModuleRef } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app.module'; -export function bootstrapRedoc() { +export function bootstrapRedoc(): Promise> { return platformBrowserDynamic().bootstrapModule(AppModule); } diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts index 86eddbd3..080140d2 100644 --- a/lib/bootstrap.ts +++ b/lib/bootstrap.ts @@ -1,6 +1,8 @@ +import { NgModuleRef } from '@angular/core'; import { platformBrowser } from '@angular/platform-browser'; +import { AppModule } from './app.module'; import { AppModuleNgFactory } from '../compiled/lib/app.module.ngfactory'; -export function bootstrapRedoc() { +export function bootstrapRedoc():Promise> { return platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); } diff --git a/lib/components/ApiInfo/api-info.scss b/lib/components/ApiInfo/api-info.scss index b029683a..f7e9f732 100644 --- a/lib/components/ApiInfo/api-info.scss +++ b/lib/components/ApiInfo/api-info.scss @@ -22,3 +22,7 @@ :host /deep/ [section] { padding-top: 2 * $section-spacing; } + +:host /deep/ h2[section] { + padding-top: $section-spacing; +} diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html index b05f7afd..e32a8578 100644 --- a/lib/components/JsonSchema/json-schema.html +++ b/lib/components/JsonSchema/json-schema.html @@ -49,12 +49,12 @@ - +
diff --git a/lib/components/Operation/operation.html b/lib/components/Operation/operation.html index 4fa9a345..3ddea4f5 100644 --- a/lib/components/Operation/operation.html +++ b/lib/components/Operation/operation.html @@ -1,6 +1,6 @@
-

+

{{operation.summary}}

- + {{param | collectionFormat}} {{param.default | json}}
-
- {{enumItem.val | json}} +
+ + {{enumItem.val | json}} + + + {{param._enumItem.val | json}} +
{{param.pattern}}
diff --git a/lib/components/Redoc/redoc.scss b/lib/components/Redoc/redoc.scss index 38c6b3f3..abf2326e 100644 --- a/lib/components/Redoc/redoc.scss +++ b/lib/components/Redoc/redoc.scss @@ -283,7 +283,7 @@ footer { &:before, &:after { letter-spacing: -0.2em; - content: "\00a0"; + //content: "\00a0"; } } diff --git a/lib/components/Redoc/redoc.ts b/lib/components/Redoc/redoc.ts index 395641e7..26677218 100644 --- a/lib/components/Redoc/redoc.ts +++ b/lib/components/Redoc/redoc.ts @@ -45,7 +45,7 @@ function getPreOptions() { //changeDetection: ChangeDetectionStrategy.OnPush }) export class Redoc extends BaseComponent implements OnInit { - static _preOptions: any; + static _preOptions: any = {}; error: any; specLoaded: boolean; @@ -89,6 +89,9 @@ export class Redoc extends BaseComponent implements OnInit { } hideLoadingAnimation() { + if (this.options.hideLoading) { + return + } requestAnimationFrame(() => { this.specLoadingRemove = true; setTimeout(() => { @@ -99,6 +102,9 @@ export class Redoc extends BaseComponent implements OnInit { } showLoadingAnimation() { + if (this.options.hideLoading) { + return + } this.specLoading = true; this.specLoadingRemove = false; } diff --git a/lib/components/ResponsesSamples/responses-samples.ts b/lib/components/ResponsesSamples/responses-samples.ts index e977b275..a7585d7d 100644 --- a/lib/components/ResponsesSamples/responses-samples.ts +++ b/lib/components/ResponsesSamples/responses-samples.ts @@ -3,7 +3,7 @@ import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core'; import { BaseComponent, SpecManager } from '../base'; import JsonPointer from '../../utils/JsonPointer'; -import { statusCodeType, getJsonLikeSample } from '../../utils/helpers'; +import { statusCodeType, getJsonLikeSample, getXmlLikeSample } from '../../utils/helpers'; function isNumeric(n) { @@ -11,8 +11,7 @@ function isNumeric(n) { } function hasExample(response) { - return ((response.examples && getJsonLikeSample(response.examples)) || - response.schema); + return response.schema || getXmlLikeSample(response.examples) || getJsonLikeSample(response.examples) } @Component({ diff --git a/lib/components/SchemaSample/schema-sample.html b/lib/components/SchemaSample/schema-sample.html index b7791525..a13dbc78 100644 --- a/lib/components/SchemaSample/schema-sample.html +++ b/lib/components/SchemaSample/schema-sample.html @@ -12,7 +12,7 @@ - + diff --git a/lib/components/SideMenu/side-menu-items.html b/lib/components/SideMenu/side-menu-items.html index 8010e404..726900cd 100644 --- a/lib/components/SideMenu/side-menu-items.html +++ b/lib/components/SideMenu/side-menu-items.html @@ -1,6 +1,6 @@