我正在使用NelmioApiDocBundle来记录我的API。 如何在注释中强制执行验证?

So I'm using NelmioApiDocBundle to document my API in swagger format.

When i go to mydomain.com/api/doc I can see the documentation and it's fine. But for example I'm setting the query parameter (test_query1) as required, and when I call the API without this query it ignores this parameter and responds with 200. How can I force the API to respond with an error if test_query1 is not passed, without coding in the API?

/**
 * Test Controller to check OpenAPI specification
 *
 * This call prints ID provided in path
 *
 * @Route("/api/{id}/print", methods={"GET"})
 * @SWG\Response(
 *     response=200,
 *     description="ID found",
 *     @SWG\Schema(
 *         type="integer"
 *     )
 * )
 * @SWG\Parameter(
 *     name="test_query1",
 *     in="query",
 *     required=true,
 *     type="string",
 *     description="Test Query"
 * )
 * @SWG\Parameter(
 *     name="id",
 *     in="path",
 *     type="integer",
 *     description="id"
 * )
 */