estuary
estuary copied to clipboard
add-car not valid swagger - swagger requires multipart/form-data for uploads
swagger (open api2) only supports file uploads through multipart form which looks like this curl :
curl --location --request POST 'http://localhost:3004/content/add?coluuid&replication=&ignore-dupes=&lazy-provide=&dir=' \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ESTxARY' \
--form 'data=@"foo"' \
--form 'filename="/testfile"'
documented here https://swagger.io/docs/specification/2-0/file-upload/
however currently the api on estuary works like this:
curl --location --request POST 'https://upload.estuary.tech/content/add-car?ignore-dupes=&' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ESTxARY' \
-T foo.car
which isn't possible to annotate in swagger / openapi 2 so the api client currently is incorrect for add-car
we should either
- change the add-car endpoint to match swagger
- switch to openapi3 which apparently supports this format https://swagger.io/docs/specification/describing-request-body/file-upload/
Why do we use open api 2 today?