Linked Questions

Popular Questions

I'm not even sure if this is remotely possible but I'm trying to update/modify a Swagger file such that I want everything from a specific array in the JSON response payload to be returned as a single string. Here is what the JSON response payload might look like:

{
  "name": "abc123",
  "id": 1234,
  "errors": [
    {
      "field1": [
        "error message1",
        "error message2"
      ],
      "field2": [
        "error message3",
        "error message4"
      ]
      ...
  ]
}

From the above example, I'm hoping to get everything within the 'errors' array as a single string to write out to a file. However, I have no idea what the property names might be for 'field1' or 'field2' and it might change over time. Is it possible to define this in a Swagger definition?

I thought it would be possible if I simply defined the 'errors' property as "type": "string" but it didn't end up returning any values.

Related Questions