forked from influxdata/docs-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-info.cjs
More file actions
37 lines (36 loc) · 1.04 KB
/
set-info.cjs
File metadata and controls
37 lines (36 loc) · 1.04 KB
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
module.exports = SetInfo;
/** @type {import('@redocly/openapi-cli').OasDecorator} */
function SetInfo(data) {
return {
Info: {
leave(info, ctx) {
if(data) {
if(data.hasOwnProperty('title')) {
info.title = data.title;
}
if(data.hasOwnProperty('version')) {
info.version = data.version;
} else {
info['version'] = '';
}
if(data.hasOwnProperty('summary')) {
info.summary = data.summary;
} else {
// Remove summary if not provided.
// info.summary isn't a valid OpenAPI 3.0 property, but it's used by Redocly.
info['summary'] = undefined;
}
if(data.hasOwnProperty('description')) {
info.description = data.description;
}
if(data.hasOwnProperty('license')) {
info.license = data.license;
}
if(data.hasOwnProperty('contact')) {
info.contact = data.contact;
}
}
}
}
}
}