mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-28 03:23:44 +03:00
Merge commit 'dd686004766a2cdd54dc733cb4d27b258c055e46' into releases
This commit is contained in:
commit
5c7c28d6d8
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,3 +1,22 @@
|
||||||
|
# 1.2.0 (2016-08-30)
|
||||||
|
### Bug fixes
|
||||||
|
* Fix sticky sidebar top sticking (#75)
|
||||||
|
* Fix array inside objects if referenced directly (#84)
|
||||||
|
* Add banner to the bundle file (#89)
|
||||||
|
* Fix broken additionalProperties
|
||||||
|
* Fix version render issue (extra "v" letter)
|
||||||
|
|
||||||
|
### Features/Improvements
|
||||||
|
* Change the way discriminator is rendered
|
||||||
|
* Created CDN major release 1.x.x (#87)
|
||||||
|
* Smaller bundle size (371KB gzipped)
|
||||||
|
* Better start-up time due to [AoT](http://blog.mgechev.com/2016/08/14/ahead-of-time-compilation-angular-offline-precompilation/)
|
||||||
|
|
||||||
|
### Code refactoring
|
||||||
|
* Moved build-system to Webpack
|
||||||
|
* Moved to latest Typescript + get rid of typings
|
||||||
|
* Upgrade to the latest Angular2 RC.5
|
||||||
|
|
||||||
# 1.1.2 (2016-08-21)
|
# 1.1.2 (2016-08-21)
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
* Revert "Fix markdown newlines to be GFM" (#82)
|
* Revert "Fix markdown newlines to be GFM" (#82)
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
We host latest and all the previous ReDoc releases on GitHub Pages-based **CDN**:
|
We host latest and all the previous ReDoc releases on GitHub Pages-based **CDN**:
|
||||||
- `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js
|
- particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js
|
||||||
- particular release, e.g. `v0.16.1`: https://rebilly.github.io/ReDoc/releases/v0.16.0/redoc.min.js
|
- `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js
|
||||||
|
- `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js **[not for production]**
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ ReDoc makes use of the following [vendor extensions](http://swagger.io/specifica
|
||||||
* [`x-logo`](docs/redoc-vendor-extensions.md#x-logo) - is used to specify API logo
|
* [`x-logo`](docs/redoc-vendor-extensions.md#x-logo) - is used to specify API logo
|
||||||
* [`x-traitTag`](docs/redoc-vendor-extensions.md#x-traitTag) - useful for handling out common things like Pagination, Rate-Limits, etc
|
* [`x-traitTag`](docs/redoc-vendor-extensions.md#x-traitTag) - useful for handling out common things like Pagination, Rate-Limits, etc
|
||||||
* [`x-code-samples`](docs/redoc-vendor-extensions.md#x-code-samples) - specify operation code samples
|
* [`x-code-samples`](docs/redoc-vendor-extensions.md#x-code-samples) - specify operation code samples
|
||||||
|
* [`x-nullable`](docs/redoc-vendor-extensions.md#nullable) - mark schema param as a nullable
|
||||||
|
|
||||||
### `<redoc>` tag attributes
|
### `<redoc>` tag attributes
|
||||||
* `spec-url` - relative or absolute url to your spec file;
|
* `spec-url` - relative or absolute url to your spec file;
|
||||||
|
|
|
@ -819,6 +819,7 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
pattern: "^\\+(?:[0-9]-?){6,14}[0-9]$"
|
pattern: "^\\+(?:[0-9]-?){6,14}[0-9]$"
|
||||||
example: +1-202-555-0192
|
example: +1-202-555-0192
|
||||||
|
x-nullable: true
|
||||||
userStatus:
|
userStatus:
|
||||||
description: User status
|
description: User status
|
||||||
type: integer
|
type: integer
|
||||||
|
|
|
@ -106,3 +106,13 @@ yaml
|
||||||
lang: JavaScript
|
lang: JavaScript
|
||||||
source: console.log('Hello World');
|
source: console.log('Hello World');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Schema Object vendor extensions
|
||||||
|
Extends OpenAPI [Schema Object](http://swagger.io/specification/#schemaObject)
|
||||||
|
#### x-code-samples
|
||||||
|
| Field Name | Type | Description |
|
||||||
|
| :------------- | :------: | :---------- |
|
||||||
|
| x-nullable | boolean | marks schema as a nullable |
|
||||||
|
|
||||||
|
###### Usage in ReDoc
|
||||||
|
Schemas marked as `x-nullable` are marked in ReDoc with the label Nullable
|
||||||
|
|
|
@ -63,6 +63,14 @@ $sub-schema-offset: ($bullet-size / 2) + $bullet-margin;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.param-nullable {
|
||||||
|
vertical-align: middle;
|
||||||
|
line-height: $param-name-height;
|
||||||
|
color: #3195a6;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.param-type {
|
.param-type {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: $param-name-height;
|
line-height: $param-name-height;
|
||||||
|
|
|
@ -46,7 +46,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
if (this.optionsService.options.disableLazySchemas) return;
|
if (this.disableLazy) return;
|
||||||
if (this.loaded) return;
|
if (this.loaded) return;
|
||||||
if (this.pointer) {
|
if (this.pointer) {
|
||||||
this._loadAfterSelf();
|
this._loadAfterSelf();
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
|
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
|
||||||
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
|
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
|
||||||
</span>
|
</span>
|
||||||
|
<span *ngIf="schema['x-nullable']" class="param-nullable">Nullable</span>
|
||||||
<div *ngIf="schema.enum" class="param-enum">
|
<div *ngIf="schema.enum" class="param-enum">
|
||||||
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
|
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,6 +71,7 @@
|
||||||
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
|
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="prop._required" class="param-required">Required</span>
|
<span *ngIf="prop._required" class="param-required">Required</span>
|
||||||
|
<span *ngIf="prop['x-nullable']" class="param-nullable">Nullable</span>
|
||||||
<div *ngIf="prop.default">Default: {{prop.default | json}}</div>
|
<div *ngIf="prop.default">Default: {{prop.default | json}}</div>
|
||||||
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
|
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
|
||||||
<span *ngFor="let enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
|
<span *ngFor="let enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
|
||||||
|
|
|
@ -47,12 +47,28 @@ export class JsonSchema extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
this.pointer = activeDescendant.$ref;
|
this.pointer = activeDescendant.$ref;
|
||||||
this.schema = this.specMgr.byPointer(this.pointer);
|
this.schema = this.specMgr.byPointer(this.pointer);
|
||||||
this.schema = this.normalizer.normalize(this.schema, this.normPointer, {omitParent: false});
|
this.schema = this.normalizer.normalize(this.schema, this.normPointer,
|
||||||
|
{resolved: true});
|
||||||
this.preprocessSchema();
|
this.preprocessSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
initDescendants() {
|
initDescendants() {
|
||||||
this.descendants = this.specMgr.findDerivedDefinitions(this.normPointer);
|
this.descendants = this.specMgr.findDerivedDefinitions(this.normPointer);
|
||||||
|
if (!this.descendants.length) return;
|
||||||
|
this.hasDescendants = true;
|
||||||
|
let discriminator = this.schema.discriminator;
|
||||||
|
let discrProperty = this.schema._properties &&
|
||||||
|
this.schema._properties.filter((prop) => prop.name === discriminator)[0];
|
||||||
|
if (discrProperty && discrProperty.enum) {
|
||||||
|
let enumOrder = {};
|
||||||
|
discrProperty.enum.forEach((enumItem, idx) => {
|
||||||
|
enumOrder[enumItem.val] = idx;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.schema._descendants.sort((a, b) => {
|
||||||
|
return enumOrder[a.name] > enumOrder[b.name] ? 1 : -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
this.selectDescendant(0);
|
this.selectDescendant(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +81,7 @@ export class JsonSchema extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
this.applyStyling();
|
this.applyStyling();
|
||||||
|
|
||||||
this.schema = this.normalizer.normalize(this.schema, this.normPointer);
|
this.schema = this.normalizer.normalize(this.schema, this.normPointer, {resolved: true});
|
||||||
this.schema = SchemaHelper.unwrapArray(this.schema, this.normPointer);
|
this.schema = SchemaHelper.unwrapArray(this.schema, this.normPointer);
|
||||||
this.initDescendants();
|
this.initDescendants();
|
||||||
this.preprocessSchema();
|
this.preprocessSchema();
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
--></span>
|
--></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="method.bodyParam">
|
<div>
|
||||||
<br>
|
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam?._pointer">
|
||||||
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam._pointer">
|
|
||||||
</request-samples>
|
</request-samples>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
display: block;
|
display: block;
|
||||||
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
|
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
|
||||||
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host:last-of-type {
|
:host:last-of-type {
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<div class="body-param-description" [innerHtml]="bodyParam.description | marked"></div>
|
<div class="body-param-description" [innerHtml]="bodyParam.description | marked"></div>
|
||||||
<div>
|
<div>
|
||||||
<br>
|
<br>
|
||||||
<json-schema-lazy [isRequestSchema]="true" [auto]="true" pointer="{{bodyParam.pointer}}/schema">
|
<json-schema-lazy [isRequestSchema]="true" [auto]="true" pointer="{{bodyParam._pointer}}/schema">
|
||||||
</json-schema-lazy>
|
</json-schema-lazy>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -40,7 +40,6 @@ export class ParamsList extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
if (paramsMap.body && paramsMap.body.length) {
|
if (paramsMap.body && paramsMap.body.length) {
|
||||||
let bodyParam = paramsMap.body[0];
|
let bodyParam = paramsMap.body[0];
|
||||||
bodyParam.pointer = bodyParam._pointer;
|
|
||||||
this.bodyParam = bodyParam;
|
this.bodyParam = bodyParam;
|
||||||
paramsMap.body = undefined;
|
paramsMap.body = undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
|
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
|
||||||
<schema-sample *ngIf="!samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
<schema-sample *ngIf="schemaPointer && !samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
||||||
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
|
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
|
||||||
<tab tabTitle="JSON">
|
<tab *ngIf="schemaPointer" tabTitle="JSON">
|
||||||
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
||||||
</tab>
|
</tab>
|
||||||
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
|
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { Component, ViewChildren, QueryList, EventEmitter, Input,
|
import { Component, ViewChildren, QueryList, EventEmitter, Input,
|
||||||
ChangeDetectionStrategy, OnInit } from '@angular/core';
|
ChangeDetectionStrategy, OnInit, HostBinding } from '@angular/core';
|
||||||
|
|
||||||
import { BaseComponent, SpecManager } from '../base';
|
import { BaseComponent, SpecManager } from '../base';
|
||||||
import JsonPointer from '../../utils/JsonPointer';
|
import JsonPointer from '../../utils/JsonPointer';
|
||||||
|
@ -18,6 +18,7 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
||||||
@Input() pointer:string;
|
@Input() pointer:string;
|
||||||
@Input() schemaPointer:string;
|
@Input() schemaPointer:string;
|
||||||
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
|
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
|
||||||
|
@HostBinding('attr.hidden') hidden;
|
||||||
|
|
||||||
childTabs: Tabs;
|
childTabs: Tabs;
|
||||||
selectedLang: EventEmitter<any>;
|
selectedLang: EventEmitter<any>;
|
||||||
|
@ -35,8 +36,9 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.schemaPointer = JsonPointer.join(this.schemaPointer, 'schema');;
|
this.schemaPointer = this.schemaPointer ? JsonPointer.join(this.schemaPointer, 'schema') : null;
|
||||||
this.samples = this.componentSchema['x-code-samples'] || [];
|
this.samples = this.componentSchema['x-code-samples'] || [];
|
||||||
|
if (!this.schemaPointer && !this.samples.length) this.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
|
@ -163,7 +163,7 @@ const injectors = {
|
||||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
||||||
} else if (propertySchema.maxLength) {
|
} else if (propertySchema.maxLength) {
|
||||||
range = '<= ' + propertySchema.maxLength;
|
range = '<= ' + propertySchema.maxLength;
|
||||||
} else if (propertySchema.minimum) {
|
} else if (propertySchema.minLength) {
|
||||||
range = '>= ' + propertySchema.minLength;
|
range = '>= ' + propertySchema.minLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,20 @@ export class SchemaNormalizer {
|
||||||
this._dereferencer = new SchemaDereferencer(_schema, this);
|
this._dereferencer = new SchemaDereferencer(_schema, this);
|
||||||
}
|
}
|
||||||
normalize(schema, ptr, opts:any ={}) {
|
normalize(schema, ptr, opts:any ={}) {
|
||||||
opts.omitParent = opts.omitParent !== false;
|
let hasPtr = !!schema.$ref;
|
||||||
|
if (opts.resolved && !hasPtr) this._dereferencer.visit(ptr);
|
||||||
|
|
||||||
if (schema['x-redoc-normalized']) return schema;
|
if (schema['x-redoc-normalized']) return schema;
|
||||||
let res = SchemaWalker.walk(schema, ptr, (subSchema, ptr) => {
|
let res = SchemaWalker.walk(schema, ptr, (subSchema, ptr) => {
|
||||||
let resolved = this._dereferencer.dereference(subSchema, ptr);
|
let resolved = this._dereferencer.dereference(subSchema, ptr);
|
||||||
if (resolved.allOf) {
|
if (resolved.allOf) {
|
||||||
resolved._pointer = resolved._pointer || ptr;
|
resolved._pointer = resolved._pointer || ptr;
|
||||||
resolved = Object.assign({}, resolved);
|
resolved = Object.assign({}, resolved);
|
||||||
AllOfMerger.merge(resolved, resolved.allOf, {omitParent: opts.omitParent});
|
AllOfMerger.merge(resolved, resolved.allOf);
|
||||||
}
|
}
|
||||||
return resolved;
|
return resolved;
|
||||||
});
|
});
|
||||||
|
if (opts.resolved && !hasPtr) this._dereferencer.exit(ptr);
|
||||||
res['x-redoc-normalized'] = true;
|
res['x-redoc-normalized'] = true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -88,12 +91,11 @@ class SchemaWalker {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AllOfMerger {
|
class AllOfMerger {
|
||||||
static merge(into, schemas, opts) {
|
static merge(into, schemas) {
|
||||||
into['x-derived-from'] = [];
|
into['x-derived-from'] = [];
|
||||||
for (let i=0; i < schemas.length; i++) {
|
for (let i=0; i < schemas.length; i++) {
|
||||||
let subSchema = schemas[i];
|
let subSchema = schemas[i];
|
||||||
into['x-derived-from'].push(subSchema._pointer);
|
into['x-derived-from'].push(subSchema._pointer);
|
||||||
if (opts && opts.omitParent && subSchema.discriminator) continue;
|
|
||||||
|
|
||||||
AllOfMerger.checkCanMerge(subSchema, into);
|
AllOfMerger.checkCanMerge(subSchema, into);
|
||||||
|
|
||||||
|
@ -177,6 +179,14 @@ class SchemaDereferencer {
|
||||||
constructor(private _spec: SpecManager, private normalizator: SchemaNormalizer) {
|
constructor(private _spec: SpecManager, private normalizator: SchemaNormalizer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visit($ref) {
|
||||||
|
this._refCouner.visit($ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit($ref) {
|
||||||
|
this._refCouner.exit($ref);
|
||||||
|
}
|
||||||
|
|
||||||
dereference(schema: Reference, pointer:string):any {
|
dereference(schema: Reference, pointer:string):any {
|
||||||
if (!schema || !schema.$ref) return schema;
|
if (!schema || !schema.$ref) return schema;
|
||||||
window['derefCount'] = window['derefCount'] ? window['derefCount'] + 1 : 1;
|
window['derefCount'] = window['derefCount'] ? window['derefCount'] + 1 : 1;
|
||||||
|
|
|
@ -27,10 +27,23 @@ describe('Common components', () => {
|
||||||
expect(component).not.toBeNull();
|
expect(component).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start sticked', () => {
|
it('should start unsticked', () => {
|
||||||
spyOn(component, 'stick').and.callThrough();
|
spyOn(component, 'stick').and.callThrough();
|
||||||
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
expect(component.stick).not.toHaveBeenCalled();
|
||||||
|
expect(component.stickBottom).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should stick to the top on the next VM tick', (done) => {
|
||||||
|
spyOn(component, 'stick').and.callThrough();
|
||||||
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
|
fixture.detectChanges();
|
||||||
|
setTimeout(() => {
|
||||||
expect(component.stick).toHaveBeenCalled();
|
expect(component.stick).toHaveBeenCalled();
|
||||||
|
expect(component.stickBottom).toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stick if scrolled more than scrollYOffset', () => {
|
it('should stick if scrolled more than scrollYOffset', () => {
|
||||||
|
@ -42,6 +55,8 @@ describe('Common components', () => {
|
||||||
component.updatePosition();
|
component.updatePosition();
|
||||||
expect(component.stick).toHaveBeenCalled();
|
expect(component.stick).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: add tests for stickBottom
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,24 @@ export class StickySidebar implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePosition() {
|
updatePosition() {
|
||||||
|
var stuck = false;
|
||||||
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) {
|
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) {
|
||||||
this.stick();
|
this.stick();
|
||||||
|
stuck = true;
|
||||||
} else {
|
} else {
|
||||||
this.unstick();
|
this.unstick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( this.scrollY + window.innerHeight - this.scrollYOffset() >= this.$redocEl.scrollHeight) {
|
||||||
|
this.stickBottom();
|
||||||
|
stuck = true;
|
||||||
|
} else {
|
||||||
|
this.unstickBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stuck) {
|
||||||
|
DOM.setStyle(this.$element, 'position', 'absolute');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stick() {
|
stick() {
|
||||||
|
@ -45,19 +58,33 @@ export class StickySidebar implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
unstick() {
|
unstick() {
|
||||||
DOM.setStyle(this.$element, 'position', 'absolute');
|
|
||||||
DOM.setStyle(this.$element, 'top', '0');
|
DOM.setStyle(this.$element, 'top', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stickBottom() {
|
||||||
|
DOM.setStyle(this.$element, 'position', 'fixed');
|
||||||
|
var offset = this.scrollY + this.scrollParentHeight - (this.$redocEl.scrollHeight + this.$redocEl.offsetTop);
|
||||||
|
DOM.setStyle(this.$element, 'bottom', offset + 'px');
|
||||||
|
}
|
||||||
|
|
||||||
|
unstickBottom() {
|
||||||
|
DOM.setStyle(this.$element, 'bottom', '0');
|
||||||
|
}
|
||||||
|
|
||||||
get scrollY() {
|
get scrollY() {
|
||||||
return (this.scrollParent.pageYOffset != undefined) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop;
|
return (this.scrollParent.pageYOffset != undefined) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get scrollParentHeight() {
|
||||||
|
return (this.scrollParent.innerHeight != undefined) ? this.scrollParent.innerHeight : this.scrollParent.clientHeight;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// FIXME use more reliable code
|
// FIXME use more reliable code
|
||||||
this.$redocEl = this.$element.offsetParent.parentNode || DOM.defaultDoc().body;
|
this.$redocEl = this.$element.offsetParent.parentNode || DOM.defaultDoc().body;
|
||||||
this.bind();
|
this.bind();
|
||||||
this.updatePosition();
|
setTimeout(() => this.updatePosition());
|
||||||
|
//this.updatePosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ValuesPipe implements PipeTransform {
|
||||||
|
|
||||||
@Pipe({ name: 'jsonPointerEscape' })
|
@Pipe({ name: 'jsonPointerEscape' })
|
||||||
export class JsonPointerEscapePipe implements PipeTransform {
|
export class JsonPointerEscapePipe implements PipeTransform {
|
||||||
transform(value) {
|
transform(value:string) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
||||||
|
@ -53,7 +53,7 @@ export class JsonPointerEscapePipe implements PipeTransform {
|
||||||
@Pipe({ name: 'marked' })
|
@Pipe({ name: 'marked' })
|
||||||
export class MarkedPipe implements PipeTransform {
|
export class MarkedPipe implements PipeTransform {
|
||||||
constructor(private sanitizer: DomSanitizationService) {}
|
constructor(private sanitizer: DomSanitizationService) {}
|
||||||
transform(value) {
|
transform(value:string) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
||||||
|
@ -68,7 +68,7 @@ export class MarkedPipe implements PipeTransform {
|
||||||
@Pipe({ name: 'safe' })
|
@Pipe({ name: 'safe' })
|
||||||
export class SafePipe implements PipeTransform {
|
export class SafePipe implements PipeTransform {
|
||||||
constructor(private sanitizer: DomSanitizationService) {}
|
constructor(private sanitizer: DomSanitizationService) {}
|
||||||
transform(value) {
|
transform(value:string) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
||||||
|
@ -109,7 +109,7 @@ export class PrismPipe implements PipeTransform {
|
||||||
|
|
||||||
@Pipe({ name: 'encodeURIComponent' })
|
@Pipe({ name: 'encodeURIComponent' })
|
||||||
export class EncodeURIComponentPipe implements PipeTransform {
|
export class EncodeURIComponentPipe implements PipeTransform {
|
||||||
transform(value) {
|
transform(value:string) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(EncodeURIComponentPipe, value);
|
throw new InvalidPipeArgumentException(EncodeURIComponentPipe, value);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "redoc",
|
"name": "redoc",
|
||||||
"description": "Swagger-generated API Reference Documentation",
|
"description": "Swagger-generated API Reference Documentation",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/Rebilly/ReDoc"
|
"url": "git://github.com/Rebilly/ReDoc"
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
"e2e-server": "http-server -p 3000 tests/e2e",
|
"e2e-server": "http-server -p 3000 tests/e2e",
|
||||||
"e2e-copy": "cp dist/redoc.min.js tests/e2e/",
|
"e2e-copy": "cp dist/redoc.min.js tests/e2e/",
|
||||||
"webdriver": "webdriver-manager update",
|
"webdriver": "webdriver-manager update",
|
||||||
"serve:prod": "NODE_ENV=production npm start"
|
"serve:prod": "NODE_ENV=production npm start",
|
||||||
|
"protractor": "protractor"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"OpenAPI",
|
"OpenAPI",
|
||||||
|
|
|
@ -51,7 +51,8 @@ function verifyNoBrowserErrors() {
|
||||||
if (message.match(/^Unknown property.*Declaration dropped/)) return false;
|
if (message.match(/^Unknown property.*Declaration dropped/)) return false;
|
||||||
if (message.match(/^Error in parsing value for.*Declaration dropped/)) return false;
|
if (message.match(/^Error in parsing value for.*Declaration dropped/)) return false;
|
||||||
if (message.indexOf('The character encoding of the HTML document was not declared') > -1) return false;
|
if (message.indexOf('The character encoding of the HTML document was not declared') > -1) return false;
|
||||||
if (message.match(/addons.manager\s+DEBUG/)) return false;
|
if (message.match(/^\d{13}\s+(DeferredSave|addons)/)) return false;
|
||||||
|
if (message.match(/This site makes use of a SHA-1 Certificate/)) return false;
|
||||||
|
|
||||||
|
|
||||||
if (logEntry.level.value >= LogLevel.INFO) {
|
if (logEntry.level.value >= LogLevel.INFO) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
window.redocError = null;
|
window.redocError = null;
|
||||||
/* init redoc */
|
/* init redoc */
|
||||||
var url = window.location.search.substr(5) || 'http://rebilly.github.io/SwaggerTemplateRepo/swagger.json';
|
var url = window.location.search.substr(5) || 'http://rebilly.github.io/SwaggerTemplateRepo/swagger.json';
|
||||||
Redoc.init(decodeURIComponent(url), {disableLazySchemas: true}).then(function() {}, function(err) {
|
Redoc.init(decodeURIComponent(url), {disableLazySchemas: true, suppressWarnings: true}).then(function() {}, function(err) {
|
||||||
window.redocError = err;
|
window.redocError = err;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user