Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-2794

REST API Doesn't Accept Primitive Types as Values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • client/server, rest (dev)
    • None

    Description

      Plain text is valid JSON, but is not supported by the REST API. Same issue for all primitive types: bool, number, arrays. Only objects are accepted.

      Repro example below. Putting the same value from another client works, and we are able to get primitive values.
      PUT /gemfire-api/v1/orders/234
      Request body:

      "hello"

      Response:
      HTTP 400
      Response body:

      {
        "cause": "Json doc specified is either not supported or invalid!"
      }
      

       

      Wrapping the same request as:

       {"value":"hello"} 

      succeeds (HTTP 200, and entry is saved).

      Experienced on Geode 9.0.2.

      Possible scenarios:

      1. Session state info containing binary data could be managed manually by base 64 encoding the entire session state object into a string (not boxed in another object).
      2. Images are binary data which could also be base 64 encoded to strings.
      3. If a user is already using Geode for write-through caching, some values may be primitive types and it is convenient and consistent to write them through Geode rather than stepping around the cache.

       

      This problem also impacts the new client/server protocol, as it uses the same JSON processing. 

      Attachments

        Activity

          People

            Unassigned Unassigned
            mmartell Michael Martell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: