Skip to content

Commit 4348911

Browse files
HassanAkbarronaldtse
authored andcommitted
updated according to Lutaml::Model
1 parent 8ac10c1 commit 4348911

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/genericode/annotation.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Annotation < Lutaml::Model::Serializable
1212

1313
json do
1414
map "Description", to: :description
15-
map "AppInfo", to: :app_info
15+
map "AppInfo", to: :app_info, render_nil: true
1616
end
1717

1818
def self.of_json(hash, **)
@@ -26,7 +26,7 @@ def self.of_json(hash, **)
2626
namespace "http://docs.oasis-open.org/codelist/ns/genericode/1.0/", "gc"
2727

2828
map_element "Description", to: :description, prefix: nil, namespace: nil
29-
map_element "AppInfo", to: :app_info, prefix: nil, namespace: nil
29+
map_element "AppInfo", to: :app_info, prefix: nil, namespace: nil, render_nil: true
3030
end
3131
end
3232
end

lib/genericode/identification.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ def long_name_to_json(model, doc)
4949
end
5050

5151
def location_uri_from_json(model, value)
52-
model.location_uri = Shale::Type::String.of_json(Utils.array_wrap(value))
52+
# model.location_uri = Shale::Type::String.of_json(Utils.array_wrap(value))
53+
model.location_uri = Utils.array_wrap(value).map do |val|
54+
Lutaml::Model::Type::String.cast(val)
55+
end
5356
end
5457

5558
def location_uri_to_json(model, doc)
5659
return if model.location_uri.empty?
5760

58-
doc["LocationUri"] = Shale::Type::String.as_json(Utils.one_or_all(model.location_uri))
61+
doc["LocationUri"] = Lutaml::Model::Type::String.cast(Utils.one_or_all(model.location_uri))
5962
end
6063

6164
def alternate_format_location_uri_from_json(model, value)

0 commit comments

Comments
 (0)