schematic 0.7.0 → 0.7.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f89e984adf5c1efe6246c1e32fea80b6d51e196
|
4
|
+
data.tar.gz: 527e14a50ca42c440df9856766d08a3f00a92dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d2faaaf1fa79c30f15583471d2af19cb2262cf78c6a335ebc63ad6a3be54f1cbadb1129e9849f491dedf8dccd9737bed7a36b176d6d26b065e7abeccc226e09
|
7
|
+
data.tar.gz: 9dfd787c816b4810fe07743ab86b5f5a32c49ad84584083f07055b5e5c54e6b39dd300e840a9dc5eae822947d9235bfe9bcc4f624d6cf3298e5edb14ff5a5f17
|
@@ -4,6 +4,7 @@ module Schematic
|
|
4
4
|
COMPLEX = {
|
5
5
|
:integer => { :complex_type => 'Integer', :xsd_type => 'xs:integer' }.freeze,
|
6
6
|
:float => { :complex_type => 'Float', :xsd_type => 'xs:float' }.freeze,
|
7
|
+
:decimal => { :complex_type => 'Decimal', :xsd_type => 'xs:decimal' }.freeze,
|
7
8
|
:string => { :complex_type => 'String', :xsd_type => 'xs:string' }.freeze,
|
8
9
|
:text => { :complex_type => 'Text', :xsd_type => 'xs:string' }.freeze,
|
9
10
|
:datetime => { :complex_type => 'DateTime', :xsd_type => 'xs:dateTime' }.freeze,
|
data/lib/schematic/version.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Schematic::Generator::Column do
|
4
|
+
describe "#generate" do
|
5
|
+
with_model :some_model do
|
6
|
+
table :id => false do |t|
|
7
|
+
t.integer :id_column
|
8
|
+
t.float :float_column
|
9
|
+
t.string :string_column
|
10
|
+
t.text :text_column
|
11
|
+
t.datetime :datetime_column
|
12
|
+
t.date :date_column
|
13
|
+
t.decimal :decimal_column
|
14
|
+
end
|
15
|
+
|
16
|
+
model do
|
17
|
+
self.primary_key = :id
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should generate xsd" do
|
22
|
+
xsd = sanitize_xml(SomeModel.to_xsd)
|
23
|
+
|
24
|
+
Schematic::Generator::Types::COMPLEX.each do |type, value|
|
25
|
+
expect(xsd).to include("<xs:complexType name=\"#{value[:complex_type]}\">")
|
26
|
+
expect(xsd).to include("<xs:extension base=\"#{value[:xsd_type]}\">")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -579,6 +579,14 @@ describe Schematic::Serializers::Xsd do
|
|
579
579
|
</xs:extension>
|
580
580
|
</xs:simpleContent>
|
581
581
|
</xs:complexType>
|
582
|
+
<xs:complexType name="Decimal">
|
583
|
+
<xs:simpleContent>
|
584
|
+
<xs:extension base="xs:decimal">
|
585
|
+
<xs:attribute name="type" type="xs:string" use="optional"/>
|
586
|
+
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
587
|
+
</xs:extension>
|
588
|
+
</xs:simpleContent>
|
589
|
+
</xs:complexType>
|
582
590
|
<xs:complexType name="String">
|
583
591
|
<xs:simpleContent>
|
584
592
|
<xs:extension base="xs:string">
|
data/spec/support/helpers.rb
CHANGED
@@ -51,6 +51,14 @@ def generate_xsd_for_model(model, header_element = nil)
|
|
51
51
|
</xs:extension>
|
52
52
|
</xs:simpleContent>
|
53
53
|
</xs:complexType>
|
54
|
+
<xs:complexType name="Decimal">
|
55
|
+
<xs:simpleContent>
|
56
|
+
<xs:extension base="xs:decimal">
|
57
|
+
<xs:attribute name="type" type="xs:string" use="optional"/>
|
58
|
+
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
59
|
+
</xs:extension>
|
60
|
+
</xs:simpleContent>
|
61
|
+
</xs:complexType>
|
54
62
|
<xs:complexType name="String">
|
55
63
|
<xs:simpleContent>
|
56
64
|
<xs:extension base="xs:string">
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schematic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Case Commons, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/schematic/serializers/xsd.rb
|
143
143
|
- lib/schematic/version.rb
|
144
144
|
- schematic.gemspec
|
145
|
+
- spec/schematic/generator/column_spec.rb
|
145
146
|
- spec/schematic/generator/restrictions/custom_spec.rb
|
146
147
|
- spec/schematic/generator/restrictions/enumeration_spec.rb
|
147
148
|
- spec/schematic/generator/restrictions/length_spec.rb
|
@@ -187,6 +188,7 @@ signing_key:
|
|
187
188
|
specification_version: 4
|
188
189
|
summary: Automatic XSD generation from ActiveRecord models
|
189
190
|
test_files:
|
191
|
+
- spec/schematic/generator/column_spec.rb
|
190
192
|
- spec/schematic/generator/restrictions/custom_spec.rb
|
191
193
|
- spec/schematic/generator/restrictions/enumeration_spec.rb
|
192
194
|
- spec/schematic/generator/restrictions/length_spec.rb
|
@@ -207,4 +209,3 @@ test_files:
|
|
207
209
|
- spec/support/with_model.rb
|
208
210
|
- spec/support/xsd/XMLSchema.xsd
|
209
211
|
- spec/support/xsd/xml.xsd
|
210
|
-
has_rdoc:
|