Nelmioapidocbundle: Could not resolve reference. How to use plain @SWG\Definition annotation without @Model?

Created on 2 Aug 2017  路  5Comments  路  Source: nelmio/NelmioApiDocBundle

Hi, I have definition

/**
 * @SWG\Definition(
 *     definition="validation_error",
 *     type="object",
 *     description="Validation error",
 *     properties={
 *         @SWG\Property(
 *             type="string",
 *              property="asdasd",
 *         ),
 *     }
 * )
 */

and I have definition caller

/**
     * Issue new JTW token
     *
     * @SWG\Post(
     *   produces={"application/json"},
     *   tags= {"Security"},
     *   @SWG\Parameter(
     *         name="Authentication ",
     *         in="body",
     *         description="Getting JWT token by sending email and password",
     *         type="json",
     *         @SWG\Items(type="string"),
     *         collectionFormat="multi",
     *         @SWG\Schema(
     *              @SWG\Property(property="email",  type="string",  ),
     *              @SWG\Property(property="password",  type="string",  ),
     *          ),
     *   ),
     *   @SWG\Response(
     *     response = Response::HTTP_OK,
     *     description ="Obtain new token",
     *     schema=@SWG\Schema(
     *              @SWG\Property(property="token", type="string",),
     *          ),
     *   ),
     *   @SWG\Response(
     *     response = Response::HTTP_BAD_REQUEST,
     *     description="Get Bad Request ",
     *     schema=@SWG\Schema(ref="#/definitions/validation_error"),
     *   ),
     * )
     *
     *
     * @Route("/token", methods={"POST"})
     */

somehow it's give me error

Could not resolve reference: #/definitions/validation_error

any thoughts about why I can not connect them ?
thanks =)

Most helpful comment

The documentation is not good. That's all. Though, I am looking forward to it. Can someone provide some help using definition in schema object.

All 5 comments

This bundle does only parse annotations in controllers. Instead of using @SWG\Definition, if you want to manually describe a model, you should add a definition in your config under nelmio_api_doc.documentation.

Very poor documentation. Can someone please provide a working Example of how to use defintions. Tried adding it in config.yml but with no success.

very poor comment. you can use something else if you don't like the bundle, its free and open source, after all.

The documentation is not good. That's all. Though, I am looking forward to it. Can someone provide some help using definition in schema object.

Was this page helpful?
0 / 5 - 0 ratings