diff --git a/lib/helpers/lib/each-openapi-module.js b/lib/helpers/lib/each-openapi-module.js
index 2e9d866c20..e05a2b5147 100644
--- a/lib/helpers/lib/each-openapi-module.js
+++ b/lib/helpers/lib/each-openapi-module.js
@@ -137,8 +137,10 @@ function child_entries(node) {
format_additionalProperties(node.additionalProperties) ]]
: []
- const via_allOf = node.allOf?.flatMap(
- a => Object.entries(a.properties || {})) || []
+ // allOf can be nested, so call child_entries recursively
+ const via_allOf = (node.allOf || []).flatMap(subNode =>
+ child_entries(subNode)
+ )
return [...via_properties, ...via_additionalProperties, ...via_allOf]
}
diff --git a/test/fixtures/toc-bootstrap.html b/test/fixtures/toc-bootstrap.html
index 5a9cb908cb..a91f4471fb 100644
--- a/test/fixtures/toc-bootstrap.html
+++ b/test/fixtures/toc-bootstrap.html
@@ -73,7 +73,19 @@
}
},
console: {
-
+ collation_buffer_size: 10,
+ color_enabled: false,
+ enabled: false,
+ file_output: "string",
+ log_keys: ["CRUD,HTTP,Query"...],
+ log_level: "info",
+ rotation: {
+ localtime: false,
+ max_age: 0,
+ max_size: 100,
+ rotated_logs_size_limit: 1024,
+ rotation_interval: "0"
+ }
},
debug: {
collation_buffer_size: 1000,
diff --git a/test/test-each-openapi.js b/test/test-each-openapi.js
index 3573d88189..26ad28c7b8 100644
--- a/test/test-each-openapi.js
+++ b/test/test-each-openapi.js
@@ -310,6 +310,21 @@ describe('child_entries', function () {
['bar', {type: 'number'}]
])
})
+
+ ok('via allOf recursive', function () {
+ assert.deepEqual(
+ child_entries({
+ allOf: [
+ {properties: {'outer': {type: 'string'}}},
+ {allOf: [{properties: {'inner': {type: 'number'}}}]}
+ ]
+ }),
+ [
+ ['outer', {type: 'string'}],
+ ['inner', {type: 'number'}]
+ ])
+ })
+
})
// Helper function to clean up whitespace in strings for comparison
@@ -318,4 +333,4 @@ function assert_equal_no_whitespace (actual, expected) {
assert.equal(
cleanup_whitespace(actual),
cleanup_whitespace(expected))
-}
\ No newline at end of file
+}