embulk-parser-jsonpath 0.3.2-java → 0.4.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8f593d01643c31b479e599071bb78fe9f3eaca9aa4d57365d614eafca4a73e6
4
- data.tar.gz: 031e9a3a730992a208121053f637adedea546593cba42c789723e80eb754b5cc
3
+ metadata.gz: bf651c111217bef8a97e2ba2efed0236d0452d6ed249f4e6c2d2f9cf8887d73d
4
+ data.tar.gz: e5c758818fc28e1e3ca8b69d793c695f9e7d61bf5fccfb2e33be92c03051ee89
5
5
  SHA512:
6
- metadata.gz: 8d997d8b6e0f41754ce197b54e210e87080b630b34fac1a35cb55e310db62e182d3efc8752a4da781f353c5be5d66ed1503210e821e65a02ef8ccac11e220a10
7
- data.tar.gz: 19b6103582135190b51bf5d3770f5ac831e40bbfeffc8c79a8ca562f0e46c261a36d5b219845eac224eed6b5f763458a90ba6d50fc38ab6e8d7807116618959a
6
+ metadata.gz: a5b1bd0ebcc0b34cf0871e3bebc181e100635da74aef8f70cc9a1d9824b06f119a28cc0282a444c8fdfb958e75cb6de4d69571ff2460371c6ea5b8900885e3dc
7
+ data.tar.gz: 9d9c528e2e1e150a0162824beb6ffc70d23dfa90a7daf93721eae0877c95b1c4b8cc3f22c10dd0dd78b5bf30999946e3c79690148486ebd0226c05662b32d899
Binary file
@@ -10,21 +10,22 @@ module Embulk
10
10
  parser_config = config.param("parser",:hash)
11
11
  json_path = parser_config.param("root",:string,default: "$")
12
12
  json = JsonPath.new(json_path).on(sample_text).first
13
- if( json.kind_of?(Array) )
14
- no_hash = json.find{ |j| !j.kind_of?(Hash) }
15
- raise RuntimeError,"Can't exec guess. The row data must be hash." if no_hash
16
- columns = Embulk::Guess::SchemaGuess.from_hash_records(json).map do |c|
17
- column = {name: c.name, type: c.type}
18
- column[:format] = c.format if c.format
19
- column
20
- end
21
- parser_guessed = {"type" => "jsonpath"}
22
- parser_guessed["columns"] = columns
23
- return {"parser" => parser_guessed}
24
- else
25
- raise RuntimeError,"Can't guess specified the JSONPath: #{json_path}. The results does not return an Array."
26
- end
27
13
 
14
+ # The rest of code expect a data type like `[ {}, {}, {}]`.
15
+ # If JSONPath specifies a Hash object, it needs to pack a hash object into an array.
16
+ # ex. { "name": "bob", "age":24" } -> [ { "name": "bob", "age":24 } ]
17
+ json = [json] unless json.is_a?(Array)
18
+
19
+ no_hash = json.find{ |j| !j.kind_of?(Hash) }
20
+ raise RuntimeError,"Can't exec guess. The row data must be hash." if no_hash
21
+ columns = Embulk::Guess::SchemaGuess.from_hash_records(json).map do |c|
22
+ column = {name: c.name, type: c.type}
23
+ column[:format] = c.format if c.format
24
+ column
25
+ end
26
+ parser_guessed = {"type" => "jsonpath"}
27
+ parser_guessed["columns"] = columns
28
+ return {"parser" => parser_guessed}
28
29
  end
29
30
  end
30
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-jsonpath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.1
5
5
  platform: java
6
6
  authors:
7
7
  - Hiroyuki Sato
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-02 00:00:00.000000000 Z
12
+ date: 2023-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -49,9 +49,19 @@ extra_rdoc_files: []
49
49
  files:
50
50
  - classpath/accessors-smart-1.2.jar
51
51
  - classpath/asm-5.0.4.jar
52
- - classpath/embulk-parser-jsonpath-0.3.2.jar
52
+ - classpath/embulk-parser-jsonpath-0.4.1.jar
53
+ - classpath/embulk-util-config-0.3.1.jar
54
+ - classpath/embulk-util-file-0.1.3.jar
55
+ - classpath/embulk-util-json-0.1.1.jar
56
+ - classpath/embulk-util-rubytime-0.3.2.jar
57
+ - classpath/embulk-util-timestamp-0.2.1.jar
58
+ - classpath/jackson-annotations-2.6.7.jar
59
+ - classpath/jackson-core-2.6.7.jar
60
+ - classpath/jackson-databind-2.6.7.jar
61
+ - classpath/jackson-datatype-jdk8-2.6.7.jar
53
62
  - classpath/json-path-2.4.0.jar
54
63
  - classpath/json-smart-2.3.jar
64
+ - classpath/validation-api-1.1.0.Final.jar
55
65
  - lib/embulk/guess/jsonpath.rb
56
66
  - lib/embulk/parser/jsonpath.rb
57
67
  homepage: https://github.com/hiroyuki-sato/embulk-parser-jsonpath