estuary icon indicating copy to clipboard operation
estuary copied to clipboard

add-car not valid swagger - swagger requires multipart/form-data for uploads

Open snissn opened this issue 3 years ago • 1 comments

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

  1. change the add-car endpoint to match swagger
  2. switch to openapi3 which apparently supports this format https://swagger.io/docs/specification/describing-request-body/file-upload/

snissn avatar Dec 15 '22 08:12 snissn

Why do we use open api 2 today?

anjor avatar Dec 15 '22 15:12 anjor