mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-24 09:33:44 +03:00
Merge commit 'cfc14c8c7a545a548f0d4b14a58152914175b37f' into releases
This commit is contained in:
commit
26d97dc51b
|
@ -6,6 +6,7 @@ branches:
|
||||||
- releases
|
- releases
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- env: JOB=unit
|
||||||
- env: JOB=e2e-guru
|
- env: JOB=e2e-guru
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
|
|
@ -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/)
|
- [Docker Engine](https://docs.docker.com/engine/api/v1.25/)
|
||||||
- [Zuora](https://www.zuora.com/developer/api-reference/)
|
- [Zuora](https://www.zuora.com/developer/api-reference/)
|
||||||
- [Shopify Draft Orders](https://help.shopify.com/api/draft-orders)
|
- [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/)
|
- [APIs.guru](https://apis.guru/api-doc/)
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
dev:
|
dev:
|
||||||
image: node:7
|
image: node:7-alpine
|
||||||
command: sh -c "npm install; npm start -- --host=0.0.0.0"
|
command: sh -c "npm install; npm start -- --host=0.0.0.0"
|
||||||
ports:
|
ports:
|
||||||
- "9000:9000"
|
- "9000:9000"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="api-info-wrapper">
|
<div class="api-info-wrapper">
|
||||||
<h1>{{info.title}} <span class="api-info-version">({{info.version}})</span></h1>
|
<h1>{{info.title}} <span class="api-info-version">({{info.version}})</span></h1>
|
||||||
<p class="download-openapi" *ngIf="specUrl">
|
<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>
|
<a class="openapi-button" download target="_blank" attr.href='{{specUrl}}'> Download </a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="param-info">
|
<td class="param-info">
|
||||||
<div>
|
<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}}
|
title="{{prop._displayTypeHint}}"> {{prop._displayType}} {{prop._displayFormat}}
|
||||||
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
|
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
<div class="background">
|
<div class="background">
|
||||||
<div class="background-actual"> </div>
|
<div class="background-actual"> </div>
|
||||||
</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">
|
<div class="menu-header">
|
||||||
<api-logo> </api-logo>
|
<api-logo> </api-logo>
|
||||||
<redoc-search> </redoc-search>
|
<redoc-search> </redoc-search>
|
||||||
|
|
|
@ -27,6 +27,10 @@ import {
|
||||||
} from '../../services/';
|
} from '../../services/';
|
||||||
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';
|
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';
|
||||||
|
|
||||||
|
function getPreOptions() {
|
||||||
|
return Redoc._preOptions || {};
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redoc',
|
selector: 'redoc',
|
||||||
templateUrl: './redoc.html',
|
templateUrl: './redoc.html',
|
||||||
|
@ -49,14 +53,14 @@ export class Redoc extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
loadingProgress: number;
|
loadingProgress: number;
|
||||||
|
|
||||||
private element: HTMLElement;
|
|
||||||
private $parent: Element;
|
|
||||||
private $refElem: Element;
|
|
||||||
|
|
||||||
@Input() specUrl: string;
|
@Input() specUrl: string;
|
||||||
@HostBinding('class.loading') specLoading: boolean = false;
|
@HostBinding('class.loading') specLoading: boolean = false;
|
||||||
@HostBinding('class.loading-remove') specLoadingRemove: boolean = false;
|
@HostBinding('class.loading-remove') specLoadingRemove: boolean = false;
|
||||||
|
|
||||||
|
private element: HTMLElement;
|
||||||
|
private $parent: Element;
|
||||||
|
private $refElem: Element;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
specMgr: SpecManager,
|
specMgr: SpecManager,
|
||||||
optionsMgr: OptionsService,
|
optionsMgr: OptionsService,
|
||||||
|
@ -69,7 +73,7 @@ export class Redoc extends BaseComponent implements OnInit {
|
||||||
super(specMgr);
|
super(specMgr);
|
||||||
SchemaHelper.setSpecManager(specMgr);
|
SchemaHelper.setSpecManager(specMgr);
|
||||||
// merge options passed before init
|
// merge options passed before init
|
||||||
optionsMgr.options = Redoc._preOptions || {};
|
optionsMgr.options = getPreOptions();
|
||||||
|
|
||||||
this.element = elementRef.nativeElement;
|
this.element = elementRef.nativeElement;
|
||||||
this.$parent = this.element.parentElement;
|
this.$parent = this.element.parentElement;
|
||||||
|
|
|
@ -86,6 +86,10 @@ pre {
|
||||||
|
|
||||||
.type-string {
|
.type-string {
|
||||||
color: #66B16E;
|
color: #66B16E;
|
||||||
|
& + a {
|
||||||
|
color: #66B16E;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.callback-function {
|
.callback-function {
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('Common components', () => {
|
||||||
});
|
});
|
||||||
describe('StickySidebar Component', () => {
|
describe('StickySidebar Component', () => {
|
||||||
let builder;
|
let builder;
|
||||||
let component;
|
let component: StickySidebar;
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -31,6 +31,7 @@ describe('Common components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start unsticked', () => {
|
it('should start unsticked', () => {
|
||||||
|
component.disable = true;
|
||||||
spyOn(component, 'stick').and.callThrough();
|
spyOn(component, 'stick').and.callThrough();
|
||||||
spyOn(component, 'stickBottom').and.callThrough();
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -41,7 +42,9 @@ describe('Common components', () => {
|
||||||
it('should stick to the top on the next animation frame', (done) => {
|
it('should stick to the top on the next animation frame', (done) => {
|
||||||
spyOn(component, 'stick').and.callThrough();
|
spyOn(component, 'stick').and.callThrough();
|
||||||
spyOn(component, 'stickBottom').and.callThrough();
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
|
component.disable = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
component.disable = false;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
expect(component.stick).toHaveBeenCalled();
|
expect(component.stick).toHaveBeenCalled();
|
||||||
expect(component.stickBottom).toHaveBeenCalled();
|
expect(component.stickBottom).toHaveBeenCalled();
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
'use strict';
|
'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';
|
import { BrowserDomAdapter as DOM } from '../../../utils/browser-adapter';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[sticky-sidebar]'
|
selector: '[sticky-sidebar]'
|
||||||
})
|
})
|
||||||
export class StickySidebar implements OnInit, OnDestroy {
|
export class StickySidebar implements OnInit, OnDestroy, OnChanges {
|
||||||
$element: any;
|
$element: any;
|
||||||
cancelScrollBinding: any;
|
cancelScrollBinding: any;
|
||||||
$redocEl: any;
|
$redocEl: any;
|
||||||
@Input() scrollParent:any;
|
@Input() scrollParent:any;
|
||||||
@Input() scrollYOffset:any;
|
@Input() scrollYOffset:any;
|
||||||
|
@Input() disable:any;
|
||||||
|
|
||||||
constructor(elementRef:ElementRef) {
|
constructor(elementRef:ElementRef) {
|
||||||
this.$element = elementRef.nativeElement;
|
this.$element = elementRef.nativeElement;
|
||||||
|
@ -33,14 +34,16 @@ export class StickySidebar implements OnInit, OnDestroy {
|
||||||
|
|
||||||
updatePosition() {
|
updatePosition() {
|
||||||
var stuck = false;
|
var stuck = false;
|
||||||
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) {
|
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop && !this.disable) {
|
||||||
this.stick();
|
this.stick();
|
||||||
stuck = true;
|
stuck = true;
|
||||||
} else {
|
} else {
|
||||||
this.unstick();
|
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();
|
this.stickBottom();
|
||||||
stuck = true;
|
stuck = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -86,6 +89,11 @@ export class StickySidebar implements OnInit, OnDestroy {
|
||||||
requestAnimationFrame(() => this.updatePosition());
|
requestAnimationFrame(() => this.updatePosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnChanges() {
|
||||||
|
if (!this.$redocEl || this.disable) return;
|
||||||
|
this.updatePosition();
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.unbind();
|
this.unbind();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ function valueToHTML(value) {
|
||||||
} else if (valueType === 'number') {
|
} else if (valueType === 'number') {
|
||||||
output += decorateWithSpan(value, 'type-number');
|
output += decorateWithSpan(value, 'type-number');
|
||||||
} else if (valueType === 'string') {
|
} 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>' +
|
output += decorateWithSpan('"', 'type-string') + '<a href="' + value + '">' + htmlEncode(value) + '</a>' +
|
||||||
decorateWithSpan('"', 'type-string');
|
decorateWithSpan('"', 'type-string');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,13 +8,12 @@ import {
|
||||||
FormDataParameter,
|
FormDataParameter,
|
||||||
Spec,
|
Spec,
|
||||||
Response
|
Response
|
||||||
} from '@types/swagger-schema-official';
|
} from 'swagger-schema-official';
|
||||||
|
|
||||||
export interface RedocInjectedPointer {
|
export interface RedocInjectedPointer {
|
||||||
_pointer?: string;
|
_pointer?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface SwaggerOperation extends Operation, RedocInjectedPointer {}
|
export interface SwaggerOperation extends Operation, RedocInjectedPointer {}
|
||||||
export interface SwaggerBodyParameter extends BodyParameter, RedocInjectedPointer {}
|
export interface SwaggerBodyParameter extends BodyParameter, RedocInjectedPointer {}
|
||||||
export interface SwaggerHeaderParameter extends HeaderParameter, RedocInjectedPointer {}
|
export interface SwaggerHeaderParameter extends HeaderParameter, RedocInjectedPointer {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "redoc",
|
"name": "redoc",
|
||||||
"description": "Swagger-generated API Reference Documentation",
|
"description": "Swagger-generated API Reference Documentation",
|
||||||
"version": "1.16.0",
|
"version": "1.16.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/Rebilly/ReDoc"
|
"url": "git://github.com/Rebilly/ReDoc"
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
"@types/jasmine": "^2.5.47",
|
"@types/jasmine": "^2.5.47",
|
||||||
"@types/requirejs": "^2.1.29",
|
"@types/requirejs": "^2.1.29",
|
||||||
"@types/should": "^8.3.0",
|
"@types/should": "^8.3.0",
|
||||||
"@types/swagger-schema-official": "^2.0.4",
|
"@types/swagger-schema-official": "^2.0.5",
|
||||||
"@types/webpack": "^2.2.15",
|
"@types/webpack": "^2.2.15",
|
||||||
"angular2-template-loader": "^0.6.2",
|
"angular2-template-loader": "^0.6.2",
|
||||||
"awesome-typescript-loader": "^3.1.3",
|
"awesome-typescript-loader": "^3.1.3",
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "^2.0.3",
|
"karma-webpack": "^2.0.3",
|
||||||
"mark.js": "github:julmot/mark.js",
|
"mark.js": "github:julmot/mark.js",
|
||||||
"node-sass": "^4.5.2",
|
"node-sass": "^4.5.3",
|
||||||
"openapi-sampler": "^0.4.1",
|
"openapi-sampler": "^0.4.1",
|
||||||
"phantomjs-prebuilt": "^2.1.14",
|
"phantomjs-prebuilt": "^2.1.14",
|
||||||
"prismjs": "^1.5.1",
|
"prismjs": "^1.5.1",
|
||||||
|
@ -113,6 +113,7 @@
|
||||||
"stream-http": "^2.7.0",
|
"stream-http": "^2.7.0",
|
||||||
"string-replace-webpack-plugin": "^0.1.3",
|
"string-replace-webpack-plugin": "^0.1.3",
|
||||||
"style-loader": "^0.17.0",
|
"style-loader": "^0.17.0",
|
||||||
|
"swagger-schema-official": "^2.0.0-bab6bed",
|
||||||
"ts-helpers": "^1.1.1",
|
"ts-helpers": "^1.1.1",
|
||||||
"tslint": "^5.2.0",
|
"tslint": "^5.2.0",
|
||||||
"typescript": "^2.3.2",
|
"typescript": "^2.3.2",
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"types": [
|
"types": [
|
||||||
"jasmine",
|
"jasmine",
|
||||||
"should",
|
"should",
|
||||||
"webpack"
|
"webpack",
|
||||||
|
"swagger-schema-official"
|
||||||
],
|
],
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"types": [
|
"types": [
|
||||||
"webpack"
|
"webpack",
|
||||||
|
"swagger-schema-official"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user