Search code examples
laraveldingo-api

Create multiple @Request in Laravel Dingo API Blueprint Docs


It seems that Laravel Dingo API Blueprint documentation allows to create multiple requests examples. In the docs there is an "identifier", which leads me to believe that you can have multiple examples... What is the syntax to document multiple requests?

This works perfect for a single:

 @Request({"user_mongo_id": "1234567890", "title": "Book", "is_private": "1"}, identifier="Example 1")

Solution

  • The magic is on @Transaction

     * @Transaction({
     *  @Request({"user_mongo_id": "1234567890", "title": "Book", "is_private": "1"}, identifier="Private Gallery"),
     *  @Request({"user_mongo_id": "123456789", "title": "Magazine", "is_private": "0"}, identifier="Public Gallery"),
     * })
    

    https://github.com/dingo/api/wiki/API-Blueprint-Documentation#transaction