代码之家  ›  专栏  ›  技术社区  ›  Vincent Decaux

Swagger PHP&OA3-发送简单表单数据

  •  0
  • Vincent Decaux  · 技术社区  · 6 年前

    我使用Laravel+Swagger+OpenAPI3来创建一个API。

    我想简单地使用经典的登录服务,目前我有:

    /**
     * Get a JWT via given credentials.
     *
     * @OA\Post(
     *     path="/login/login",
     *     tags={"Auth"},
     *     summary="Post login credentials",
     *     @OA\RequestBody(
     *          description= "Provide auth credentials",
     *          required=true,
     *          @OA\JsonContent(
     *              type="object",
     *              @OA\Property(property="email", type="string"),
     *              @OA\Property(property="password", type="string")
     *          )
     *     ),
     *     @OA\Response(
     *         response=200,
     *         description="get token",
     *      ),
     *    )
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function login()
    {
        // .....
    

    这没问题,但我如何在这里使用formData?看医生: https://swagger.io/docs/specification/describing-request-body/ ,我看到他们使用表单url编码,但我如何在PHP注释中翻译它?

    0 回复  |  直到 6 年前