Open sta2m opened 1 month ago
Same issue here !
Try to specify input format in operation level instead of specifying in global config.
new Post(
...
controller: FileController::class,
deserialize: false,
inputFormats: ['multipart' => ['multipart/form-data']],
openapi: new Operation(
requestBody: new RequestBody(
content: new ArrayObject([
'multipart/form-data' => [
'schema' => [
'type' => 'object',
'properties' => ['file' => ['type' => 'string', 'format' => 'binary']],
],
],
])
)
)
),
My POST config :
new Post(
inputFormats: ['multipart' => ['multipart/form-data']],
processor: UploadOnFile::class,
deserialize: false,
openapi: new Model\Operation(
requestBody: new Model\RequestBody(
content: new \ArrayObject([
'multipart/form-data' => [
'schema' => [
'type' => 'object',
'properties' => [
'file' => [
'type' => 'string',
'format' => 'binary'
]
]
]
]
])
)
)
),```
try removing multipart in format section in global config(api_platform.yml)
My error is:
Deserialization for the format \"multipart\" is not supported.
I've follow the docs from up to this point and after POST /media_objects
I got an error.
Here I see "new" change which doesn't work.
| Vich doesn't manage the file creation and set the filePath.
It looks like custom processor is needed. Is it true?
API Platform version(s) affected: 3.3.3
Description
I have an issue when doing a POST request to upload a file, using the example from the docs
Error : Could not resolve argument $data of \"api_platform.action.placeholder::__invoke()\", maybe you forgot to register the controller as a service or missed tagging it with the \"controller.service_arguments\"?"
Same as : https://github.com/api-platform/api-platform/issues/2539#issuecomment-2098595585
How to reproduce
See docs
Possible Solution
This workaround work for me : https://github.com/api-platform/api-platform/issues/2539#issuecomment-1790341634
Additional Context
My conf :