genericode 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45525e09245553fcda6cb3606ec8f7b17c0fde0daf6507c41e47008d5e8dce43
4
- data.tar.gz: 66c0b7b056d47c096d736176d9c575df8fba8c830f539d14e076b43a6f07cda8
3
+ metadata.gz: e291ef80bb1e2146628255afde45053ca058c30da6bf183c4b53ff8e65b46fc2
4
+ data.tar.gz: fc1d89c86ed420b4b1969959dbd250bf768c719e0cedae2197613dfc7996c46f
5
5
  SHA512:
6
- metadata.gz: d6dd2ebe439fde9ab7584ef67e149b3d79b026ae980b8beec200c5fd99a45e95c35b70663bfd8d27566095778394ce6a65ad2f4e7ff72b4706b7028c94ba55a5
7
- data.tar.gz: 59951937dd0cd26496fe64e13f9ba70c12ed7d2757609ebfa10633e4d21a233fae230fc234b7da559f4bc12e1c121b029bec786af445f74d6fd5a703dcff83b0
6
+ metadata.gz: 12e6bbca723ee3b97fa3da11a3ca65757988824df665b877836ed5c53c5d610fb81f2282659e64acbb9ab37ad99a6291c851598eb5fe689c3009d2e73b7d64c8
7
+ data.tar.gz: 5bbb18bbede6f7d905eea7b75c616f2c8466da97cdb992cfb518ba884aa56b2d126203549337162ebaaee9f160990f09a785e4ebe0ec5d7bd3a89aaa39ed36fd
@@ -26,7 +26,7 @@ module Genericode
26
26
  namespace "http://docs.oasis-open.org/codelist/ns/genericode/1.0/", "gc"
27
27
 
28
28
  map_element "Description", to: :description, prefix: nil, namespace: nil
29
- map_element "AppInfo", to: :app_info, prefix: nil, namespace: nil, render_nil: true
29
+ map_element "AppInfo", to: :app_info, prefix: nil, namespace: nil, value_map: { to: { nil: :empty } }
30
30
  end
31
31
  end
32
32
  end
@@ -22,13 +22,6 @@ module Genericode
22
22
 
23
23
  File.write(output_path, result)
24
24
  true
25
- # rescue JSON::ParserError => e
26
- # raise Error, "Invalid JSON in input file: #{e.message}"
27
- # rescue Shale::ParseError => e
28
- # raise Error, "Invalid XML in input file: #{e.message}"
29
- # rescue StandardError => e
30
- # raise Error, "Conversion error: #{e.message}"
31
- # end
32
25
  end
33
26
  end
34
27
  end
@@ -20,7 +20,7 @@ module Genericode
20
20
  attribute :use, :string, default: -> { "optional" }
21
21
  attribute :annotation, Annotation
22
22
  attribute :short_name, ShortName
23
- attribute :long_name, LongName, collection: true
23
+ attribute :long_name, LongName, collection: true, initialize_empty: true
24
24
  attribute :canonical_uri, CanonicalUri
25
25
  attribute :canonical_version_uri, :string
26
26
  attribute :data, Data
@@ -50,7 +50,7 @@ module Genericode
50
50
  end
51
51
 
52
52
  def long_name_to_json(model, doc)
53
- return if model.long_name.empty?
53
+ return if model.long_name.nil? || model.long_name.empty?
54
54
 
55
55
  doc["LongName"] = LongName.as_json(Utils.one_or_all(model.long_name))
56
56
  end
@@ -14,8 +14,8 @@ module Genericode
14
14
  attribute :datatype_library, :string
15
15
  attribute :annotation, Annotation
16
16
  attribute :identification, Identification
17
- attribute :column, Column, collection: true
18
- attribute :column_ref, ColumnRef, collection: true
17
+ attribute :column, Column, collection: true, initialize_empty: true
18
+ attribute :column_ref, ColumnRef, collection: true, initialize_empty: true
19
19
  attribute :key, Key, collection: true
20
20
  attribute :key_ref, KeyRef, collection: true
21
21
 
@@ -17,12 +17,12 @@ module Genericode
17
17
  include Json::ShortNameMixin
18
18
 
19
19
  attribute :short_name, ShortName
20
- attribute :long_name, LongName, collection: true
20
+ attribute :long_name, LongName, collection: true, initialize_empty: true
21
21
  attribute :version, :string
22
22
  attribute :canonical_uri, CanonicalUri
23
23
  attribute :canonical_version_uri, :string
24
- attribute :location_uri, :string, collection: true
25
- attribute :alternate_format_location_uri, MimeTypedUri, collection: true
24
+ attribute :location_uri, :string, collection: true, initialize_empty: true
25
+ attribute :alternate_format_location_uri, MimeTypedUri, collection: true, initialize_empty: true
26
26
  attribute :agency, Agency
27
27
 
28
28
  json do
@@ -43,20 +43,19 @@ module Genericode
43
43
  end
44
44
 
45
45
  def long_name_to_json(model, doc)
46
- return if model.long_name.empty?
46
+ return if model.long_name.nil? || model.long_name.empty?
47
47
 
48
48
  doc["LongName"] = LongName.as_json(model.long_name)
49
49
  end
50
50
 
51
51
  def location_uri_from_json(model, value)
52
- # model.location_uri = Shale::Type::String.of_json(Utils.array_wrap(value))
53
52
  model.location_uri = Utils.array_wrap(value).map do |val|
54
53
  Lutaml::Model::Type::String.cast(val)
55
54
  end
56
55
  end
57
56
 
58
57
  def location_uri_to_json(model, doc)
59
- return if model.location_uri.empty?
58
+ return if model.location_uri.nil? || model.location_uri.empty?
60
59
 
61
60
  doc["LocationUri"] = Lutaml::Model::Type::String.cast(Utils.one_or_all(model.location_uri))
62
61
  end
@@ -66,7 +65,7 @@ module Genericode
66
65
  end
67
66
 
68
67
  def alternate_format_location_uri_to_json(model, doc)
69
- return if model.alternate_format_location_uri.empty?
68
+ return if model.alternate_format_location_uri.nil? || model.alternate_format_location_uri.empty?
70
69
 
71
70
  doc["AlternateFormatLocationUri"] = MimeTypedUri.as_json(Utils.one_or_all(model.alternate_format_location_uri))
72
71
  end
@@ -19,7 +19,7 @@ module Genericode
19
19
  attribute :id, :string
20
20
  attribute :annotation, Annotation
21
21
  attribute :short_name, ShortName
22
- attribute :long_name, LongName, collection: true
22
+ attribute :long_name, LongName, collection: true, initialize_empty: true
23
23
  attribute :canonical_uri, CanonicalUri
24
24
  attribute :canonical_version_uri, :string
25
25
  attribute :column_ref, KeyColumnRef, collection: true
@@ -39,7 +39,7 @@ module Genericode
39
39
  end
40
40
 
41
41
  def long_name_to_json(model, doc)
42
- return if model.long_name.empty?
42
+ return if model.long_name.nil? || model.long_name.empty?
43
43
 
44
44
  doc["LongName"] = LongName.as_json(model.long_name)
45
45
  end
@@ -8,7 +8,7 @@ require_relative "row"
8
8
  module Genericode
9
9
  class SimpleCodeList < Lutaml::Model::Serializable
10
10
  attribute :annotation, Annotation
11
- attribute :row, Row, collection: true
11
+ attribute :row, Row, collection: true, initialize_empty: true
12
12
 
13
13
  json do
14
14
  map "Annotation", to: :annotation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Genericode
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genericode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-03 00:00:00.000000000 Z
11
+ date: 2025-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: lutaml-model
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: tabulo
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.3.27
147
+ rubygems_version: 3.5.22
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Parser and generator for OASIS Genericode