Skip to content

v0.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 09 Sep 21:12

First stable release.

Added

  • Model resources. #[RestResource(model: …)] on a controller extending
    RestController registers index, show, store, update and
    destroy. only and except switch individual actions on or off.
    update answers to both PUT and PATCH with one set of rules.
  • Job APIs. #[RestJob(key: …)] on a controller extending
    JobController registers a POST that starts a run and returns its id, a
    GET that reports the progress, and an optional DELETE that cancels it.
    The counters are read live from Laravel's batch, so the jobs report
    nothing themselves, and total may grow while the run is going.
  • Typed job payloads. JobData carries the input of a run, JobResult
    is filled in by the chain. updateResult() writes under a row lock, so
    jobs running at the same time cannot overwrite each other.
  • Declarative filters. Request classes declare which filters a listing
    accepts. Single operators (EqualsFilter, LikeFilter, BetweenFilter
    and friends) or whole groups (IdFilter, StringFilter, NumericFilter,
    DateFilter, BooleanFilter). Unknown fields, operators and sort columns
    are rejected with 422 and a message naming what was allowed.
  • An OpenAPI document at a configurable route, generated from the
    registered routes. Request bodies come from the validation rules, response
    schemas from the table columns of the model, and filters appear as one
    deepObject parameter per field. Which routes need a token is derived
    from their middleware.
  • rest-api:prune-jobs removes finished runs.

Notes

  • Every class is extensible: nothing is final, no method or property is
    private. See the "Extension points" section of the README.
  • Responses are flat JSON. Pagination is reported in the X-Total-Count,
    X-Page, X-Per-Page, X-Last-Page and Link headers.