netlify/open-api

Successful PUT to /deploys/{deploy_id}/files/{path} returns capitalized keys

kaganjd opened this issue · 3 comments

https://community.netlify.com/t/api-endpoint-deploys-deploy-id-files-path-randomly-gives-strange-results/22091/

The OP noted that a successful PUT request returns:

  {
    ID: '/static/2555efdf6712bc438581a141651552c2eb423ab6/photo-1598454242110-0744560ec77e.jpg',
    Path: '/static/2555efdf6712bc438581a141651552c2eb423ab6/photo-1598454242110-0744560ec77e.jpg',
    SHA: '2555efdf6712bc438581a141651552c2eb423ab6',
    MimeType: 'image/jpeg',
    Size: 170443
  }

whereas the docs (https://open-api.netlify.com/#operation/uploadDeployFile) show the returned object as:

{
    "id": "string",
    "path": "string",
    "sha": "string",
    "mime_type": "string",
    "size": 0

}

I think this is the server code for the response: https://github.com/netlify/netlify-server/blob/dee71a22aa145d66897c0c1ba62ebc3269bae6e3/server/request_file_upload.go#L45-L51

We should either lowercase the keys or update the open-api docs to show the capitalized keys.

Also note that other endpoints adhere to the spec, so this is not a general problem and only pertains to the uploadDeployFile operation.

kitop commented

This should be fixed now, the response now adheres to the docs.
Thanks for reporting!

Perfect! Is working fine now, thanks for fixing!