API Platform - how to document authentication routes

两盒软妹~` 提交于 2019-12-06 01:12:59

I found the answer thanks to this comment in a Github issue. Since I am using YAML for resource configuration I had to translate, the example for the auth/login endpoint;

App\Entity\User:
  collectionOperations:
  auth:
    route_name: auth
    swagger_context:
      parameters:
        -
          name: username
          required: true
          type: string
          description: "User's username or email address"

        -
          name: password
          required: true
          type: string
          description: "User's password"

      responses:
        200:
          description: "Successful login attempt, returning a new token"
          schema:
            type: object
            required:
              - username
              - password
            properties:
              username:
                type: string

              password:
                type: string

      summary: Performs a login attempt, returning a valid token on success
      consumes:
        - "application/json"
        - "application/ld-json"
      produces:
        - "application/ld-json"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!