Merge branch 'master' into releases

This commit is contained in:
RedocBot 2016-05-29 17:57:11 +00:00 committed by travis@localhost
commit a6e7f858d7
6 changed files with 22 additions and 31 deletions

View File

@ -5,28 +5,20 @@ require('shelljs/global');
var paths = require('./paths'); var paths = require('./paths');
var path = require('path'); var path = require('path');
// copy old releases set('-e');
mkdir('-p', '.ghpages-tmp'); set('-v');
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('..');
// build // build
exec('npm run build-dist'); exec('npm run build-dist');
cd('demo'); cd('demo');
mkdir('-p', 'dist'); mkdir('-p', 'dist');
cp('-R', '../dist/*', './dist/'); cp('-R', '../dist/*', './dist/');
mkdir('-p', 'releases');
cp('-R', '../.ghpages-tmp/*', './releases/');
cd('..'); cd('..');
var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/'; var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/';
var versionDir = path.join(paths.releases, version); var versionDir = path.join(paths.releases, version);
var latestDir = path.join(paths.releases, 'latest/');
mkdir('-p', versionDir) mkdir('-p', versionDir)
mkdir('-p', latestDir);
cp(paths.redocBuilt + '.min.js', versionDir); cp(paths.redocBuilt + '.min.js', versionDir);
cp(paths.redocBuilt + '.min.js', path.join(paths.releases, 'latest/')); cp(paths.redocBuilt + '.min.js', latestDir);

View File

@ -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')));
});

View File

@ -2,7 +2,7 @@
import { ElementRef } from '@angular/core'; import { ElementRef } from '@angular/core';
import SchemaSampler from 'json-schema-instantiator'; import * as OpenAPISampler from 'openapi-sampler';
import { RedocComponent, BaseComponent, SchemaManager } from '../base'; import { RedocComponent, BaseComponent, SchemaManager } from '../base';
import { JsonFormatter } from '../../utils/JsonFormatterPipe'; import { JsonFormatter } from '../../utils/JsonFormatterPipe';
@ -36,7 +36,11 @@ export class SchemaSample extends BaseComponent {
sample = base.examples['application/json']; sample = base.examples['application/json'];
} else { } else {
this.dereference(this.componentSchema); this.dereference(this.componentSchema);
sample = SchemaSampler.instantiate(this.componentSchema); try {
sample = OpenAPISampler.sample(this.componentSchema);
} catch(e) {
console.error('@@@@@@@@@@@@@@@@@@@' + e);
}
} }
this.data.sample = sample; this.data.sample = sample;

View File

@ -65,6 +65,7 @@ pre {
} }
.redoc-json { .redoc-json {
overflow-x: auto;
padding: 20px; padding: 20px;
border-radius: $border-radius*2; border-radius: $border-radius*2;
background-color: darken($black, 2%); background-color: darken($black, 2%);

View File

@ -1,7 +1,7 @@
{ {
"name": "redoc", "name": "redoc",
"description": "Swagger-generated API Reference Documentation", "description": "Swagger-generated API Reference Documentation",
"version": "0.12.0", "version": "0.13.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/Rebilly/ReDoc" "url": "git://github.com/Rebilly/ReDoc"
@ -15,7 +15,7 @@
"branch-release": "git reset --hard && branch-release", "branch-release": "git reset --hard && branch-release",
"unit": "gulp test", "unit": "gulp test",
"e2e": "gulp e2e --prod", "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": [ "keywords": [
"OpenAPI", "OpenAPI",
@ -43,9 +43,9 @@
"json": "github:systemjs/plugin-json@^0.1.0", "json": "github:systemjs/plugin-json@^0.1.0",
"json-formatter-js": "npm:json-formatter-js@^0.2.0", "json-formatter-js": "npm:json-formatter-js@^0.2.0",
"json-pointer": "npm:json-pointer@^0.3.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", "json-schema-ref-parser": "npm:json-schema-ref-parser@^3.1.2",
"marked": "npm:marked@^0.3.5", "marked": "npm:marked@^0.3.5",
"openapi-sampler": "npm:openapi-sampler@^0.1.2",
"prismjs": "npm:prismjs@^1.3.0", "prismjs": "npm:prismjs@^1.3.0",
"rxjs": "npm:rxjs@5.0.0-beta.6", "rxjs": "npm:rxjs@5.0.0-beta.6",
"scrollparent": "npm:scrollparent@^0.1.0", "scrollparent": "npm:scrollparent@^0.1.0",
@ -63,6 +63,10 @@
"overrides": { "overrides": {
"github:Robdel12/DropKick@2.1.7": { "github:Robdel12/DropKick@2.1.7": {
"format": "global" "format": "global"
},
"npm:openapi-sampler@0.1.2": {
"main": "src/openapi-sampler",
"format": "esm"
} }
} }
}, },
@ -72,7 +76,7 @@
"branch-release": "^0.3.2", "branch-release": "^0.3.2",
"browser-sync": "^2.10.1", "browser-sync": "^2.10.1",
"del": "^2.2.0", "del": "^2.2.0",
"deploy-to-gh-pages": "^1.0.0", "deploy-to-gh-pages": "^1.1.2",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-eslint": "^1.1.1", "gulp-eslint": "^1.1.1",

View File

@ -53,9 +53,9 @@ System.config({
"json": "github:systemjs/plugin-json@0.1.2", "json": "github:systemjs/plugin-json@0.1.2",
"json-formatter-js": "npm:json-formatter-js@0.2.0", "json-formatter-js": "npm:json-formatter-js@0.2.0",
"json-pointer": "npm:json-pointer@0.3.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", "json-schema-ref-parser": "npm:json-schema-ref-parser@3.1.2",
"marked": "npm:marked@0.3.5", "marked": "npm:marked@0.3.5",
"openapi-sampler": "npm:openapi-sampler@0.1.2",
"prismjs": "npm:prismjs@1.3.0", "prismjs": "npm:prismjs@1.3.0",
"rxjs": "npm:rxjs@5.0.0-beta.6", "rxjs": "npm:rxjs@5.0.0-beta.6",
"scrollparent": "npm:scrollparent@0.1.0", "scrollparent": "npm:scrollparent@0.1.0",