v2 - replacing root document returns a schema error

Bug #1521591 reported by Jamie Hannaford
6
This bug affects 1 person
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 &quot;/&quot;.<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://github.com/json-patch/json-patch-tests/blob/master/tests.json#L180-L183

Revision history for this message
Ian Cordasco (icordasc) wrote :

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.

Changed in glance:
status: New → Triaged
importance: Undecided → Medium
Changed in glance:
assignee: nobody → Mohammed Ashraf (mohammed-asharaf)
Changed in glance:
assignee: Mohammed Ashraf (mohammed-asharaf) → nobody
Wenjun Wang (wangwenjun)
Changed in glance:
assignee: nobody → Wenjun Wang (wangwenjun)
Wenjun Wang (wangwenjun)
Changed in glance:
assignee: Wenjun Wang (wangwenjun) → nobody
Changed in glance:
assignee: nobody → Sana Khan (sana.khan)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.