Skip to content

Additions to AttributeAnnotationFactory #1767

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Onekone
Copy link

@Onekone Onekone commented May 7, 2025

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
* Changed method arguments to generate from OA/Schemas, not just OA/Properties
@DerManoMann
Copy link
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
Collaborator

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

@Onekone
Copy link
Author

Onekone commented May 17, 2025

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

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.

None yet

2 participants