diff --git a/build/prepare_deploy.js b/build/prepare_deploy.js index 74638103..31e7b3a8 100755 --- a/build/prepare_deploy.js +++ b/build/prepare_deploy.js @@ -5,28 +5,20 @@ require('shelljs/global'); var paths = require('./paths'); var path = require('path'); -// copy old releases -mkdir('-p', '.ghpages-tmp'); -cd('.ghpages-tmp'); - -// reset local changes before checkout -exec('git reset --hard'); -exec('git fetch origin gh-pages:gh-pages'); -exec('git checkout gh-pages'); -cp('-R', '../releases/*', '.'); -exec('git checkout @{-1}'); -cd('..'); +set('-e'); +set('-v'); // build exec('npm run build-dist'); cd('demo'); mkdir('-p', 'dist'); cp('-R', '../dist/*', './dist/'); -mkdir('-p', 'releases'); -cp('-R', '../.ghpages-tmp/*', './releases/'); cd('..'); + var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/'; var versionDir = path.join(paths.releases, version); +var latestDir = path.join(paths.releases, 'latest/'); mkdir('-p', versionDir) +mkdir('-p', latestDir); cp(paths.redocBuilt + '.min.js', versionDir); -cp(paths.redocBuilt + '.min.js', path.join(paths.releases, 'latest/')); +cp(paths.redocBuilt + '.min.js', latestDir); diff --git a/build/tasks/copy-version.js b/build/tasks/copy-version.js deleted file mode 100644 index aaf93012..00000000 --- a/build/tasks/copy-version.js +++ /dev/null @@ -1,10 +0,0 @@ -var gulp = require('gulp'); -var path = require('path'); -var paths = require('../paths'); - -gulp.task('copy-version', function() { - var tag = 'v' + require(path.join(__dirname, '../../package.json')).version; - gulp.src(paths.redocBuilt + '.min.js') - .pipe(gulp.dest(path.join(paths.releases, tag))) - .pipe(gulp.dest(path.join(paths.releases, 'latest'))); -}); diff --git a/lib/components/SchemaSample/schema-sample.js b/lib/components/SchemaSample/schema-sample.js index 0c350ba1..034d8fa4 100644 --- a/lib/components/SchemaSample/schema-sample.js +++ b/lib/components/SchemaSample/schema-sample.js @@ -2,7 +2,7 @@ import { ElementRef } from '@angular/core'; -import SchemaSampler from 'json-schema-instantiator'; +import * as OpenAPISampler from 'openapi-sampler'; import { RedocComponent, BaseComponent, SchemaManager } from '../base'; import { JsonFormatter } from '../../utils/JsonFormatterPipe'; @@ -36,7 +36,11 @@ export class SchemaSample extends BaseComponent { sample = base.examples['application/json']; } else { this.dereference(this.componentSchema); - sample = SchemaSampler.instantiate(this.componentSchema); + try { + sample = OpenAPISampler.sample(this.componentSchema); + } catch(e) { + console.error('@@@@@@@@@@@@@@@@@@@' + e); + } } this.data.sample = sample; diff --git a/lib/components/SchemaSample/schema-sample.scss b/lib/components/SchemaSample/schema-sample.scss index ef191331..0df65e80 100644 --- a/lib/components/SchemaSample/schema-sample.scss +++ b/lib/components/SchemaSample/schema-sample.scss @@ -65,6 +65,7 @@ pre { } .redoc-json { + overflow-x: auto; padding: 20px; border-radius: $border-radius*2; background-color: darken($black, 2%); diff --git a/package.json b/package.json index c40c1599..1f09a58a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "0.12.0", + "version": "0.13.0", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc" @@ -15,7 +15,7 @@ "branch-release": "git reset --hard && branch-release", "unit": "gulp test", "e2e": "gulp e2e --prod", - "deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages demo" + "deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages --update demo" }, "keywords": [ "OpenAPI", @@ -43,9 +43,9 @@ "json": "github:systemjs/plugin-json@^0.1.0", "json-formatter-js": "npm:json-formatter-js@^0.2.0", "json-pointer": "npm:json-pointer@^0.3.0", - "json-schema-instantiator": "npm:json-schema-instantiator@^0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@^3.1.2", "marked": "npm:marked@^0.3.5", + "openapi-sampler": "npm:openapi-sampler@^0.1.2", "prismjs": "npm:prismjs@^1.3.0", "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@^0.1.0", @@ -63,6 +63,10 @@ "overrides": { "github:Robdel12/DropKick@2.1.7": { "format": "global" + }, + "npm:openapi-sampler@0.1.2": { + "main": "src/openapi-sampler", + "format": "esm" } } }, @@ -72,7 +76,7 @@ "branch-release": "^0.3.2", "browser-sync": "^2.10.1", "del": "^2.2.0", - "deploy-to-gh-pages": "^1.0.0", + "deploy-to-gh-pages": "^1.1.2", "gulp": "^3.9.1", "gulp-concat": "^2.6.0", "gulp-eslint": "^1.1.1", diff --git a/system.config.js b/system.config.js index 2983ac4c..6ff4a4b0 100644 --- a/system.config.js +++ b/system.config.js @@ -53,9 +53,9 @@ System.config({ "json": "github:systemjs/plugin-json@0.1.2", "json-formatter-js": "npm:json-formatter-js@0.2.0", "json-pointer": "npm:json-pointer@0.3.0", - "json-schema-instantiator": "npm:json-schema-instantiator@0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@3.1.2", "marked": "npm:marked@0.3.5", + "openapi-sampler": "npm:openapi-sampler@0.1.2", "prismjs": "npm:prismjs@1.3.0", "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@0.1.0",