Forum Discussion

mayurw's avatar
mayurw
New Member
5 years ago

How to set Example values to API request Fields with description?

For Example i have sample api given below 

{
"header": {
"apiversion": "string",
"clientID": "string",
"timeStamp": "string"
},
"request": {}
}

 

I need to add a description to fields. Suppose for API version i need to add ...please provide API version here as description.  How can we do that?

How to add example value to a parameter in swagger?

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi mayurw,

     

    Use the description keyword to specify property descriptions, and the example keyword to specify example values.

    type: object
    properties:
      header:
        type: object
        properties:
          apiversion:
            type: string
            description: Please provide API version here   # <-----
            example: '2'          # <-----
          clientId:
            type: string
            example: abcde12345   # <-----
          timeStamp:
            type: string
      request:
        type: object