lutaml-xsd 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile +6 -0
- data/LICENSE.md +33 -0
- data/README.adoc +141 -0
- data/lib/lutaml/xsd/all.rb +24 -0
- data/lib/lutaml/xsd/annotation.rb +20 -0
- data/lib/lutaml/xsd/any.rb +26 -0
- data/lib/lutaml/xsd/any_attribute.rb +22 -0
- data/lib/lutaml/xsd/appinfo.rb +18 -0
- data/lib/lutaml/xsd/attribute.rb +34 -0
- data/lib/lutaml/xsd/attribute_group.rb +28 -0
- data/lib/lutaml/xsd/choice.rb +35 -0
- data/lib/lutaml/xsd/complex_content.rb +26 -0
- data/lib/lutaml/xsd/complex_type.rb +44 -0
- data/lib/lutaml/xsd/documentation.rb +20 -0
- data/lib/lutaml/xsd/element.rb +54 -0
- data/lib/lutaml/xsd/enumeration.rb +18 -0
- data/lib/lutaml/xsd/extension_complex_content.rb +34 -0
- data/lib/lutaml/xsd/extension_simple_content.rb +26 -0
- data/lib/lutaml/xsd/field.rb +18 -0
- data/lib/lutaml/xsd/fraction_digits.rb +22 -0
- data/lib/lutaml/xsd/glob.rb +63 -0
- data/lib/lutaml/xsd/group.rb +35 -0
- data/lib/lutaml/xsd/import.rb +26 -0
- data/lib/lutaml/xsd/include.rb +24 -0
- data/lib/lutaml/xsd/key.rb +25 -0
- data/lib/lutaml/xsd/keyref.rb +26 -0
- data/lib/lutaml/xsd/length.rb +20 -0
- data/lib/lutaml/xsd/list.rb +21 -0
- data/lib/lutaml/xsd/max_exclusive.rb +18 -0
- data/lib/lutaml/xsd/max_inclusive.rb +16 -0
- data/lib/lutaml/xsd/max_length.rb +18 -0
- data/lib/lutaml/xsd/min_exclusive.rb +18 -0
- data/lib/lutaml/xsd/min_inclusive.rb +16 -0
- data/lib/lutaml/xsd/min_length.rb +18 -0
- data/lib/lutaml/xsd/notation.rb +24 -0
- data/lib/lutaml/xsd/pattern.rb +18 -0
- data/lib/lutaml/xsd/redefine.rb +28 -0
- data/lib/lutaml/xsd/restriction_complex_content.rb +34 -0
- data/lib/lutaml/xsd/restriction_simple_content.rb +52 -0
- data/lib/lutaml/xsd/restriction_simple_type.rb +46 -0
- data/lib/lutaml/xsd/schema.rb +176 -0
- data/lib/lutaml/xsd/selector.rb +20 -0
- data/lib/lutaml/xsd/sequence.rb +34 -0
- data/lib/lutaml/xsd/simple_content.rb +24 -0
- data/lib/lutaml/xsd/simple_type.rb +28 -0
- data/lib/lutaml/xsd/total_digits.rb +22 -0
- data/lib/lutaml/xsd/union.rb +22 -0
- data/lib/lutaml/xsd/unique.rb +24 -0
- data/lib/lutaml/xsd/version.rb +1 -1
- data/lib/lutaml/xsd/white_space.rb +20 -0
- data/lib/lutaml/xsd/xsd.rb +16 -0
- data/lib/lutaml/xsd.rb +9 -7
- data/lutaml-xsd.gemspec +3 -0
- metadata +84 -9
- data/LICENSE.txt +0 -21
- data/README.md +0 -43
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class FractionDigits < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :value, :string
|
8
|
+
attribute :fixed, :string
|
9
|
+
attribute :annotation, Annotation
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "fractionDigits", mixed: true
|
13
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
14
|
+
|
15
|
+
map_attribute :id, to: :id
|
16
|
+
map_attribute :value, to: :value
|
17
|
+
map_attribute :fixed, to: :fixed
|
18
|
+
map_element :annotation, to: :annotation
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
|
5
|
+
module Lutaml
|
6
|
+
module Xsd
|
7
|
+
module Glob
|
8
|
+
extend self
|
9
|
+
|
10
|
+
def path_or_url(location)
|
11
|
+
return nullify_location if location.nil?
|
12
|
+
|
13
|
+
@location = location
|
14
|
+
@url = location if location.start_with?(%r{http\w?:/{2}[^.]+})
|
15
|
+
@path = File.expand_path(location) unless @url
|
16
|
+
rescue Errno::ENOENT
|
17
|
+
raise Error, "Invalid location: #{location}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def location
|
21
|
+
@location
|
22
|
+
end
|
23
|
+
|
24
|
+
def path?
|
25
|
+
!@path.nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
def url?
|
29
|
+
!@url.nil?
|
30
|
+
end
|
31
|
+
|
32
|
+
def location?
|
33
|
+
url? || path?
|
34
|
+
end
|
35
|
+
|
36
|
+
def http_get(url)
|
37
|
+
Net::HTTP.get(URI.parse(url))
|
38
|
+
end
|
39
|
+
|
40
|
+
def include_schema(schema_location)
|
41
|
+
return unless location? || schema_location
|
42
|
+
|
43
|
+
schema_path = schema_location_path(schema_location)
|
44
|
+
url? ? http_get(schema_path) : File.read(schema_path)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def schema_location_path(schema_location)
|
50
|
+
separator = "/" unless schema_location&.start_with?("/") || location&.end_with?("/")
|
51
|
+
|
52
|
+
location_params = [location, schema_location].compact
|
53
|
+
url? ? location_params.join(separator) : File.join(location_params)
|
54
|
+
end
|
55
|
+
|
56
|
+
def nullify_location
|
57
|
+
@location = nil
|
58
|
+
@path = nil
|
59
|
+
@url = nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Sequence < Model::Serializable; end
|
6
|
+
class Choice < Model::Serializable; end
|
7
|
+
|
8
|
+
class Group < Model::Serializable
|
9
|
+
attribute :id, :string
|
10
|
+
attribute :ref, :string
|
11
|
+
attribute :name, :string
|
12
|
+
attribute :min_occurs, :string
|
13
|
+
attribute :max_occurs, :string
|
14
|
+
attribute :all, All
|
15
|
+
attribute :choice, Choice
|
16
|
+
attribute :sequence, Sequence
|
17
|
+
attribute :annotation, Annotation
|
18
|
+
|
19
|
+
xml do
|
20
|
+
root "group", mixed: true
|
21
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
22
|
+
|
23
|
+
map_attribute :id, to: :id
|
24
|
+
map_attribute :ref, to: :ref
|
25
|
+
map_attribute :name, to: :name
|
26
|
+
map_attribute :minOccurs, to: :min_occurs
|
27
|
+
map_attribute :maxOccurs, to: :max_occurs
|
28
|
+
map_element :annotation, to: :annotation
|
29
|
+
map_element :sequence, to: :sequence
|
30
|
+
map_element :choice, to: :choice
|
31
|
+
map_element :all, to: :all
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Import < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :namespace, :string
|
8
|
+
attribute :schema_path, :string
|
9
|
+
attribute :annotation, Annotation
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "import", mixed: true
|
13
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
14
|
+
|
15
|
+
map_attribute :id, to: :id
|
16
|
+
map_attribute :namespace, to: :namespace
|
17
|
+
map_attribute :schemaLocation, to: :schema_path
|
18
|
+
map_element :annotation, to: :annotation
|
19
|
+
end
|
20
|
+
|
21
|
+
def fetch_schema
|
22
|
+
Glob.include_schema(schema_path) if schema_path
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Include < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :schema_path, :string
|
8
|
+
attribute :annotation, Annotation
|
9
|
+
|
10
|
+
xml do
|
11
|
+
root "include", mixed: true
|
12
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
13
|
+
|
14
|
+
map_attribute :id, to: :id
|
15
|
+
map_attribute :schemaLocation, to: :schema_path
|
16
|
+
map_element :annotation, to: :annotation
|
17
|
+
end
|
18
|
+
|
19
|
+
def fetch_schema
|
20
|
+
Glob.include_schema(schema_path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Key < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :name, :string
|
8
|
+
attribute :selector, Selector
|
9
|
+
attribute :annotation, Annotation
|
10
|
+
attribute :field, Field, collection: true
|
11
|
+
# Field should be one or more
|
12
|
+
|
13
|
+
xml do
|
14
|
+
root "key", mixed: true
|
15
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
16
|
+
|
17
|
+
map_attribute :id, to: :id
|
18
|
+
map_attribute :name, to: :name
|
19
|
+
map_element :annotation, to: :annotation
|
20
|
+
map_element :selector, to: :selector
|
21
|
+
map_element :field, to: :field
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Keyref < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :name, :string
|
8
|
+
attribute :refer, :string
|
9
|
+
attribute :selector, Selector
|
10
|
+
attribute :annotation, Annotation
|
11
|
+
attribute :field, Field, collection: true
|
12
|
+
# Field should be one or more
|
13
|
+
|
14
|
+
xml do
|
15
|
+
root "keyref", mixed: true
|
16
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
17
|
+
|
18
|
+
map_attribute :id, to: :id
|
19
|
+
map_attribute :name, to: :name
|
20
|
+
map_element :field, to: :field
|
21
|
+
map_element :selector, to: :selector
|
22
|
+
map_element :annotation, to: :annotation
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Length < Model::Serializable
|
6
|
+
attribute :fixed, :boolean
|
7
|
+
attribute :value, :integer
|
8
|
+
attribute :annotation, Annotation
|
9
|
+
|
10
|
+
xml do
|
11
|
+
root "length", mixed: true
|
12
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
13
|
+
|
14
|
+
map_attribute :fixed, to: :fixed
|
15
|
+
map_attribute :value, to: :value
|
16
|
+
map_element :annotation, to: :annotation
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class List < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :item_type, :string
|
8
|
+
attribute :annotation, Annotation
|
9
|
+
attribute :simple_type, SimpleType
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "list", mixed: true
|
13
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
14
|
+
|
15
|
+
map_attribute :id, to: :id
|
16
|
+
map_attribute :itemType, to: :item_type
|
17
|
+
map_element :annotation, to: :annotation
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MaxExclusive < Model::Serializable
|
6
|
+
attribute :fixed, :string
|
7
|
+
attribute :value, :integer
|
8
|
+
|
9
|
+
xml do
|
10
|
+
root "maxExclusive", mixed: true
|
11
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
12
|
+
|
13
|
+
map_attribute :value, to: :value
|
14
|
+
map_attribute :fixed, to: :fixed
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MaxInclusive < Model::Serializable
|
6
|
+
attribute :value, :string
|
7
|
+
|
8
|
+
xml do
|
9
|
+
root "maxInclusive", mixed: true
|
10
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
11
|
+
|
12
|
+
map_attribute :value, to: :value
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MaxLength < Model::Serializable
|
6
|
+
attribute :fixed, :string
|
7
|
+
attribute :value, :integer
|
8
|
+
|
9
|
+
xml do
|
10
|
+
root "maxLength", mixed: true
|
11
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
12
|
+
|
13
|
+
map_attribute :value, to: :value
|
14
|
+
map_attribute :fixed, to: :fixed
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MinExclusive < Model::Serializable
|
6
|
+
attribute :fixed, :string
|
7
|
+
attribute :value, :integer
|
8
|
+
|
9
|
+
xml do
|
10
|
+
root "minExclusive", mixed: true
|
11
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
12
|
+
|
13
|
+
map_attribute :value, to: :value
|
14
|
+
map_attribute :fixed, to: :fixed
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MinInclusive < Model::Serializable
|
6
|
+
attribute :value, :string
|
7
|
+
|
8
|
+
xml do
|
9
|
+
root "minInclusive", mixed: true
|
10
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
11
|
+
|
12
|
+
map_attribute :value, to: :value
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class MinLength < Model::Serializable
|
6
|
+
attribute :fixed, :string
|
7
|
+
attribute :value, :integer
|
8
|
+
|
9
|
+
xml do
|
10
|
+
root "minLength", mixed: true
|
11
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
12
|
+
|
13
|
+
map_attribute :value, to: :value
|
14
|
+
map_attribute :fixed, to: :fixed
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Notation < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :name, :string
|
8
|
+
attribute :public, :string
|
9
|
+
attribute :system, :string
|
10
|
+
attribute :annotation, Annotation
|
11
|
+
|
12
|
+
xml do
|
13
|
+
root "notation", mixed: true
|
14
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
15
|
+
|
16
|
+
map_attribute :id, to: :id
|
17
|
+
map_attribute :name, to: :name
|
18
|
+
map_attribute :public, to: :public
|
19
|
+
map_attribute :system, to: :system
|
20
|
+
map_element :annotation, to: :annotation
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Pattern < Model::Serializable
|
6
|
+
attribute :value, :string
|
7
|
+
attribute :annotation, Annotation
|
8
|
+
|
9
|
+
xml do
|
10
|
+
root "pattern", mixed: true
|
11
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
12
|
+
|
13
|
+
map_attribute :value, to: :value
|
14
|
+
map_element :annotation, to: :annotation
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class Redefine < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :schema_path, :string
|
8
|
+
attribute :group, Group
|
9
|
+
attribute :annotation, Annotation
|
10
|
+
attribute :simple_type, SimpleType
|
11
|
+
attribute :complex_type, ComplexType
|
12
|
+
attribute :attribute_group, AttributeGroup
|
13
|
+
|
14
|
+
xml do
|
15
|
+
root "redefine", mixed: true
|
16
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
17
|
+
|
18
|
+
map_attribute :id, to: :id
|
19
|
+
map_attribute :schema_location, to: :schema_path
|
20
|
+
map_element :group, to: :group
|
21
|
+
map_element :annotation, to: :annotation
|
22
|
+
map_element :simpleType, to: :simpleType
|
23
|
+
map_element :complexType, to: :complexType
|
24
|
+
map_element :attributeGroup, to: :attributeGroup
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class RestrictionComplexContent < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :base, :string
|
8
|
+
attribute :all, All
|
9
|
+
attribute :group, Group
|
10
|
+
attribute :choice, Choice
|
11
|
+
attribute :sequence, Sequence
|
12
|
+
attribute :annotation, Annotation
|
13
|
+
attribute :any_attribute, AnyAttribute
|
14
|
+
attribute :attribute, Attribute, collection: true
|
15
|
+
attribute :attribute_group, AttributeGroup, collection: true
|
16
|
+
|
17
|
+
xml do
|
18
|
+
root "restriction", mixed: true
|
19
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
20
|
+
|
21
|
+
map_attribute :id, to: :id
|
22
|
+
map_attribute :base, to: :base
|
23
|
+
map_element :all, to: :all
|
24
|
+
map_element :group, to: :group
|
25
|
+
map_element :choice, to: :choice
|
26
|
+
map_element :sequence, to: :sequence
|
27
|
+
map_element :attribute, to: :attribute
|
28
|
+
map_element :annotation, to: :annotation
|
29
|
+
map_element :anyAttribute, to: :any_attribute
|
30
|
+
map_element :attributeGroup, to: :attribute_group
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class RestrictionSimpleContent < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :base, :string
|
8
|
+
attribute :annotation, Annotation
|
9
|
+
attribute :simple_type, SimpleType
|
10
|
+
attribute :any_attribute, AnyAttribute
|
11
|
+
attribute :length, Length, collection: true
|
12
|
+
attribute :pattern, Pattern, collection: true
|
13
|
+
attribute :attribute, Attribute, collection: true
|
14
|
+
attribute :max_length, MaxLength, collection: true
|
15
|
+
attribute :min_length, MinLength, collection: true
|
16
|
+
attribute :white_space, WhiteSpace, collection: true
|
17
|
+
attribute :enumeration, Enumeration, collection: true
|
18
|
+
attribute :total_digits, TotalDigits, collection: true
|
19
|
+
attribute :min_exclusive, MinExclusive, collection: true
|
20
|
+
attribute :min_inclusive, MinInclusive, collection: true
|
21
|
+
attribute :max_exclusive, MaxExclusive, collection: true
|
22
|
+
attribute :max_inclusive, MaxInclusive, collection: true
|
23
|
+
attribute :attribute_group, AttributeGroup, collection: true
|
24
|
+
attribute :fraction_digits, FractionDigits, collection: true
|
25
|
+
|
26
|
+
xml do
|
27
|
+
root "restriction", mixed: true
|
28
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
29
|
+
|
30
|
+
map_attribute :id, to: :id
|
31
|
+
map_attribute :base, to: :base
|
32
|
+
map_element :fractionDigits, to: :fraction_digits
|
33
|
+
map_element :attributeGroup, to: :attribute_group
|
34
|
+
map_element :minInclusive, to: :min_inclusive
|
35
|
+
map_element :maxInclusive, to: :max_inclusive
|
36
|
+
map_element :anyAttribute, to: :any_attribute
|
37
|
+
map_element :minExclusive, to: :min_exclusive
|
38
|
+
map_element :maxExclusive, to: :max_exclusive
|
39
|
+
map_element :totalDigits, to: :total_digits
|
40
|
+
map_element :enumeration, to: :enumeration
|
41
|
+
map_element :simpleType, to: :simple_type
|
42
|
+
map_element :whiteSpace, to: :white_space
|
43
|
+
map_element :annotation, to: :annotation
|
44
|
+
map_element :maxLength, to: :max_length
|
45
|
+
map_element :minLength, to: :min_length
|
46
|
+
map_element :attribute, to: :attribute
|
47
|
+
map_element :pattern, to: :pattern
|
48
|
+
map_element :length, to: :length
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Xsd
|
5
|
+
class RestrictionSimpleType < Model::Serializable
|
6
|
+
attribute :id, :string
|
7
|
+
attribute :base, :string
|
8
|
+
attribute :annotation, Annotation
|
9
|
+
attribute :simple_type, SimpleType
|
10
|
+
attribute :length, Length, collection: true
|
11
|
+
attribute :pattern, Pattern, collection: true
|
12
|
+
attribute :min_length, MinLength, collection: true
|
13
|
+
attribute :max_length, MaxLength, collection: true
|
14
|
+
attribute :white_space, WhiteSpace, collection: true
|
15
|
+
attribute :enumeration, Enumeration, collection: true
|
16
|
+
attribute :total_digits, TotalDigits, collection: true
|
17
|
+
attribute :max_exclusive, MaxExclusive, collection: true
|
18
|
+
attribute :min_exclusive, MinExclusive, collection: true
|
19
|
+
attribute :max_inclusive, MaxInclusive, collection: true
|
20
|
+
attribute :min_inclusive, MinInclusive, collection: true
|
21
|
+
attribute :fraction_digits, FractionDigits, collection: true
|
22
|
+
|
23
|
+
xml do
|
24
|
+
root "restriction", mixed: true
|
25
|
+
namespace "http://www.w3.org/2001/XMLSchema", "xsd"
|
26
|
+
|
27
|
+
map_attribute :id, to: :id
|
28
|
+
map_attribute :base, to: :base
|
29
|
+
map_element :length, to: :length
|
30
|
+
map_element :pattern, to: :pattern
|
31
|
+
map_element :minLength, to: :min_length
|
32
|
+
map_element :maxLength, to: :max_length
|
33
|
+
map_element :annotation, to: :annotation
|
34
|
+
map_element :whiteSpace, to: :white_space
|
35
|
+
map_element :simple_type, to: :simple_type
|
36
|
+
map_element :enumeration, to: :enumeration
|
37
|
+
map_element :totalDigits, to: :total_digits
|
38
|
+
map_element :maxExclusive, to: :max_exclusive
|
39
|
+
map_element :minExclusive, to: :min_exclusive
|
40
|
+
map_element :maxInclusive, to: :max_inclusive
|
41
|
+
map_element :minInclusive, to: :min_inclusive
|
42
|
+
map_element :fractionDigits, to: :fraction_digits
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|