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

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

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

yvo-niedrich
Copy link
Contributor

@yvo-niedrich yvo-niedrich commented Jul 17, 2024

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

Changes

  • GeneratedProperty::invoke does expect a Primitive (but it is able to convert scalar types itself)
  • EloquentEntitySet::read should correctly implement and comply with the ReadInterface it implements
  • Added an argument to annotate properties as immutable
    eg: #[LodataString(name: 'Type', source: 'type', immutable: true)]

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
Copy link
Contributor

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 : )

@27pchrisl 27pchrisl merged commit be527e5 into flat3:5.x Jul 17, 2024
16 checks passed
@yvo-niedrich
Copy link
Contributor Author

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)

@yvo-niedrich yvo-niedrich deleted the 5.x-immutable branch July 17, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants