Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jathanism opened this issue Jan 30, 2018 · 0 comments
Labels
Milestone

Comments

@jathanism
Copy link
Contributor

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:

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 <type 'NoneType'>"
        },
        "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.
@jathanism jathanism added the bug label Jan 30, 2018
@jathanism jathanism modified the milestones: v2.0, v1.3.1 Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant