You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[hrm] Enrich HRM API with FormRequests + API Resources for richer OpenAPI #34
Context. The HRM API (zerp-pk/hrm) is documented via Scramble at /docs/hrm, but its controllers return untyped arrays, so the generated request/response schemas are shallow.
Goal. Add typed FormRequest classes and API Resource classes so Scramble infers rich request bodies and response shapes automatically — no annotations needed.
Checklist.
Add a FormRequest per write endpoint (leave-request, clock-in-out, etc.) with rules()
Add JsonResource classes for the returned models
Type controller return values (: JsonResource / : ResourceCollection)
Re-check /docs/hrm — request/response schemas should now be populated
Level. Easy, high-visibility. Same approach then applies to lead/taskly/support-ticket.
Done across #81 (the shared ApiFormRequest base) and zerp-pk/hrm#5 (HRM FormRequests + Resource).
Two write endpoints now use typed FormRequests, so /docs/hrm shows real request bodies for leave-request and clock-in-out instead of empty ones. The base lives in the app next to ApiResponseTrait, so lead/taskly/support-ticket reuse the same pattern.
One honest correction to the checklist: typing controller returns as a JsonResource does not enrich the response schemas here, because every endpoint answers with the shared {success, message, data} envelope that mobile clients depend on, and Scramble cannot see through that helper. Enriching response schemas means either dropping the envelope (breaks clients) or adding Scramble response annotations. That annotation pass is a clean, non-breaking follow-up if we want it; I did not force a breaking change to tick the box.
The Resource still landed, on its own merit: the leave shape had been hand-copied into the list and create responses and the two had drifted on the missing-attachment fallback (avatar.png vs empty string). They now share one source.
Activity
Add ApiFormRequest base so module APIs get typed request schemas (#34) (
HafizMMoaz commentedon Jul 23, 2026
Done across #81 (the shared ApiFormRequest base) and zerp-pk/hrm#5 (HRM FormRequests + Resource).
Two write endpoints now use typed FormRequests, so /docs/hrm shows real request bodies for leave-request and clock-in-out instead of empty ones. The base lives in the app next to ApiResponseTrait, so lead/taskly/support-ticket reuse the same pattern.
One honest correction to the checklist: typing controller returns as a JsonResource does not enrich the response schemas here, because every endpoint answers with the shared {success, message, data} envelope that mobile clients depend on, and Scramble cannot see through that helper. Enriching response schemas means either dropping the envelope (breaks clients) or adding Scramble response annotations. That annotation pass is a clean, non-breaking follow-up if we want it; I did not force a breaking change to tick the box.
The Resource still landed, on its own merit: the leave shape had been hand-copied into the list and create responses and the two had drifted on the missing-attachment fallback (avatar.png vs empty string). They now share one source.
Changelog for v1.3.1 (#82)