Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Api Platform custom swagger/openapi context body

$
0
0

I am using Api Platform with Symfony 4, and I want to create a custom endpoint. Everything works fine, but I cannot change 2 things: body and response format (in openapi documentation).

Parameters and responses status codes works just fine.

*          "login"={ *              "route_name"="api_login", *              "method" = "post", *              "openapi_context" = { *                  "parameters" = {}, *                  "body" = { *                      "description" ="Username and password", *                      "schema" = { *                          "type" = "object", *                          "required" = {"email","password"}, *                          "properties" = { *                                   "email" = { *                                      "type" = "string" *                                   }, *                                   "password" = { *                                      "type" = "string" *                                   } *                          } *                      } *                  }, *                  "responses" = { *                      "200" = { *                          "description" = "User logged in", *                          "schema" =  { *                              "type" = "object", *                              "required" = { *                                  "token", *                                  "refresh_token" *                              }, *                              "properties" = { *                                   "token" = { *                                      "type" = "string" *                                   }, *                                   "refresh_token" = { *                                      "type" = "string" *                                   } *                              } *                          } *                      }, *                      "401" = { *                          "description" = "invalid password or email" *                      } *                  }, *                  "summary" = "Login user in application", *                  "consumes" = { *                      "application/json", *                      "text/html", *                   }, *                  "produces" = { *                      "application/json" *                   } *              } *          }

Viewing all articles
Browse latest Browse all 3925

Trending Articles