core
core copied to clipboard
feat(doctrine): allow property aliasing on doctrine filters
| Q | A |
|---|---|
| Branch? | main, new feature |
| License | MIT |
| Doc PR | api-platform/docs |
Add a way to alias properties used to query the api filters.
via a simple configuration on the filter declaration, we can replace the parameters such as
my.relation.nested.superField by a simple superField that will be automatically resolved under the hood.
the documentation generated in the response is up to date with the aliased fields.
Interesting, although aliases are made possible using the new QueryParameter functionality since API Platform 3.2. I'm wondering how the documentation (hydra) outputs the view template for such a feature? What about OpenAPI does the parameter gets documented?
Interesting, although aliases are made possible using the new
QueryParameterfunctionality since API Platform 3.2. I'm wondering how the documentation (hydra) outputs the view template for such a feature? What about OpenAPI does the parameter gets documented?
@soyuka Thanks for the reply. I’ll search the docs for the QueryParameter you mention ! the hydra output returns the aliased property only, might be worthwhile returning both.
I did not tackle open api documentation for this feature, because it is more a flavour for a dedicated field in an entity than a replacement api-wide for the parameter… might be interesting to have it as well for the given routes, although I’m not sure about the implications in the swagger client etc
Any news? I have an API on v3.4 and each resource is a DTO with different properties from the Doctrine entity. I would like to mapping filter DTO properties vs Entity properties
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.