1

How to write Swagger documentation for requests in body without model referencing?

e.g:

@SWG\Parameter( 
    name="date",
    in="body",
    content="application/json",
    type="object",
    {custom written JSON}
)

I have tried to do it in description, but that is not going to work because it have to be shown in Edit Value field.

Similar for requests, too.

I have searched google, but found no solution.
Is something like that possible?

Bengall
  • 1,267
  • 2
  • 9
  • 13

1 Answers1

1

You can do it but in not very obvious way. This works for me:

/**
 * @SWG\Get(
 *  path="/route",
 *  tags={"tag"},
 *  @SWG\Response(
 *      response="200",
 *      description="Simple list of name and value pairs ",
 *      @SWG\Schema(
 *          type="array",
 *          @SWG\Items(
 *                  @SWG\Property(
 *                      property="id",
 *                      type="string"
 *                  ),
 *                  @SWG\Property(
 *                      property="name",
 *                      type="string"
 *                  )
 *          )
 *      )
 *  )
 * )
 */
Karol Samborski
  • 2,757
  • 1
  • 11
  • 18
  • That works, but how would I do it with values, something like this: { "data": { "type": "success", "id": "734234" } } I've tried with description, but no luck. – Bengall Dec 02 '18 at 19:35