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

[Feature] apiResourceAdditional tag, for documenting responses that using addtional function #414

Merged
merged 2 commits into from
Jan 24, 2022

Conversation

090809
Copy link

@090809 090809 commented Jan 24, 2022

closes #413
doc: knuckleswtf/scribe-docs#11

Description

When user send Resource with additional function, we can use @apiResourceAdditional tag for simultating constants for it

/**
 * @apiResource App\Http\Resources\EventResource
 * @apiResourceModel App\Models\Event
 * @apiResourceAdditional title="Event created" message="Event successful created"
 */
public function store(StoreEventRequest $request): JsonResponse
{
    // ... some create code ...
    return EventResource::make($event)->additional([
        'title' => 'Event created',
        'message' => 'Event successful created',
    ]);
}

pallam added 2 commits January 24, 2022 03:30
@shalvah
Copy link
Contributor

shalvah commented Jan 24, 2022

I generally don't like adding an extra annotation. Ideally this should be an attribute on the @apiResourceModel. but I can see the line getting too long, so I'll let this pass.

@shalvah shalvah merged commit 3183f51 into knuckleswtf:master Jan 24, 2022
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.

Adding additional meta for resource when calling with ApiResource
2 participants