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

null values not supported in JSON API #41

Closed
eddavisson opened this issue Jun 12, 2014 · 3 comments
Closed

null values not supported in JSON API #41

eddavisson opened this issue Jun 12, 2014 · 3 comments

Comments

@eddavisson
Copy link
Contributor

The following request:

{
 "mode": "NON_TRANSACTIONAL",
 "mutation": {
  "insertAutoId": [
   {
    "key": {
     "path": [
      {
       "kind": "test"
      }
     ]
    },
    "properties": {
     "propertyName": {
     }
    }
   }
  ]
 }
}

results in this response:

400 Bad Request

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "INVALID_ARGUMENT",
    "message": "Property \"propertyName\" has no value.",
   }
  ],
  "code": 400,
  "message": "Property \"propertyName\" has no value."
 }
}

Null values work correctly in the proto API but not JSON.

http://stackoverflow.com/questions/24141010/json-structure-to-insert-a-null-value-for-a-property-into-google-cloud-datastore/24174662

@eddavisson eddavisson added the bug label Jun 12, 2014
@eddavisson
Copy link
Contributor Author

b/15585044

@afri
Copy link

afri commented Aug 27, 2015

FWIW, in a listValue the API tolerates null values, but (incorrectly) ignores them.
The request

{ mutation: { upsert: [
   {
      key: key,
      properties: {
        test: { listValue: [ {}, {stringValue: 'foo'}, {}, {stringValue: 'bar'} ] }
      }
   }]}
}

succeeds, but then yields the following on a subsequent lookup:

{
  ...
  properties: { 
    test: {
      listValue: [
        { stringValue: 'foo' },
        { stringValue: 'bar' }
      ]
    }
  }
}

The null values have vanished.

@eddavisson
Copy link
Contributor Author

The v1beta3 API adds an explicit null value type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants