schematic 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -76,8 +76,12 @@ module Schematic
|
|
76
76
|
element.xs :complexType do |complex_type|
|
77
77
|
if values.is_a?(Array)
|
78
78
|
complex_type.xs :sequence do |nested_sequence|
|
79
|
-
values.
|
80
|
-
|
79
|
+
if values.present?
|
80
|
+
values.each do |value|
|
81
|
+
nested_sequence.xs :element, "name" => value.to_s.dasherize, "minOccurs" => "0", "maxOccurs" => "unbounded"
|
82
|
+
end
|
83
|
+
else
|
84
|
+
nested_sequence.xs :any, "processContents" => "skip", "minOccurs" => "0", "maxOccurs" => "unbounded"
|
81
85
|
end
|
82
86
|
end
|
83
87
|
elsif values.is_a?(Hash)
|
data/lib/schematic/version.rb
CHANGED
@@ -26,7 +26,6 @@ describe Schematic::Serializers::Xsd do
|
|
26
26
|
t.date "some_date"
|
27
27
|
t.boolean "some_boolean"
|
28
28
|
t.text "method_is_also_columns"
|
29
|
-
t.text "method_is_also_an_empty_column"
|
30
29
|
end
|
31
30
|
|
32
31
|
model do
|
@@ -34,12 +33,16 @@ describe Schematic::Serializers::Xsd do
|
|
34
33
|
validates :some_text, :presence => true
|
35
34
|
validates :some_date, :presence => true, :allow_blank => true
|
36
35
|
validates :some_datetime, :presence => true, :allow_blank => false
|
37
|
-
|
36
|
+
attr_accessor :additional_method_array
|
38
37
|
class << self
|
39
38
|
def xsd_methods
|
40
|
-
{:foo => { :bar => { :baz => nil }, :quz => [:qaz] }, :method_is_also_columns => [:method_is_also_column], :
|
39
|
+
{:foo => { :bar => { :baz => nil }, :quz => [:qaz] }, :method_is_also_columns => [:method_is_also_column], :additional_method_array => [] }
|
41
40
|
end
|
42
41
|
end
|
42
|
+
|
43
|
+
def to_xml(options)
|
44
|
+
super({:methods => [:additional_method_array]}.merge(options))
|
45
|
+
end
|
43
46
|
end
|
44
47
|
|
45
48
|
end
|
@@ -56,10 +59,9 @@ describe Schematic::Serializers::Xsd do
|
|
56
59
|
:some_boolean => true,
|
57
60
|
:some_float => 1.5,
|
58
61
|
:method_is_also_columns => [{:some => "somevalues"}],
|
59
|
-
:
|
62
|
+
:additional_method_array => {"somevalue" => "somekey"},
|
60
63
|
:some_integer => 2)
|
61
64
|
xml = [instance].to_xml
|
62
|
-
|
63
65
|
validate_xml_against_xsd(xml, subject)
|
64
66
|
end
|
65
67
|
end
|