I tried to make it works for hours :cold_sweat:, there is two issues:
The Slack specification is wrong and does not promote multi-part request;
Jane support for the "file" type seams to be broken!
Here is what I tried. In the specification I changed the type to "file":
--- i/resources/slack-openapi-patched.json
+++ w/resources/slack-openapi-patched.json
@@ -12578,7 +12578,7 @@
"/files.upload": {
"post": {
"consumes": [
- "application/x-www-form-urlencoded"
+ "multipart/form-data"
],
"description": "Uploads or creates a file.",
"externalDocs": {
@@ -12633,7 +12633,7 @@
"description": "File contents via `multipart/form-data`. If omitting this parameter, you must submit `content`.",
"in": "formData",
"name": "file",
- "type": "string"
+ "type": "file"
},
{
"description": "Provide another message's `ts` value to upload this file as a reply. Never use a reply's `ts` value; use its parent instead.",
I generated the new client vendor/bin/jane-openapi generate --config-file=.jane-openapi.php and then tried this code:
1) JoliCode\Slack\Tests\WritingTest::testItCanUploadFile
TypeError: Argument 1 passed to Jane\OpenApiRuntime\Client\BaseEndpoint::getMultipartBody() must be an instance of Http\Message\StreamFactory or null, instance of Nyholm\Psr7\Factory\Psr17Factory given, called in /home/dalexandre/Dev/slack-php-api/generated/Endpoint/FilesUpload.php on line 50
It looks like Jane is not building the proper body.
@Korbeil @joelwurtz Mates, can I ping you about this? :grimacing: I'm stuck.
This is not working! :warning:
Trying to solve / understand issue #58;
I tried to make it works for hours :cold_sweat:, there is two issues:
Here is what I tried. In the specification I changed the type to "file":
I generated the new client
vendor/bin/jane-openapi generate --config-file=.jane-openapi.php
and then tried this code:And got this error:
It looks like Jane is not building the proper body.
@Korbeil @joelwurtz Mates, can I ping you about this? :grimacing: I'm stuck.