API Platform - how to document authentication routes API Platform - how to document authentication routes symfony symfony

API Platform - how to document authentication routes


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"


Update: its openapi_contex instead of swagger_contex for openapi/swagger v3.