Swagger-php: Add annotations

Created on 14 Nov 2017  路  3Comments  路  Source: zircote/swagger-php

I'm using ReDoc as documentation tool. I would need these vendor extension into my swagger: https://github.com/Rebilly/ReDoc#swagger-vendor-extensions

AFAIK at the moment swagger-php doesn't support these properties. What's the best way to add extra annotation ?

Would you consider a PR that add these annotations ?

Most helpful comment

If you want to output an object for logo instead of a string, you'll also need to define it as an object.

 *     @SWG\Info(
 *         version="1.2.3",
 *         title="Foo API",
 *         x={
 *             "logo": { 
 *                 "url": "https://rebilly.github.io/ReDoc/petstore-logo.png"
 *             }
 *         }
 *     )

All 3 comments

Swagger-PHP has support for vendor extensions, how to use them is documented in the Getting started guide

I had a look but I do not understand how add x-logo.

I added this to my annotations

 *     @SWG\Info(
 *         version="1.2.3",
 *         title="Foo API",
 *         x={"logo":"https://mysite.com/my_logo.svg"}
 *     )

and I get

    "info": {
        "title": "Foo API",
        "version": "1.2.3",
        "x-logo": "https://mysite.com/my_logo.svg"
    }

while AFAIK it should be

    "info": {
        "title": "Foo API",
        "version": "1.2.3",
        "x-logo": {
            "url": "https://mysite.com/my_logo.svg"
        }
    }

If you want to output an object for logo instead of a string, you'll also need to define it as an object.

 *     @SWG\Info(
 *         version="1.2.3",
 *         title="Foo API",
 *         x={
 *             "logo": { 
 *                 "url": "https://rebilly.github.io/ReDoc/petstore-logo.png"
 *             }
 *         }
 *     )
Was this page helpful?
0 / 5 - 0 ratings