dropbox / dropbox/nsot

Using browseable API to update Interface object with empty attributes raises 400

Open
#313 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
407
Forks
61
PR merge metrics
No merged PRs in 30d

Description

The attributes field should default to an empty object (`{}`) but it's blank. So if the attributes for an Interface object are unset, upon clicking "PUT" to update the instance, a 400 is raised from the browseable API:

```javascript

PUT /api/sites/1/interfaces/foo14-ab01:s45/

HTTP 400 Bad Request
Allow: GET, PUT, PATCH, DELETE, OPTIONS
Content-Type: application/json
Vary: Accept

{
"error": {
"message": {
"attributes": "Expected dictionary but received "
},
"code": 400
}
}
```

Strangely despite the error, any update still succeeds (such as if you're updating the `description` field). Also, if one puts `{}` into the `attributes` field and submits with the "PUT" button, the operation succeeds without any error.

There's something fishy going on here and appears to be two issues:
- The default value for the `attributes` field should be `{}` if the field is empty.
- The validation of the attributes field appears to block only update to that field and not update to the entire object.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.