I have a project where I have nested objects. I have tried to figure out the correct syntax for nested array. This is something that I have tired (among of the many other things):
parameter name: :measurement, in: :body, schema: {
type: :object,
properties: {
measurement_code: { type: :string },
},
type: :array_of_objects,
measure: { type: :array },
items: {
value: { type: :integer }
name: { type: :string }
id: { type: :integer }
},
required: []
}
The example data that I am sending:
{"measurement_code"=>"918031199-7",
:measure=>
[
{
"id": 1,
"value": 8049,
"name": "Temporibus quam et ipsum blanditiis hic."
},
{
"id": 2,
"value": 76060,
"name": "Sint omnis."
}]
}
}
This works as the rswag syntax for array of objects:
properties: {
measurement_code: { type: :string },
measure: {
type: :array,
items: {
properties: {
value: { type: :integer },
name: { type: :string },
id: { type: :integer }
}
},
},
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With