Skip to content

Additions to AttributeAnnotationFactory#1767

Closed
Onekone wants to merge 4 commits into
zircote:masterfrom
Onekone:master
Closed

Additions to AttributeAnnotationFactory#1767
Onekone wants to merge 4 commits into
zircote:masterfrom
Onekone:master

Conversation

@Onekone

@Onekone Onekone commented May 7, 2025

Copy link
Copy Markdown

While developing my own set of helper annotations, noticed that context object lacks information to which method argument attribute is attached to (case is to use it in processing* to implicitly fill out attributes), so this changes that, and adds reflection instances for good measure

Also makes it so all OA/Schemas in arguments are evaluated, and not just OA/Properties


* And in a hacky way, during validation

Onekone added 3 commits May 7, 2025 17:50
@DerManoMann

Copy link
Copy Markdown
Collaborator

Sorry for not responing - busy times... Also, this kind of overlaps with my type cleanup work, so I need to have a bit of a think...

Ensuring that there are unique contexts is definitely useful.

@DerManoMann

Copy link
Copy Markdown
Collaborator

Could you give an example of how/why there might be a OA\Schema on a method parameter?

@Onekone

Onekone commented May 17, 2025

Copy link
Copy Markdown
Author

Not exactly exact OA/Schema, but for example, a custom attribute extending OA/Schema, that targets method parameters and gets filled from respective docblock @param annotation containing array/object shape.

Closest practical example would be a Laravel Eloquent model that has JSON field (which would be array|object|null), and a setter method. Defining input argument typehint as an object shape (ex. object{ items: string[], count: non-negative-int, type: "box"|"bag"}), and giving it a such custom schema attribute can give you a schema that can be reused in a compact way

I am brainstorming it myself currently (see onekone/lore repo, but it's deeply wip), so forgive me if I'm not convincing enough

@DerManoMann

Copy link
Copy Markdown
Collaborator

@Onekone have you looked at the latest changes around type resolving and in particular #1829 ?
I think once that is merged I will close this PR as I think just tracking the single Context::resolver gives us everything you would need.

@DerManoMann

Copy link
Copy Markdown
Collaborator

Closing - stale and superseded by the new Context::reflector property.

@DerManoMann DerManoMann closed this Nov 5, 2025
@Onekone

Onekone commented Dec 18, 2025

Copy link
Copy Markdown
Author

Sorry for long response, was a bit busy on personal and work side of things

Yeah, it's fine, current implementation also works great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants