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

FEATURE: Allow mapping whole request body to a single action argument #1606

Open
wants to merge 4 commits into
base: master
from

Conversation

1 participant
@albe
Copy link
Member

commented May 30, 2019

This allows to annotate a method action with the new @Flow\MapRequestBody("$foo")
Annotation, which will lead to the full parsed request body being mapped
into the action argument $foo. Previously this was not possible and
the request body had to be wrapped with an object with a single foo property.
This is useful for APIs that want to receive specific payloads that are
defined on third parties or want to accept a list of models as an argument.

POST /api/v1/foo [{ "name": "foo1" }, { "name": "foo2" }]
/**
 * @param array<Foo> $foos
 * @Flow\MapRequestBody("$foos")
 */
public function fooAction(array $foos)

Resolves #1554

FEATURE: Allow mapping whole request body to a single action argument
This allows to annotate a method action with the new `@flow\MapRequestBody("$foo")`
Annotation, which will lead to the full parsed request body being mapped
into the action argument `$foo`. Previously this was not possible and
the request body had to be wrapped with an object with a single `foo` property.
This is useful for APIs that want to receive specific payloads that are
defined on third parties or want to accept a list of models as an argument.

```
POST /api/v1/foo [{ "name": "foo1" }, { "name": "foo2" }]
```

```php
/**
 * @param array<Foo> $foos
 * @flow\MapRequestBody("$foos")
 */
public function fooAction(array $foos)
```

@albe albe force-pushed the albe:request-body-param branch from 46e95e2 to ae7cb99 Jun 21, 2019

albe added some commits Jul 6, 2019

TASK: Fix injection of propertyMappingConfiguration in test
`Argument` expects an `MvcPropertyMappingConfiguration` for this attribute and not a `PropertyMappingConfiguration`

@albe albe added this to In progress in Neos 5.0 & Flow 6.0 Release Board via automation Jul 6, 2019

@albe

This comment has been minimized.

Copy link
Member Author

commented Jul 6, 2019

Things green now.

@albe albe moved this from In progress to Needs review in Neos 5.0 & Flow 6.0 Release Board Jul 6, 2019

@albe

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

TODO: Documentation for the feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.