forked from rohit-gohri/redocusaurus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.ts
51 lines (46 loc) · 1.22 KB
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as Joi from 'joi';
import type { RawConfig } from '@redocly/openapi-core';
type LayoutProps = {
title?: string;
noFooter?: boolean;
description?: string;
image?: string;
keywords?: string[];
permalink?: string;
wrapperClassName?: string;
searchMetadatas?: {
version?: string;
tag?: string;
};
};
export interface PluginOptions {
id?: string;
spec: string;
url?: string;
route?: string;
layout?: LayoutProps;
debug?: boolean;
themeId?: string;
/**
* Redocly config to bundle file
* @see https://redocly.com/docs/cli/configuration/configuration-file/
*/
config?: string | RawConfig;
}
export interface PluginOptionsWithDefault extends PluginOptions {
debug: boolean;
}
export const DEFAULT_OPTIONS: Omit<PluginOptionsWithDefault, 'spec'> = {
layout: {},
debug: false,
};
export const PluginOptionSchema = Joi.object<PluginOptions>({
id: Joi.string(),
spec: Joi.string(),
url: Joi.string().uri({ allowRelative: true }).optional(),
layout: Joi.any().default(DEFAULT_OPTIONS.layout),
debug: Joi.boolean().default(DEFAULT_OPTIONS.debug),
route: Joi.string().uri({ relativeOnly: true }).optional(),
config: Joi.any().optional(),
themeId: Joi.string().optional(),
});