Expected allOf item to be an array or object
ozum opened this issue · 1 comments
ozum commented
Hi,
Using this OpenApi file, I'm trying to use allOf
, in put
handler from organizations/{id}.js
file, but got error below:
.../hapi-openapi.js: Expected allOf item to be an array or object.
AssertionError [ERR_ASSERTION]: Expected allOf item to be an array or object.
at new AssertionError (internal/assert.js:268:11)
at Object.exports.assert (.../node_modules/hoek/lib/index.js:736:11)
at .../node_modules/enjoi/lib/enjoi.js:187:18
Here is where I tracked this up to enjoi
in a simplified example:
const Enjoi = require("enjoi");
const schema = Enjoi({
title: "Organization Input",
allOf: [
{
title: "Organization Common",
allOf: [
{
type: "object",
properties: { name: { type: "string", maxLength: 40 }, billingAddress: { type: "string", maxLength: 100 } },
required: ["name"],
},
{
type: "object",
title: "Phone Number",
properties: { phoneCountryCode: { type: "string", minLength: 1 } },
required: ["phoneCountryCode"],
},
],
},
],
});
enjoi
expects type
key, but AFAIK using allOf
a few levels deep is written like that in OpenAPI. My design file seems valid according to OpenAPI (swagger) editor.
Any help?
Kind Regards,
tlivings commented
This issue is in Joi and will be fixed with the merge of tlivings/enjoi#54
Closing here since this isn't a hapi-openapi error.