Merge commit 'cfc14c8c7a545a548f0d4b14a58152914175b37f' into releases

This commit is contained in:
RedocBot 2017-06-14 09:51:51 +00:00 committed by travis@localhost
commit 26d97dc51b
16 changed files with 898 additions and 728 deletions

View File

@ -6,6 +6,7 @@ branches:
- releases
matrix:
include:
- env: JOB=unit
- env: JOB=e2e-guru
fast_finish: true
allow_failures:

View File

@ -48,7 +48,7 @@ We host the latest and all the previous ReDoc releases on GitHub Pages-based **C
- [Docker Engine](https://docs.docker.com/engine/api/v1.25/)
- [Zuora](https://www.zuora.com/developer/api-reference/)
- [Shopify Draft Orders](https://help.shopify.com/api/draft-orders)
- [Discourse](https://docs.discourse.org)
- [Discourse](http://docs.discourse.org)
- [APIs.guru](https://apis.guru/api-doc/)
## Deployment

View File

@ -1,5 +1,5 @@
dev:
image: node:7
image: node:7-alpine
command: sh -c "npm install; npm start -- --host=0.0.0.0"
ports:
- "9000:9000"

View File

@ -1,7 +1,7 @@
<div class="api-info-wrapper">
<h1>{{info.title}} <span class="api-info-version">({{info.version}})</span></h1>
<p class="download-openapi" *ngIf="specUrl">
Download OpenAPI (fka Swagger) specification:
Download OpenAPI specification:
<a class="openapi-button" download target="_blank" attr.href='{{specUrl}}'> Download </a>
</p>
<p>

View File

@ -68,7 +68,7 @@
</td>
<td class="param-info">
<div>
<span class="param-type {{prop.type}}" [ngClass]="{'with-hint': prop._displayTypeHint, 'tuple': prop._isTuple, 'array': prop._isArray}"
<span class="param-type {{prop.type}}" [ngClass]="{'with-hint': prop._displayTypeHint, 'tuple': prop._isTuple, 'array': (prop._isArray || prop.type == 'array')}"
title="{{prop._displayTypeHint}}"> {{prop._displayType}} {{prop._displayFormat}}
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
</span>

View File

@ -7,7 +7,8 @@
<div class="background">
<div class="background-actual"> </div>
</div>
<div class="menu-content" sticky-sidebar [scrollParent]="options.$scrollParent" [scrollYOffset]="options.scrollYOffset">
<div class="menu-content" sticky-sidebar [disable]="specLoading"
[scrollParent]="options.$scrollParent" [scrollYOffset]="options.scrollYOffset">
<div class="menu-header">
<api-logo> </api-logo>
<redoc-search> </redoc-search>

View File

@ -27,6 +27,10 @@ import {
} from '../../services/';
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';
function getPreOptions() {
return Redoc._preOptions || {};
}
@Component({
selector: 'redoc',
templateUrl: './redoc.html',
@ -49,14 +53,14 @@ export class Redoc extends BaseComponent implements OnInit {
loadingProgress: number;
private element: HTMLElement;
private $parent: Element;
private $refElem: Element;
@Input() specUrl: string;
@HostBinding('class.loading') specLoading: boolean = false;
@HostBinding('class.loading-remove') specLoadingRemove: boolean = false;
private element: HTMLElement;
private $parent: Element;
private $refElem: Element;
constructor(
specMgr: SpecManager,
optionsMgr: OptionsService,
@ -69,7 +73,7 @@ export class Redoc extends BaseComponent implements OnInit {
super(specMgr);
SchemaHelper.setSpecManager(specMgr);
// merge options passed before init
optionsMgr.options = Redoc._preOptions || {};
optionsMgr.options = getPreOptions();
this.element = elementRef.nativeElement;
this.$parent = this.element.parentElement;

View File

@ -86,6 +86,10 @@ pre {
.type-string {
color: #66B16E;
& + a {
color: #66B16E;
text-decoration: underline;
}
}
.callback-function {

View File

@ -15,7 +15,7 @@ describe('Common components', () => {
});
describe('StickySidebar Component', () => {
let builder;
let component;
let component: StickySidebar;
let fixture;
beforeEach(() => {
@ -31,6 +31,7 @@ describe('Common components', () => {
});
it('should start unsticked', () => {
component.disable = true;
spyOn(component, 'stick').and.callThrough();
spyOn(component, 'stickBottom').and.callThrough();
fixture.detectChanges();
@ -41,7 +42,9 @@ describe('Common components', () => {
it('should stick to the top on the next animation frame', (done) => {
spyOn(component, 'stick').and.callThrough();
spyOn(component, 'stickBottom').and.callThrough();
component.disable = true;
fixture.detectChanges();
component.disable = false;
requestAnimationFrame(() => {
expect(component.stick).toHaveBeenCalled();
expect(component.stickBottom).toHaveBeenCalled();

View File

@ -1,17 +1,18 @@
'use strict';
import { Directive, ElementRef, Input, OnInit, OnDestroy } from '@angular/core';
import { Directive, ElementRef, Input, OnInit, OnDestroy, OnChanges} from '@angular/core';
import { BrowserDomAdapter as DOM } from '../../../utils/browser-adapter';
@Directive({
selector: '[sticky-sidebar]'
})
export class StickySidebar implements OnInit, OnDestroy {
export class StickySidebar implements OnInit, OnDestroy, OnChanges {
$element: any;
cancelScrollBinding: any;
$redocEl: any;
@Input() scrollParent:any;
@Input() scrollYOffset:any;
@Input() disable:any;
constructor(elementRef:ElementRef) {
this.$element = elementRef.nativeElement;
@ -33,14 +34,16 @@ export class StickySidebar implements OnInit, OnDestroy {
updatePosition() {
var stuck = false;
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) {
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop && !this.disable) {
this.stick();
stuck = true;
} else {
this.unstick();
}
if ( this.scrollY + window.innerHeight - this.scrollYOffset() >= this.$redocEl.scrollHeight) {
if ( this.scrollY + window.innerHeight - this.scrollYOffset()
>= this.$redocEl.scrollHeight && !this.disable) {
this.stickBottom();
stuck = true;
} else {
@ -86,6 +89,11 @@ export class StickySidebar implements OnInit, OnDestroy {
requestAnimationFrame(() => this.updatePosition());
}
ngOnChanges() {
if (!this.$redocEl || this.disable) return;
this.updatePosition();
}
ngOnDestroy() {
this.unbind();
}

View File

@ -42,7 +42,7 @@ function valueToHTML(value) {
} else if (valueType === 'number') {
output += decorateWithSpan(value, 'type-number');
} else if (valueType === 'string') {
if (/^(http|https):\/\/[^\\s]+$/.test(value)) {
if (/^(http|https):\/\/[^\s]+$/.test(value)) {
output += decorateWithSpan('"', 'type-string') + '<a href="' + value + '">' + htmlEncode(value) + '</a>' +
decorateWithSpan('"', 'type-string');
} else {

View File

@ -8,13 +8,12 @@ import {
FormDataParameter,
Spec,
Response
} from '@types/swagger-schema-official';
} from 'swagger-schema-official';
export interface RedocInjectedPointer {
_pointer?: string;
}
export interface SwaggerOperation extends Operation, RedocInjectedPointer {}
export interface SwaggerBodyParameter extends BodyParameter, RedocInjectedPointer {}
export interface SwaggerHeaderParameter extends HeaderParameter, RedocInjectedPointer {}

View File

@ -1,7 +1,7 @@
{
"name": "redoc",
"description": "Swagger-generated API Reference Documentation",
"version": "1.16.0",
"version": "1.16.1",
"repository": {
"type": "git",
"url": "git://github.com/Rebilly/ReDoc"
@ -60,7 +60,7 @@
"@types/jasmine": "^2.5.47",
"@types/requirejs": "^2.1.29",
"@types/should": "^8.3.0",
"@types/swagger-schema-official": "^2.0.4",
"@types/swagger-schema-official": "^2.0.5",
"@types/webpack": "^2.2.15",
"angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^3.1.3",
@ -94,7 +94,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"mark.js": "github:julmot/mark.js",
"node-sass": "^4.5.2",
"node-sass": "^4.5.3",
"openapi-sampler": "^0.4.1",
"phantomjs-prebuilt": "^2.1.14",
"prismjs": "^1.5.1",
@ -113,6 +113,7 @@
"stream-http": "^2.7.0",
"string-replace-webpack-plugin": "^0.1.3",
"style-loader": "^0.17.0",
"swagger-schema-official": "^2.0.0-bab6bed",
"ts-helpers": "^1.1.1",
"tslint": "^5.2.0",
"typescript": "^2.3.2",

View File

@ -11,7 +11,8 @@
"types": [
"jasmine",
"should",
"webpack"
"webpack",
"swagger-schema-official"
],
"outDir": "dist",
"lib": [

View File

@ -19,7 +19,8 @@
"dom"
],
"types": [
"webpack"
"webpack",
"swagger-schema-official"
]
},
"exclude": [

1557
yarn.lock

File diff suppressed because it is too large Load Diff