nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: vega/vega-lite
Pull request #637 (2015-10-13 04:00:44)

Make the vega validator happy by adding format json if we embed values


Patch:
diff --git a/src/compiler/data.js b/src/compiler/data.js
index 2e9ef1ae5..748a9cc07 100644
--- a/src/compiler/data.js
+++ b/src/compiler/data.js
@@ -47,6 +47,7 @@ data.raw = function(encoding, stats) {
   // Data source (url or inline)
   if (encoding.hasValues()) {
     raw.values = encoding.data().values;
+    raw.format = {type: 'json'};
   } else {
     raw.url = encoding.data().url;
     raw.format = {type: encoding.data().formatType};
@@ -55,7 +56,6 @@ data.raw = function(encoding, stats) {
   // Set data's format.parse if needed
   var parse = data.raw.formatParse(encoding);
   if (parse) {
-    raw.format = raw.format || {};
     raw.format.parse = parse;
   }
 


Test patch:
diff --git a/test/compiler/data.spec.js b/test/compiler/data.spec.js
index 96bc87539..dfa268cd7 100644
--- a/test/compiler/data.spec.js
+++ b/test/compiler/data.spec.js
@@ -57,8 +57,8 @@ describe('data.raw', function() {
       expect(raw.values).to.deep.equal([{a: 1, b:2, c:3}, {a: 4, b:5, c:6}]);
     });
 
-    it('should have raw.format if not required', function(){
-      expect(raw.format).to.eql(undefined);
+    it('should have raw.format', function(){
+      expect(raw.format).to.eql({type: 'json'});
     });
   });
 
@@ -233,4 +233,4 @@ describe('data.aggregated', function () {
       }]
     });
   });
-});
\ No newline at end of file
+});