hapi-swagger
hapi-swagger copied to clipboard
Ref
Context
- *hapi-swgger 7.4.0 *:
What are you trying to achieve or the steps to reproduce ?
{
path: '/bar/arrays',
method: 'POST',
config: {
handler: function () { },
tags: ['api'],
response: {
schema: Joi.array()
.items(
Joi.array()
.items(
Joi.object({ bar: Joi.string() })
.label('FooArrObj')
)
.label('FooArr')
)
.label('FooArrParent')
},
validate: {
payload: Joi.array()
.items(
Joi.array()
.items(
Joi.object({ bar: Joi.string() })
.label('FooArrObj')
)
.label('FooArr')
)
.label('FooArrParent')
}
}
}
What result did you get?
swagger.json generates:
paths: {
/bar/arrays: {
post: {
operationId: "postBarArrays",
parameters: [{ in: "body",
name: "body",
schema: {
type: "array",
$ref: "#/definitions/FooArrParent"
}
}],
tags: [
"bar"
],
responses: {
200: {
schema: {
$ref: "#/definitions/FooArrParent",
type: "array"
},
description: "Successful"
}
}
}
}
},
definitions: {
FooArrObj: {
type: "object",
properties: {
bar: {
type: "string"
}
}
},
FooArr: {
type: "array",
items: {
$ref: "#/definitions/FooArrObj",
type: "object"
}
},
FooArrParent: {
type: "array",
items: {
$ref: "#/definitions/FooArr",
type: "array"
}
}
}
What did you expect ?
If it references, why is type in items block? Am i doing something wrong or should it be there?
Indre