← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1521591] [NEW] v2 - replacing root document returns a schema error

 

Public bug reported:

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

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1521591

Title:
  v2 - replacing root document returns a schema error

Status in Glance:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1521591/+subscriptions