All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- When creating a resource, set the context model prior to field validation
- Laravel: Fix
Hasfilter not working without ascope
1.0.0-beta.1 - 2023-09-24
- Add
Str::enum()method (#75 by @bertramakers) - Allow literal values in
Field::default()method (#80 by @bertramakers)
- Fix
Numberproperties not being initialized - Fix validators not being run for null values
- Fix
DateTimevalues containing milliseconds not being accepted - Fix nested filters not receiving correct resource in context
- Laravel: Fix
EloquentResourcesometimes using incorrect relation name when setting value - Laravel: Convert
DateTimevalues to Laravel app's storage timezone - Laravel: Validate that
WhereBelongsTofilter input is a list
1.0.0-alpha.2 - 2023-08-19
- Finish Laravel integration
- Add basic field schema configuration in preparation for OpenAPI generation
- Add
Context::$queryto access the query used in theIndexendpoint - Add
Context::fieldRequested()andContext::sortRequested()methods - Add
BooleanDateTimeattribute for exposing internal date-time values as booleans - Improve error sources in Bad Request errors
- Add a performance benchmark
- Add
voidreturn type toFilter::apply()signature
- Fix typed attribute values being deserialized and always passing validation
- Fix visibility callback result not being cast to a boolean
- Fix
Integerincorrectly not extendingNumber - Fix empty to-many relationships not being present in the response at all
- Fix TypeError when removing non-nullable to-one relationship (#74 by @bertramakers)
1.0.0-alpha.1 - 2023-06-21
-
New class-based API. More ergonomic for managing large resource definitions and inheriting/overriding behavior. Complex fields can be extracted into their own classes and reused across resources.
-
Typed attributes. Implementations of typed attributes are provided to match the data types in the OpenAPI specification. Attributes can be marked as required and nullable.
-
Customizable endpoints. Each endpoint is now opt-in for each resource and can be configured and implemented separately. Also adds the ability for custom endpoints to be added.
-
Restructured internals. The codebase is cleaner and easier to reason about, especially the serialization process.
Still to come:
- Implementation of Laravel stuff (currently it is documented but not implemented)
- Ability to generate OpenAPI definitions
- Additional attribute types (array, object)
- Benchmarks
0.2.0 - 2022-06-21
- Fix
EloquentAdapter::filterByIds()getting key name from query model instead of adapter model - Fix deprecation notice on PHP 8.1
0.2.0-beta.6 - 2022-04-22
- Add support for
doctrine/inflector:^2.0
0.2.0-beta.5 - 2022-01-03
Context::getBody()method to retrieve the parsed JSON:API payload from the requestContext::sortRequested()method to determine if a sort field has been requested
Laravel\rules(): Fix regression disallowing use of advanced validation rules like callbacks andRuleinstances. (@SychO9)
0.2.0-beta.4 - 2021-09-05
Laravel\rules(): Replace{id}placeholder in rules with the model's key.- This is useful for the
uniquerule, for example:unique:users,email,{id}
- This is useful for the
Laravel\can(): Pass through additional arguments to Gate check.- This is needed to use policy methods without models, for example:
can('create', Post::class)
- This is needed to use policy methods without models, for example:
- Get a fresh copy of the model to display after create/update to ensure consistency
- Respond with
400 Bad Requestwhen attempting to filter on an attribute of a polymorphic relationship
0.2.0-beta.3 - 2021-09-03
- Fix dependency on
http-acceptnow that a version has been tagged - Change
EloquentAdapterto load relationships usingloadinstead ofloadMissing, as they may need API-specific scopes applied
0.2.0-beta.2 - 2021-09-01
- Content-Type validation and Accept negotiation
- Include
jsonapiobject withversionmember in response - Validate implementation-specific query parameters according to specification
- Added
Locationheader to201 Createdresponses - Improved error responses when creating and updating resources
Context::filter()method to get the value of a filterResourceType::applyScope(),applyFilter()andapplySort()methodsResourceType::url()method to get the URL for a modelForbiddenerror details for CRUD actions, useful when running Atomic OperationsJsonApi::getExtensions()method to get all registered extensionsConflictExceptionclass
- Renamed
$linkageparameter inAdapterInterfacemethods to$linkageOnly - Renamed
Type::newModel()tomodel()to be consistent with Adapter
- Properly respond with meta information added to
Contextinstance
0.2.0-beta.1 - 2021-08-27
- Preliminary support for Extensions
- Support filtering by nested relationships/attributes (eg.
filter[relationship.attribute]=value) - Add new methods to Context object:
getApi,getPath,fieldRequested,meta - Eloquent adapter: apply scopes when including polymorphic relationships
- Laravel validation helper: support nested validation messages
- Allow configuration of sort and filter visibility
- Add new
setIdmethod toAdapterInterface
- Change paradigm for eager loading relationships; allow fields to return
Deferredvalues to be evaluated after all other fields, so that resource loading can be buffered. - Remove
onprefix from field event methods
- Removed
loadanddontLoadfield methods
- Fix pagination next link appearing when it shouldn't