v2 - replacing root document returns a schema error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Triaged
|
Medium
|
Sana Khan |
Bug Description
According to the JSON schema spec, you can replace the entire document using an empty string "" as the JSON pointer. If the original schema looked like this:
{
"type": "object",
"properties": {
"foo": {"type": "string"},
"bar": {"type": "string"}
}
}
the PATCH doc could look something like this:
{
"op": "replace",
"path": "",
"value": {
"foo": "val1",
"bar": "val2"
}
}
but when you try to update a Glance image this way, you can back the following error:
"""
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>400 Bad Request</h1>
Pointer `` does not start with "/".<br /><br />
</body>
</html>
"""
I have two problems with this:
1. A leading slash is not a requirement for a valid JSON pointer
2. Why is HTML being used as the output format on a JSON API?
This test should demonstrate what I mean:
https:/
Changed in glance: | |
assignee: | nobody → Mohammed Ashraf (mohammed-asharaf) |
Changed in glance: | |
assignee: | Mohammed Ashraf (mohammed-asharaf) → nobody |
Changed in glance: | |
assignee: | nobody → Wenjun Wang (wangwenjun) |
Changed in glance: | |
assignee: | Wenjun Wang (wangwenjun) → nobody |
Changed in glance: | |
assignee: | nobody → Sana Khan (sana.khan) |
So there are two parts to this bug report:
1. Incomplete/ incorrect implementation of JSON PATCH by Glance
2. HTML error response bodies
The first part we can fix. The second needs to be fixed in webob first (https:/ /github. com/Pylons/ webob/issues/ 209). Once we've fixed it there, we can update our dependency on webob and take advantage of that fix.