flat3 / lodata

The OData v4.01 Producer for Laravel
https://lodata.io/
MIT License
80 stars 27 forks source link

Update PHPdoc & allow `immutable` annotation via Attributes on Eloquent Model #836

Closed yvo-niedrich closed 4 months ago

yvo-niedrich commented 4 months ago

When overloading some classes I need to suppress psalm errors for invalid return types, when they are actually correct:

Changes

Comments

I'm still looking into the immutable aspect of the library because I feel Immutable, Computed and ComputedDefaultValue are implemented too loosely (vocabulary here):

I've defined a property as computed and the OpenAPI specification looks good, the property is not defined for Create- or Update operations. But it is accepted and passed on as in the arguments nonetheless - so in my case the user is able to manipulate computed attributes like the updated date, by just providing a value in their PATCH request 🤔

27pchrisl commented 4 months ago

Agreed, they should have been filtered out if they're computed according to https://docs.oasis-open.org/odata/odata/v4.01/os/part1-protocol/odata-v4.01-os-part1-protocol.html#sec_CreateanEntity

Happy to merge a fix if you have one : )

yvo-niedrich commented 4 months ago

Happy to merge a fix if you have one : )

Will prepare in the next couple of days...

I do assume this will be introducing breaking changes though (in terms of Library Behaviour)