mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-18 10:50:32 +03:00
Revert "fix: remove unused hide-hostname option"
This reverts commit 7031176330
.
This commit is contained in:
parent
0323551ca1
commit
fa9b634126
|
@ -136,6 +136,7 @@ ReDoc makes use of the following [vendor extensions](http://swagger.io/specifica
|
||||||
* **function**: A getter function. Must return a number representing the offset (in pixels);
|
* **function**: A getter function. Must return a number representing the offset (in pixels);
|
||||||
* `suppress-warnings` - if set, warnings are not rendered at the top of documentation (they still are logged to the console).
|
* `suppress-warnings` - if set, warnings are not rendered at the top of documentation (they still are logged to the console).
|
||||||
* `lazy-rendering` - if set, enables lazy rendering mode in ReDoc. This mode is useful for APIs with big number of operations (e.g. > 50). In this mode ReDoc shows initial screen ASAP and then renders the rest operations asynchronously while showing progress bar on the top. Check out the [demo](\\rebilly.github.io/ReDoc) for the example.
|
* `lazy-rendering` - if set, enables lazy rendering mode in ReDoc. This mode is useful for APIs with big number of operations (e.g. > 50). In this mode ReDoc shows initial screen ASAP and then renders the rest operations asynchronously while showing progress bar on the top. Check out the [demo](\\rebilly.github.io/ReDoc) for the example.
|
||||||
|
* `hide-hostname` - if set, the protocol and hostname is not shown in the method definition.
|
||||||
* `expand-responses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expand-responses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time.
|
* `expand-responses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expand-responses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time.
|
||||||
|
|
||||||
## Advanced usage
|
## Advanced usage
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { getChildDebugElement } from '../../../tests/helpers';
|
||||||
|
|
||||||
import { EndpointLink } from './endpoint-link';
|
import { EndpointLink } from './endpoint-link';
|
||||||
import { SpecManager } from '../../utils/spec-manager';
|
import { SpecManager } from '../../utils/spec-manager';
|
||||||
|
import { OptionsService } from '../../services/';
|
||||||
|
|
||||||
describe('Redoc components', () => {
|
describe('Redoc components', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -20,9 +21,11 @@ describe('Redoc components', () => {
|
||||||
let builder;
|
let builder;
|
||||||
let component: EndpointLink;
|
let component: EndpointLink;
|
||||||
let specMgr: SpecManager;
|
let specMgr: SpecManager;
|
||||||
|
let opts: OptionsService;
|
||||||
|
|
||||||
beforeEach(async(inject([SpecManager], (_specMgr) => {
|
beforeEach(async(inject([SpecManager, OptionsService], (_specMgr, _opts) => {
|
||||||
specMgr = _specMgr;
|
specMgr = _specMgr;
|
||||||
|
opts = _opts;
|
||||||
})));
|
})));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -44,7 +47,7 @@ describe('Redoc components', () => {
|
||||||
};
|
};
|
||||||
specMgr.init();
|
specMgr.init();
|
||||||
|
|
||||||
component = new EndpointLink(specMgr);
|
component = new EndpointLink(specMgr, opts);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should replace // with appropriate protocol', () => {
|
it('should replace // with appropriate protocol', () => {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { Component, ChangeDetectionStrategy, Input, OnInit, HostListener, HostBinding} from '@angular/core';
|
import { Component, ChangeDetectionStrategy, Input, OnInit, HostListener, HostBinding} from '@angular/core';
|
||||||
import { BaseComponent, SpecManager } from '../base';
|
import { BaseComponent, SpecManager } from '../base';
|
||||||
import { trigger, state, animate, transition, style } from '@angular/core';
|
import { trigger, state, animate, transition, style } from '@angular/core';
|
||||||
|
import { OptionsService } from '../../services/';
|
||||||
|
|
||||||
export interface ServerInfo {
|
export interface ServerInfo {
|
||||||
description: string;
|
description: string;
|
||||||
|
@ -38,7 +39,7 @@ export class EndpointLink implements OnInit {
|
||||||
this.expanded = !this.expanded;
|
this.expanded = !this.expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(public specMgr:SpecManager) {
|
constructor(public specMgr:SpecManager, public optionsService: OptionsService) {
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +61,11 @@ export class EndpointLink implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseUrl():string {
|
getBaseUrl():string {
|
||||||
return this.specMgr.apiUrl;
|
if (this.optionsService.options.hideHostname) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return this.specMgr.apiUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
|
@ -13,6 +13,7 @@ const OPTION_NAMES = new Set([
|
||||||
'disableLazySchemas',
|
'disableLazySchemas',
|
||||||
'specUrl',
|
'specUrl',
|
||||||
'suppressWarnings',
|
'suppressWarnings',
|
||||||
|
'hideHostname',
|
||||||
'lazyRendering',
|
'lazyRendering',
|
||||||
'expandResponses'
|
'expandResponses'
|
||||||
]);
|
]);
|
||||||
|
@ -22,6 +23,7 @@ interface Options {
|
||||||
disableLazySchemas?: boolean;
|
disableLazySchemas?: boolean;
|
||||||
specUrl?: string;
|
specUrl?: string;
|
||||||
suppressWarnings?: boolean;
|
suppressWarnings?: boolean;
|
||||||
|
hideHostname?: boolean;
|
||||||
lazyRendering?: boolean;
|
lazyRendering?: boolean;
|
||||||
expandResponses?: Set<string> | 'all';
|
expandResponses?: Set<string> | 'all';
|
||||||
$scrollParent?: HTMLElement | Window;
|
$scrollParent?: HTMLElement | Window;
|
||||||
|
@ -87,6 +89,7 @@ export class OptionsService {
|
||||||
|
|
||||||
if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;
|
if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;
|
||||||
if (isString(this._options.suppressWarnings)) this._options.suppressWarnings = true;
|
if (isString(this._options.suppressWarnings)) this._options.suppressWarnings = true;
|
||||||
|
if (isString(this._options.hideHostname)) this._options.hideHostname = true;
|
||||||
if (isString(this._options.lazyRendering)) this._options.lazyRendering = true;
|
if (isString(this._options.lazyRendering)) this._options.lazyRendering = true;
|
||||||
if (isString(this._options.expandResponses)) {
|
if (isString(this._options.expandResponses)) {
|
||||||
let str = this._options.expandResponses as string;
|
let str = this._options.expandResponses as string;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user