Swagger-php: Resource grouping

Created on 1 Jul 2015  路  3Comments  路  Source: zircote/swagger-php

how to I group my resource? right now its just default

Most helpful comment

Yes. In the swagger 2.0 spec tags are used to group operations. Note that the concept of _resource_ disappeared as it was known in swagger 1.* (a grouping entity).

Note that by using multiple tags you can create various groupings to fit you business logic. In swagger-ui this will mean that the same operation will be listed multiple times - once per tag.

_Swagger-php Example:_

    /**
     * @SWG\Post(
     *      tags={"mygroup"},
     *      path="/path/to/operation/{foo}/{bar}",
     *      description="Description here....",
...

_Json:_

...
"paths": {
        "/path/to/operation/{foo}/{bar}": {
            "post": {
                "tags": [
                    "mygroup"
                ],
                "description": "Description here....",
....

All 3 comments

is it tags?

Yes. In the swagger 2.0 spec tags are used to group operations. Note that the concept of _resource_ disappeared as it was known in swagger 1.* (a grouping entity).

Note that by using multiple tags you can create various groupings to fit you business logic. In swagger-ui this will mean that the same operation will be listed multiple times - once per tag.

_Swagger-php Example:_

    /**
     * @SWG\Post(
     *      tags={"mygroup"},
     *      path="/path/to/operation/{foo}/{bar}",
     *      description="Description here....",
...

_Json:_

...
"paths": {
        "/path/to/operation/{foo}/{bar}": {
            "post": {
                "tags": [
                    "mygroup"
                ],
                "description": "Description here....",
....

great, thanks @mcheptea

Was this page helpful?
0 / 5 - 0 ratings