Last active
August 28, 2022 14:29
-
-
Save tchafack/21e297d31466c1f80a5c24046073cbc4 to your computer and use it in GitHub Desktop.
Annotation Open API & Symfony : multipart/form-data requestBody
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ... | |
* | |
* @OA\Schema( | |
* schema="CategoryPost", | |
* type="object", | |
* ... | |
* | |
* @OA\Property( | |
* type="object", | |
* property="parent", | |
* required={"id"}, | |
* @OA\Property(type="integer", property="id", example=12), | |
* ), | |
* ) | |
* | |
*... | |
*/ | |
class Category | |
{ | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController extends AbstractController | |
{ | |
/** | |
* ... | |
* | |
* @OA\Post( | |
* tags={"Categories"}, | |
* path="/api/categories", | |
* description="Create a category for company", | |
* security={ | |
* {"Bearer": {}} | |
* }, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="multipart/form-data", | |
* @OA\Schema(ref="#/components/schemas/CategoryPost"), | |
* ), | |
* ), | |
* | |
* ... | |
* ) | |
* | |
*/ | |
public function __invoke() | |
{ | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll have this :
Postman
Swagger
