I ended up building the requestarray as a string with a formula. Works fine.
But I still wonder if there's a better solution.
This is an old question, but the information might be helpful for others.
You may need to modify your swagger definition file. In many cases, Swagger creates files that will define sub-objects inline within their parent objects (or even directly within the endpoint), and K2 doesn't like these. For example, Swagger might generate a file with these definitions:
"definitions": {
"RequestBody": {
"type": "object",
"properties": {
"array": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value1": {
"type": "string"
},
"value2": {
"type": "number",
"format": "double"
}
}
}
}
}
}
}
This definition would give you a RequestBody object that can be serialized or deserialized, but it wouldn't give any way to serialize or deserialize the "array" property.
Instead, each "object" type needs to have its own definition, and the parent object needs to have a reference to the sub-object type. This gives the sub-object type a name, which you can then use to find the SmartBroker methods to serialize / serialize to array / serialize add to array.
The following definitions section is functionally identical to the above, but it would create a RequestBodyArray object in the SmartBroker, allowing you to serialize your array without resorting to direct string manipulation:
"definitions": {
"RequestBody": {
"type": "object",
"properties": {
"array": {
"type": "array",
"items": {
"$ref": "#/definitions/RequestBodyArray"
}
}
}
},
"RequestBodyArray": {
"type": "object",
"properties": {
"value1": {
"type": "string"
},
"value2": {
"type": "number",
"format": "double"
}
}
}
}