new: option to disable authentication auto adding

This commit is contained in:
Roman Hotsiy 2017-04-18 16:39:58 +03:00
parent 0ee1476590
commit 00b304a4be
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 6 additions and 1 deletions

View File

@ -141,6 +141,7 @@ ReDoc makes use of the following [vendor extensions](http://swagger.io/specifica
* `hide-hostname` - if set, the protocol and hostname is not shown in the operation definition. * `hide-hostname` - if set, the protocol and hostname is not shown in the operation 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.
* `required-props-first` - show required properties first ordered in the same order as in `required` array. * `required-props-first` - show required properties first ordered in the same order as in `required` array.
* `no-auto-auth` - do not inject Authentication section automatically
## Advanced usage ## Advanced usage
Instead of adding `spec-url` attribute to the `<redoc>` element you can initialize ReDoc via globally exposed `Redoc` object: Instead of adding `spec-url` attribute to the `<redoc>` element you can initialize ReDoc via globally exposed `Redoc` object:

View File

@ -10,6 +10,7 @@ export class AppStateService {
error = new BehaviorSubject<any>(null); error = new BehaviorSubject<any>(null);
loading = new Subject<boolean>(); loading = new Subject<boolean>();
initialized = new BehaviorSubject<any>(false); initialized = new BehaviorSubject<any>(false);
rightPanelHidden = new BehaviorSubject<any>(false);
searchContainingPointers = new BehaviorSubject<string|null[]>([]); searchContainingPointers = new BehaviorSubject<string|null[]>([]);

View File

@ -16,7 +16,8 @@ const OPTION_NAMES = new Set([
'hideHostname', 'hideHostname',
'lazyRendering', 'lazyRendering',
'expandResponses', 'expandResponses',
'requiredPropsFirst' 'requiredPropsFirst',
'noAutoAuth'
]); ]);
export interface Options { export interface Options {
@ -29,6 +30,7 @@ export interface Options {
expandResponses?: Set<string> | 'all'; expandResponses?: Set<string> | 'all';
$scrollParent?: HTMLElement | Window; $scrollParent?: HTMLElement | Window;
requiredPropsFirst?: boolean; requiredPropsFirst?: boolean;
noAutoAuth?: boolean;
spec?: any; spec?: any;
} }
@ -95,6 +97,7 @@ export class OptionsService {
if (isString(this._options.hideHostname)) this._options.hideHostname = 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.requiredPropsFirst)) this._options.requiredPropsFirst = true; if (isString(this._options.requiredPropsFirst)) this._options.requiredPropsFirst = true;
if (isString(this._options.noAutoAuth)) this._options.noAutoAuth = 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;
if (str === 'all') return; if (str === 'all') return;