0

The request body is JSON format and like this:

{
 "subject": "email title",
 "body": "email message",
 "metadata" {
    "key1" : "123"
    "key2" : "345"
 }
}

The problem is the value of metadata is a map (object), and the elements are not defined. Users can give any key-value pair in the metadata as they need, as long as its string. I'm writing a swagger openapi file to define that -- any key-value pair in the metadata should be string -- but I don't know how to. Here's what I have:

subject:
  type: string
body:
  type: string
metadata:
  type: object
  items:
    type: string

The thought is I want to check if every element under metadata is string, but this is not working. I'm pretty new on swagger, and I'd appreciate any help!

Meilan
  • 349
  • 2
  • 11

0 Answers0