0

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.

Ani
  • 123
  • 1
  • 1
  • 14
  • 1
    Hi, I'm one of committers of Scalatra. The current Swagger support in Scalatra doesn't support describing the example value of parameters, but adding it in the future version is nice idea. Thanks for your question! – Naoki Takezoe Nov 04 '18 at 15:17
  • Okay thanks @NaokiTakezoe . Yes that would be quite helpful. Please let me know if this is added in Scalatra later. – Ani Nov 13 '18 at 13:45

0 Answers0