Skip to content

Commit 304eac9

Browse files
committed
Fix each-openapi via_allOf
1 parent d3b7afe commit 304eac9

File tree

3 files changed

+183
-1
lines changed

3 files changed

+183
-1
lines changed

lib/helpers/lib/each-openapi-module.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ function child_entries(node) {
137137
format_additionalProperties(node.additionalProperties) ]]
138138
: []
139139

140-
const via_allOf = node.allOf?.flatMap(a => Object.entries(a.properties)) || []
140+
const via_allOf = node.allOf?.flatMap(
141+
a => Object.entries(a.properties || {})) || []
141142

142143
return [...via_properties, ...via_additionalProperties, ...via_allOf]
143144
}

test/fixtures/toc-bootstrap.html

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
<a href="#api">api</a>: {
3+
<a href="#api-admin_interface">admin_interface</a>: "127.0.0.1:4985",
4+
<a href="#api-admin_interface_authentication">admin_interface_authentication</a>: true,
5+
<a href="#api-compress_responses">compress_responses</a>: true,
6+
cors: {
7+
<a href="#api-cors-headers">headers</a>: ["string"...],
8+
<a href="#api-cors-login_origin">login_origin</a>: ["string"...],
9+
<a href="#api-cors-max_age">max_age</a>: 0,
10+
<a href="#api-cors-origin">origin</a>: ["string"...]
11+
},
12+
<a href="#api-enable_advanced_auth_dp">enable_advanced_auth_dp</a>: true,
13+
<a href="#api-hide_product_version">hide_product_version</a>: true,
14+
https: {
15+
<a href="#api-https-tls_cert_path">tls_cert_path</a>: "string",
16+
<a href="#api-https-tls_key_path">tls_key_path</a>: "string",
17+
<a href="#api-https-tls_minimum_version">tls_minimum_version</a>: "tlsv1.2"
18+
},
19+
<a href="#api-idle_timeout">idle_timeout</a>: "90s",
20+
<a href="#api-max_connections">max_connections</a>: 0,
21+
<a href="#api-metrics_interface">metrics_interface</a>: "127.0.0.1:4986",
22+
<a href="#api-metrics_interface_authentication">metrics_interface_authentication</a>: true,
23+
<a href="#api-profile_interface">profile_interface</a>: "string",
24+
<a href="#api-public_interface">public_interface</a>: ":4984",
25+
<a href="#api-read_header_timeout">read_header_timeout</a>: "5s",
26+
<a href="#api-server_read_timeout">server_read_timeout</a>: "string",
27+
<a href="#api-server_write_timeout">server_write_timeout</a>: "string"
28+
},
29+
auth: {
30+
<a href="#auth-bcrypt_cost">bcrypt_cost</a>: 10
31+
},
32+
<a href="#bootstrap">bootstrap</a>: {
33+
<a href="#bootstrap-ca_cert_path">ca_cert_path</a>: "string",
34+
<a href="#bootstrap-config_update_frequency">config_update_frequency</a>: "10s",
35+
<a href="#bootstrap-group_id">group_id</a>: "default",
36+
<a href="#bootstrap-password">password</a>: "string",
37+
<a href="#bootstrap-server">server</a>: "string",
38+
<a href="#bootstrap-server_tls_skip_verify">server_tls_skip_verify</a>: false,
39+
<a href="#bootstrap-use_tls_server">use_tls_server</a>: true,
40+
<a href="#bootstrap-username">username</a>: "string",
41+
<a href="#bootstrap-x509_cert_path">x509_cert_path</a>: "string",
42+
<a href="#bootstrap-x509_key_path">x509_key_path</a>: "string"
43+
},
44+
<a href="#bucket_credentials">bucket_credentials</a>: {
45+
<a href="#bucket_credentials-{bucketname}">{bucketname...}</a>: {
46+
<a href="#bucket_credentials-{bucketname}-password">password</a>: "string",
47+
<a href="#bucket_credentials-{bucketname}-username">username</a>: "string",
48+
<a href="#bucket_credentials-{bucketname}-x509_cert_path">x509_cert_path</a>: "string",
49+
<a href="#bucket_credentials-{bucketname}-x509_key_path">x509_key_path</a>: "string"
50+
}
51+
},
52+
<a href="#database_credentials">database_credentials</a>: {
53+
<a href="#database_credentials-{databasename}">{databasename...}</a>: {
54+
<a href="#database_credentials-{databasename}-password">password</a>: "string",
55+
<a href="#database_credentials-{databasename}-username">username</a>: "string",
56+
<a href="#database_credentials-{databasename}-x509_cert_path">x509_cert_path</a>: "string",
57+
<a href="#database_credentials-{databasename}-x509_key_path">x509_key_path</a>: "string"
58+
}
59+
},
60+
<a href="#heap_profile_collection_threshold">heap_profile_collection_threshold</a>: NaN,
61+
<a href="#heap_profile_disable_collection">heap_profile_disable_collection</a>: false,
62+
<a href="#logging">logging</a>: {
63+
<a href="#logging-audit">audit</a>: {
64+
<a href="#logging-audit-audit_log_file_path">audit_log_file_path</a>: "string",
65+
<a href="#logging-audit-enabled">enabled</a>: false,
66+
<a href="#logging-audit-enabled_events">enabled_events</a>: [0...],
67+
rotation: {
68+
<a href="#logging-audit-rotation-localtime">localtime</a>: false,
69+
<a href="#logging-audit-rotation-max_age">max_age</a>: 6,
70+
<a href="#logging-audit-rotation-max_size">max_size</a>: 100,
71+
<a href="#logging-audit-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
72+
<a href="#logging-audit-rotation-rotation_interval">rotation_interval</a>: "0"
73+
}
74+
},
75+
console: {
76+
77+
},
78+
<a href="#logging-debug">debug</a>: {
79+
<a href="#logging-debug-collation_buffer_size">collation_buffer_size</a>: 1000,
80+
<a href="#logging-debug-enabled">enabled</a>: false,
81+
rotation: {
82+
<a href="#logging-debug-rotation-localtime">localtime</a>: false,
83+
<a href="#logging-debug-rotation-max_age">max_age</a>: 2,
84+
<a href="#logging-debug-rotation-max_size">max_size</a>: 100,
85+
<a href="#logging-debug-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
86+
<a href="#logging-debug-rotation-rotation_interval">rotation_interval</a>: "0"
87+
}
88+
},
89+
<a href="#logging-error">error</a>: {
90+
<a href="#logging-error-collation_buffer_size">collation_buffer_size</a>: 0,
91+
<a href="#logging-error-enabled">enabled</a>: true,
92+
rotation: {
93+
<a href="#logging-error-rotation-localtime">localtime</a>: false,
94+
<a href="#logging-error-rotation-max_age">max_age</a>: 360,
95+
<a href="#logging-error-rotation-max_size">max_size</a>: 100,
96+
<a href="#logging-error-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
97+
<a href="#logging-error-rotation-rotation_interval">rotation_interval</a>: "0"
98+
}
99+
},
100+
<a href="#logging-info">info</a>: {
101+
<a href="#logging-info-collation_buffer_size">collation_buffer_size</a>: 0,
102+
<a href="#logging-info-enabled">enabled</a>: true,
103+
rotation: {
104+
<a href="#logging-info-rotation-localtime">localtime</a>: false,
105+
<a href="#logging-info-rotation-max_age">max_age</a>: 6,
106+
<a href="#logging-info-rotation-max_size">max_size</a>: 100,
107+
<a href="#logging-info-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
108+
<a href="#logging-info-rotation-rotation_interval">rotation_interval</a>: "0"
109+
}
110+
},
111+
<a href="#logging-log_file_path">log_file_path</a>: "string",
112+
<a href="#logging-redaction_level">redaction_level</a>: "partial",
113+
<a href="#logging-stats">stats</a>: {
114+
<a href="#logging-stats-collation_buffer_size">collation_buffer_size</a>: 0,
115+
<a href="#logging-stats-enabled">enabled</a>: true,
116+
rotation: {
117+
<a href="#logging-stats-rotation-localtime">localtime</a>: false,
118+
<a href="#logging-stats-rotation-max_age">max_age</a>: 6,
119+
<a href="#logging-stats-rotation-max_size">max_size</a>: 100,
120+
<a href="#logging-stats-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
121+
<a href="#logging-stats-rotation-rotation_interval">rotation_interval</a>: "0"
122+
}
123+
},
124+
<a href="#logging-trace">trace</a>: {
125+
<a href="#logging-trace-collation_buffer_size">collation_buffer_size</a>: 1000,
126+
<a href="#logging-trace-enabled">enabled</a>: false,
127+
rotation: {
128+
<a href="#logging-trace-rotation-localtime">localtime</a>: false,
129+
<a href="#logging-trace-rotation-max_age">max_age</a>: 2,
130+
<a href="#logging-trace-rotation-max_size">max_size</a>: 100,
131+
<a href="#logging-trace-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
132+
<a href="#logging-trace-rotation-rotation_interval">rotation_interval</a>: "0"
133+
}
134+
},
135+
<a href="#logging-warn">warn</a>: {
136+
<a href="#logging-warn-collation_buffer_size">collation_buffer_size</a>: 0,
137+
<a href="#logging-warn-enabled">enabled</a>: true,
138+
rotation: {
139+
<a href="#logging-warn-rotation-localtime">localtime</a>: false,
140+
<a href="#logging-warn-rotation-max_age">max_age</a>: 180,
141+
<a href="#logging-warn-rotation-max_size">max_size</a>: 100,
142+
<a href="#logging-warn-rotation-rotated_logs_size_limit">rotated_logs_size_limit</a>: 1024,
143+
<a href="#logging-warn-rotation-rotation_interval">rotation_interval</a>: "0"
144+
}
145+
}
146+
},
147+
<a href="#max_file_descriptors">max_file_descriptors</a>: 5000,
148+
replicator: {
149+
<a href="#replicator-blip_compression">blip_compression</a>: 0,
150+
<a href="#replicator-max_concurrent_changes_batches">max_concurrent_changes_batches</a>: 2,
151+
<a href="#replicator-max_concurrent_replications">max_concurrent_replications</a>: 0,
152+
<a href="#replicator-max_concurrent_revs">max_concurrent_revs</a>: 5,
153+
<a href="#replicator-max_heartbeat">max_heartbeat</a>: "string"
154+
},
155+
<a href="#unsupported">unsupported</a>: {
156+
<a href="#unsupported-allow_dbconfig_env_vars">allow_dbconfig_env_vars</a>: true,
157+
<a href="#unsupported-diagnostic_interface">diagnostic_interface</a>: "",
158+
http2: {
159+
<a href="#unsupported-http2-enabled">enabled</a>: false
160+
},
161+
<a href="#unsupported-serverless">serverless</a>: {
162+
<a href="#unsupported-serverless-enabled">enabled</a>: true,
163+
<a href="#unsupported-serverless-min_config_fetch_interval">min_config_fetch_interval</a>: "1s"
164+
},
165+
<a href="#unsupported-stats_log_frequency">stats_log_frequency</a>: "1m",
166+
<a href="#unsupported-use_stdlib_json">use_stdlib_json</a>: false,
167+
<a href="#unsupported-use_xattr_config">use_xattr_config</a>: false
168+
}
169+
}

test/test-each-openapi.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ describe('process_toc', function () {
1818
assert.equal(toc, expected)
1919
})
2020

21+
ok('process_toc of Bootstrap schema', function () {
22+
const bundledAdmin = yaml.load(
23+
fs.readFileSync('home/modules/contribute/examples/bundled-admin.yaml', 'utf8'))
24+
25+
const toc = process_toc(bundledAdmin.components.schemas["Startup-config"])
26+
fs.writeFileSync('test/fixtures/toc-bootstrap.html.actual', toc)
27+
28+
const expected = fs.readFileSync('test/fixtures/toc-bootstrap.html', 'utf8')
29+
30+
assert.equal(toc, expected)
31+
})
32+
2133
ok('process_toc simple no type', function () {
2234
const schema = yaml.load(`
2335
properties:

0 commit comments

Comments
 (0)