Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group notation - #33 improvement #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RodriguesZe
Copy link

Added support for Resource Groups, version based.

This implementation is nothing new. It's a combination of the solution provided by #33 and by the need raised in #41.

Basically, it allows having group annotation for a specific documentation version, instead of appearing by default in every version.

With this change, it's mandatory to have a version in the controller comments (see example below). Without it, the methods specified in the controller will not be considered, even if the right documentation version was added.

Following the tests already in place, here's an example of how the group and version resources can be used combined:

/**
 * User Photos Resource.
 *
 * @Group("User")
 * @Versions({"v1", "v2"})
 * @Resource("User Photos", uri="/users/{userId}/photos")
 * @Parameters({
 *      @Parameter("userId", description="ID of user who owns the photos.", type="integer", required=true)
 * })
 */
class UserPhotosResourceStub
{
    /**
     * Show all photos.
     *
     * Show all photos for a given user.
     *
     * @Get("/{?sort,order}")
     * @Parameters({
     *      @Parameter("sort", description="Column to sort by.", type="string", default="name"),
     *      @Parameter("order", description="Order of results, either `asc` or `desc`.", type="string", default="desc", members={
     *          @Member("asc", description="Ascending order."),
     *          @Member("desc", description="Descending order."),
     *      })
     * })
     * @Versions({"v1", "v2"})
     * @Response(200, body={
     *      {"id": 1, "name": "photo", "src": "path/to/cool/photo.jpg"}
     * })
     */
    public function index($userId)
    {
        //
    }
}

@philipborbon
Copy link

Will resource group be supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants