Add an example Json in the request body in Swagger dashboard using Scalatra

519 Views Asked by At

I need to add an example Json in the request body in my Swagger dashboard, so that user can just change the required attributes value and make a POST cal using "Try it out" button in Swagger dashboard. Everything else is working fine.Using scalatra-swagger. Here goes my working code snippet:

val saveFormHeaders =
(apiOperation[String]("saveFormHeaders")
  summary "Save a form header"
  notes "POST for new form header"
  parameter bodyParam[String]("body").description("Form header json to save").required  //need the syntax to insert an example JSON for the req body
)

post("/data/formHeader",operation(saveFormHeaders)) {


 **some code**}

enter image description here

I cannot find the exact syntax for adding my example Json in the request body using the above no-annotation swagger scalatra syntax.

0

There are 0 best solutions below