Forum Discussion

blackwj's avatar
blackwj
New Contributor
7 years ago
Solved

Swagger Definition object default value

I'm building a swagger json definitiion for the below xml payload to use within the Swagger UI. Once complete I'll convert it to yaml and import the definition into Swagger UI. I'm having an issue figuring out how to display a default value 'Enter value here' for element 'key'. Where would one place this default value in the below json?

 

<addressElement>
    <key type="RECORD_ID" item="3">Enter value here</key>
</addressElement>

For the above xml, I have the below json definition. How can I add the value 'Enter value here' in the json to be shown as it is in the above xml?

 

"definitions": {
 "addressElement": {
   "type": "object",
   "title": "Address Element",
   "properties": {
     "key": {
       "type": "object",
       "properties": {
         "type":{
           "type": "string",
           "example": "RECORD_ID",
           "xml":{
             "attribute": true
           }
         },
         "item":{
           "type": "integer",
           "format": "int64",
           "example": "3",
           "xml":{
             "attribute": true
           }
         }
       }
     },
   },
   "xml": {
     "name": "addressElement"
   }
 }
} 

 

2 Replies