metaschema 0.1.2 → 0.2.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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +19 -1
  3. data/.rubocop_todo.yml +558 -8
  4. data/CLAUDE.md +78 -0
  5. data/Rakefile +3 -3
  6. data/exe/metaschema +1 -2
  7. data/lib/metaschema/allowed_value_type.rb +18 -25
  8. data/lib/metaschema/allowed_values_type.rb +15 -22
  9. data/lib/metaschema/anchor_type.rb +15 -20
  10. data/lib/metaschema/any_type.rb +2 -4
  11. data/lib/metaschema/assembly.rb +18 -27
  12. data/lib/metaschema/assembly_model_type.rb +10 -19
  13. data/lib/metaschema/assembly_reference_type.rb +16 -24
  14. data/lib/metaschema/augment_type.rb +39 -0
  15. data/lib/metaschema/block_quote_type.rb +17 -25
  16. data/lib/metaschema/choice_type.rb +6 -13
  17. data/lib/metaschema/code_type.rb +17 -23
  18. data/lib/metaschema/constraint_let_type.rb +5 -9
  19. data/lib/metaschema/constraint_validator.rb +483 -0
  20. data/lib/metaschema/define_assembly_constraints_type.rb +17 -26
  21. data/lib/metaschema/define_field_constraints_type.rb +13 -19
  22. data/lib/metaschema/define_flag_constraints_type.rb +9 -17
  23. data/lib/metaschema/example_type.rb +6 -11
  24. data/lib/metaschema/expect_constraint_type.rb +12 -18
  25. data/lib/metaschema/field.rb +13 -20
  26. data/lib/metaschema/field_reference_type.rb +19 -27
  27. data/lib/metaschema/flag.rb +9 -18
  28. data/lib/metaschema/flag_reference_type.rb +14 -21
  29. data/lib/metaschema/formal_name.rb +9 -0
  30. data/lib/metaschema/global_assembly_definition_type.rb +21 -34
  31. data/lib/metaschema/global_field_definition_type.rb +26 -39
  32. data/lib/metaschema/global_flag_definition_type.rb +18 -27
  33. data/lib/metaschema/group_as_type.rb +7 -9
  34. data/lib/metaschema/grouped_assembly_reference_type.rb +11 -18
  35. data/lib/metaschema/grouped_choice_type.rb +16 -24
  36. data/lib/metaschema/grouped_field_reference_type.rb +11 -18
  37. data/lib/metaschema/grouped_inline_assembly_definition_type.rb +17 -29
  38. data/lib/metaschema/grouped_inline_field_definition_type.rb +26 -37
  39. data/lib/metaschema/image_type.rb +5 -7
  40. data/lib/metaschema/import.rb +3 -5
  41. data/lib/metaschema/index_has_key_constraint_type.rb +12 -19
  42. data/lib/metaschema/inline_assembly_definition_type.rb +25 -38
  43. data/lib/metaschema/inline_field_definition_type.rb +31 -43
  44. data/lib/metaschema/inline_flag_definition_type.rb +17 -25
  45. data/lib/metaschema/inline_markup_type.rb +17 -22
  46. data/lib/metaschema/insert_type.rb +4 -6
  47. data/lib/metaschema/json_base_uri.rb +9 -0
  48. data/lib/metaschema/json_key_type.rb +3 -5
  49. data/lib/metaschema/json_schema_generator.rb +456 -0
  50. data/lib/metaschema/json_value_key.rb +9 -0
  51. data/lib/metaschema/json_value_key_flag_type.rb +3 -5
  52. data/lib/metaschema/key_field.rb +5 -9
  53. data/lib/metaschema/list_item_type.rb +29 -39
  54. data/lib/metaschema/list_type.rb +3 -7
  55. data/lib/metaschema/markdown_doc_generator.rb +354 -0
  56. data/lib/metaschema/markup_line_datatype.rb +16 -23
  57. data/lib/metaschema/matches_constraint_type.rb +12 -18
  58. data/lib/metaschema/metapath_evaluator.rb +385 -0
  59. data/lib/metaschema/metaschema_constraints.rb +24 -0
  60. data/lib/metaschema/metaschema_import_type.rb +3 -5
  61. data/lib/metaschema/model_generator.rb +2175 -0
  62. data/lib/metaschema/namespace.rb +8 -0
  63. data/lib/metaschema/namespace_binding_type.rb +4 -6
  64. data/lib/metaschema/namespace_value.rb +9 -0
  65. data/lib/metaschema/ordered_list_type.rb +4 -8
  66. data/lib/metaschema/preformatted_type.rb +16 -23
  67. data/lib/metaschema/property_type.rb +6 -8
  68. data/lib/metaschema/remarks_type.rb +18 -27
  69. data/lib/metaschema/root.rb +23 -31
  70. data/lib/metaschema/root_name.rb +3 -5
  71. data/lib/metaschema/ruby_source_emitter.rb +869 -0
  72. data/lib/metaschema/schema_version.rb +9 -0
  73. data/lib/metaschema/scope.rb +7 -13
  74. data/lib/metaschema/short_name.rb +9 -0
  75. data/lib/metaschema/table_cell_type.rb +18 -25
  76. data/lib/metaschema/table_row_type.rb +4 -8
  77. data/lib/metaschema/table_type.rb +3 -7
  78. data/lib/metaschema/targeted_allowed_values_constraint_type.rb +16 -23
  79. data/lib/metaschema/targeted_expect_constraint_type.rb +13 -19
  80. data/lib/metaschema/targeted_has_cardinality_constraint_type.rb +13 -19
  81. data/lib/metaschema/targeted_index_constraint_type.rb +13 -20
  82. data/lib/metaschema/targeted_index_has_key_constraint_type.rb +13 -20
  83. data/lib/metaschema/targeted_key_constraint_type.rb +12 -19
  84. data/lib/metaschema/targeted_matches_constraint_type.rb +13 -19
  85. data/lib/metaschema/type_mapper.rb +82 -0
  86. data/lib/metaschema/use_name_type.rb +3 -5
  87. data/lib/metaschema/version.rb +1 -1
  88. data/lib/metaschema.rb +97 -9
  89. metadata +28 -95
  90. data/lib/metaschema/metaschemaconstraints.rb +0 -31
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require 'rubocop/rake_task'
8
+ require "rubocop/rake_task"
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
data/exe/metaschema CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative '../lib/metaschema'
5
- require_relative '../lib/metaschema/cli'
4
+ require_relative "../lib/metaschema"
6
5
 
7
6
  Metaschema::Cli::Commands.start(ARGV)
@@ -1,16 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'anchor_type'
6
- require_relative 'code_type'
7
- require_relative 'image_type'
8
- require_relative 'inline_markup_type'
9
- require_relative 'insert_type'
10
-
11
3
  module Metaschema
12
4
  class AllowedValueType < Lutaml::Model::Serializable
13
- attribute :content, :string
5
+ attribute :content, :string, collection: true
14
6
  attribute :value, :string
15
7
  attribute :deprecated, :string
16
8
  attribute :a, AnchorType, collection: true
@@ -27,24 +19,25 @@ module Metaschema
27
19
  attribute :img, ImageType, collection: true
28
20
 
29
21
  xml do
30
- root 'AllowedValueType', mixed: true
31
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
22
+ element "AllowedValueType"
23
+ mixed_content
24
+ namespace ::Metaschema::Namespace
32
25
 
33
26
  map_content to: :content
34
- map_attribute 'value', to: :value
35
- map_attribute 'deprecated', to: :deprecated
36
- map_element 'a', to: :a
37
- map_element 'insert', to: :insert
38
- map_element 'br', to: :br
39
- map_element 'code', to: :code
40
- map_element 'em', to: :em
41
- map_element 'i', to: :i
42
- map_element 'b', to: :b
43
- map_element 'strong', to: :strong
44
- map_element 'sub', to: :sub
45
- map_element 'sup', to: :sup
46
- map_element 'q', to: :q
47
- map_element 'img', to: :img
27
+ map_attribute "value", to: :value
28
+ map_attribute "deprecated", to: :deprecated
29
+ map_element "a", to: :a
30
+ map_element "insert", to: :insert
31
+ map_element "br", to: :br
32
+ map_element "code", to: :code
33
+ map_element "em", to: :em
34
+ map_element "i", to: :i
35
+ map_element "b", to: :b
36
+ map_element "strong", to: :strong
37
+ map_element "sub", to: :sub
38
+ map_element "sup", to: :sup
39
+ map_element "q", to: :q
40
+ map_element "img", to: :img
48
41
  end
49
42
  end
50
43
  end
@@ -1,37 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'allowed_value_type'
6
- require_relative 'markup_line_datatype'
7
- require_relative 'property_type'
8
- require_relative 'remarks_type'
9
-
10
3
  module Metaschema
11
4
  class AllowedValuesType < Lutaml::Model::Serializable
12
5
  attribute :id, :string
13
- attribute :level, :string, default: -> { 'ERROR' }
14
- attribute :allow_other, :string, default: -> { 'no' }
15
- attribute :extensible, :string, default: -> { 'external' }
16
- attribute :formal_name, :string
6
+ attribute :level, :string, default: -> { "ERROR" }
7
+ attribute :allow_other, :string, default: -> { "no" }
8
+ attribute :extensible, :string, default: -> { "external" }
9
+ attribute :formal_name, FormalName
17
10
  attribute :description, MarkupLineDatatype
18
11
  attribute :prop, PropertyType, collection: true
19
12
  attribute :enum, AllowedValueType, collection: true
20
13
  attribute :remarks, RemarksType
21
14
 
22
15
  xml do
23
- root 'AllowedValuesType'
24
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
16
+ element "AllowedValuesType"
17
+ namespace ::Metaschema::Namespace
25
18
 
26
- map_attribute 'id', to: :id
27
- map_attribute 'level', to: :level
28
- map_attribute 'allow-other', to: :allow_other
29
- map_attribute 'extensible', to: :extensible
30
- map_element 'formal-name', to: :formal_name
31
- map_element 'description', to: :description
32
- map_element 'prop', to: :prop
33
- map_element 'enum', to: :enum
34
- map_element 'remarks', to: :remarks
19
+ map_attribute "id", to: :id
20
+ map_attribute "level", to: :level
21
+ map_attribute "allow-other", to: :allow_other
22
+ map_attribute "extensible", to: :extensible
23
+ map_element "formal-name", to: :formal_name
24
+ map_element "description", to: :description
25
+ map_element "prop", to: :prop
26
+ map_element "enum", to: :enum
27
+ map_element "remarks", to: :remarks
35
28
  end
36
29
  end
37
30
  end
@@ -1,14 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'code_type'
6
- require_relative 'image_type'
7
- require_relative 'inline_markup_type'
8
-
9
3
  module Metaschema
10
4
  class AnchorType < Lutaml::Model::Serializable
11
- attribute :content, :string
5
+ attribute :content, :string, collection: true
12
6
  attribute :href, :string
13
7
  attribute :title, :string
14
8
  attribute :code, CodeType, collection: true
@@ -22,21 +16,22 @@ module Metaschema
22
16
  attribute :img, ImageType, collection: true
23
17
 
24
18
  xml do
25
- root 'anchorType', mixed: true
26
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
19
+ element "anchorType"
20
+ mixed_content
21
+ namespace ::Metaschema::Namespace
27
22
 
28
23
  map_content to: :content
29
- map_attribute 'href', to: :href
30
- map_attribute 'title', to: :title
31
- map_element 'code', to: :code
32
- map_element 'em', to: :em
33
- map_element 'i', to: :i
34
- map_element 'b', to: :b
35
- map_element 'strong', to: :strong
36
- map_element 'sub', to: :sub
37
- map_element 'sup', to: :sup
38
- map_element 'q', to: :q
39
- map_element 'img', to: :img
24
+ map_attribute "href", to: :href
25
+ map_attribute "title", to: :title
26
+ map_element "code", to: :code
27
+ map_element "em", to: :em
28
+ map_element "i", to: :i
29
+ map_element "b", to: :b
30
+ map_element "strong", to: :strong
31
+ map_element "sub", to: :sub
32
+ map_element "sup", to: :sup
33
+ map_element "q", to: :q
34
+ map_element "img", to: :img
40
35
  end
41
36
  end
42
37
  end
@@ -1,12 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
3
  module Metaschema
6
4
  class AnyType < Lutaml::Model::Serializable
7
5
  xml do
8
- root 'AnyType'
9
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
6
+ element "AnyType"
7
+ namespace ::Metaschema::Namespace
10
8
  end
11
9
  end
12
10
  end
@@ -1,44 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'constraint_let_type'
6
- require_relative 'remarks_type'
7
- require_relative 'targeted_allowed_values_constraint_type'
8
- require_relative 'targeted_expect_constraint_type'
9
- require_relative 'targeted_has_cardinality_constraint_type'
10
- require_relative 'targeted_index_constraint_type'
11
- require_relative 'targeted_index_has_key_constraint_type'
12
- require_relative 'targeted_key_constraint_type'
13
- require_relative 'targeted_matches_constraint_type'
14
-
15
3
  module Metaschema
16
4
  class Assembly < Lutaml::Model::Serializable
17
5
  attribute :target, :string
18
6
  attribute :let, ConstraintLetType, collection: true
19
- attribute :allowed_values, TargetedAllowedValuesConstraintType, collection: true
7
+ attribute :allowed_values, TargetedAllowedValuesConstraintType,
8
+ collection: true
20
9
  attribute :matches, TargetedMatchesConstraintType, collection: true
21
- attribute :index_has_key, TargetedIndexHasKeyConstraintType, collection: true
10
+ attribute :index_has_key, TargetedIndexHasKeyConstraintType,
11
+ collection: true
22
12
  attribute :expect, TargetedExpectConstraintType, collection: true
23
13
  attribute :index, TargetedIndexConstraintType, collection: true
24
14
  attribute :is_unique, TargetedKeyConstraintType, collection: true
25
- attribute :has_cardinality, TargetedHasCardinalityConstraintType, collection: true
15
+ attribute :has_cardinality, TargetedHasCardinalityConstraintType,
16
+ collection: true
26
17
  attribute :remarks, RemarksType
27
18
 
28
19
  xml do
29
- root 'assembly'
30
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
20
+ element "assembly"
21
+ namespace ::Metaschema::Namespace
31
22
 
32
- map_attribute 'target', to: :target
33
- map_element 'let', to: :let
34
- map_element 'is-unique', to: :is_unique
35
- map_element 'allowed-values', to: :allowed_values
36
- map_element 'matches', to: :matches
37
- map_element 'index-has-key', to: :index_has_key
38
- map_element 'expect', to: :expect
39
- map_element 'index', to: :index
40
- map_element 'has-cardinality', to: :has_cardinality
41
- map_element 'remarks', to: :remarks
23
+ map_attribute "target", to: :target
24
+ map_element "let", to: :let
25
+ map_element "is-unique", to: :is_unique
26
+ map_element "allowed-values", to: :allowed_values
27
+ map_element "matches", to: :matches
28
+ map_element "index-has-key", to: :index_has_key
29
+ map_element "expect", to: :expect
30
+ map_element "index", to: :index
31
+ map_element "has-cardinality", to: :has_cardinality
32
+ map_element "remarks", to: :remarks
42
33
  end
43
34
  end
44
35
  end
@@ -1,15 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'any_type'
6
- require_relative 'assembly_reference_type'
7
- require_relative 'choice_type'
8
- require_relative 'field_reference_type'
9
- require_relative 'grouped_choice_type'
10
- require_relative 'inline_assembly_definition_type'
11
- require_relative 'inline_field_definition_type'
12
-
13
3
  module Metaschema
14
4
  class AssemblyModelType < Lutaml::Model::Serializable
15
5
  attribute :assembly, AssemblyReferenceType, collection: true
@@ -21,16 +11,17 @@ module Metaschema
21
11
  attribute :any, AnyType
22
12
 
23
13
  xml do
24
- root 'AssemblyModelType', ordered: true
25
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
14
+ element "AssemblyModelType"
15
+ ordered
16
+ namespace ::Metaschema::Namespace
26
17
 
27
- map_element 'field', to: :field
28
- map_element 'define-assembly', to: :define_assembly
29
- map_element 'assembly', to: :assembly
30
- map_element 'define-field', to: :define_field
31
- map_element 'choice', to: :choice
32
- map_element 'choice-group', to: :choice_group
33
- map_element 'any', to: :any
18
+ map_element "field", to: :field
19
+ map_element "define-assembly", to: :define_assembly
20
+ map_element "assembly", to: :assembly
21
+ map_element "define-field", to: :define_field
22
+ map_element "choice", to: :choice
23
+ map_element "choice-group", to: :choice_group
24
+ map_element "any", to: :any
34
25
  end
35
26
  end
36
27
  end
@@ -1,21 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'group_as_type'
6
- require_relative 'markup_line_datatype'
7
- require_relative 'property_type'
8
- require_relative 'remarks_type'
9
- require_relative 'use_name_type'
10
-
11
3
  module Metaschema
12
4
  class AssemblyReferenceType < Lutaml::Model::Serializable
13
5
  attribute :ref, :string
14
6
  attribute :index, :integer
15
- attribute :min_occurs, :integer, default: -> { '0' }
16
- attribute :max_occurs, :string, default: -> { '1' }
7
+ attribute :min_occurs, :integer, default: -> { "0" }
8
+ attribute :max_occurs, :string, default: -> { "1" }
17
9
  attribute :deprecated, :string
18
- attribute :formal_name, :string
10
+ attribute :formal_name, FormalName
19
11
  attribute :description, MarkupLineDatatype
20
12
  attribute :prop, PropertyType, collection: true
21
13
  attribute :use_name, UseNameType
@@ -23,20 +15,20 @@ module Metaschema
23
15
  attribute :remarks, RemarksType
24
16
 
25
17
  xml do
26
- root 'AssemblyReferenceType'
27
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
18
+ element "AssemblyReferenceType"
19
+ namespace ::Metaschema::Namespace
28
20
 
29
- map_attribute 'ref', to: :ref
30
- map_attribute 'index', to: :index
31
- map_attribute 'min-occurs', to: :min_occurs
32
- map_attribute 'max-occurs', to: :max_occurs
33
- map_attribute 'deprecated', to: :deprecated
34
- map_element 'formal-name', to: :formal_name
35
- map_element 'description', to: :description
36
- map_element 'prop', to: :prop
37
- map_element 'use-name', to: :use_name
38
- map_element 'group-as', to: :group_as
39
- map_element 'remarks', to: :remarks
21
+ map_attribute "ref", to: :ref
22
+ map_attribute "index", to: :index
23
+ map_attribute "min-occurs", to: :min_occurs
24
+ map_attribute "max-occurs", to: :max_occurs
25
+ map_attribute "deprecated", to: :deprecated
26
+ map_element "formal-name", to: :formal_name
27
+ map_element "description", to: :description
28
+ map_element "prop", to: :prop
29
+ map_element "use-name", to: :use_name
30
+ map_element "group-as", to: :group_as
31
+ map_element "remarks", to: :remarks
40
32
  end
41
33
  end
42
34
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metaschema
4
+ # Represents an <augment> element in a metaschema document.
5
+ # Augments add documentation, flags, or properties to definitions
6
+ # from imported modules without modifying the original module.
7
+ #
8
+ # Example:
9
+ # <augment name="metadata">
10
+ # <formal-name>Document Metadata</formal-name>
11
+ # <description>Provides information about the document.</description>
12
+ # <flag ref="document-id" />
13
+ # </augment>
14
+ class AugmentType < Lutaml::Model::Serializable
15
+ attribute :name, :string
16
+ attribute :formal_name, FormalName
17
+ attribute :description, MarkupLineDatatype
18
+ attribute :prop, PropertyType, collection: true
19
+ attribute :remarks, RemarksType
20
+ attribute :example, ExampleType, collection: true
21
+ attribute :flag, FlagReferenceType, collection: true
22
+ attribute :define_flag, InlineFlagDefinitionType, collection: true
23
+
24
+ xml do
25
+ element "augment"
26
+ ordered
27
+ namespace ::Metaschema::Namespace
28
+
29
+ map_attribute "name", to: :name
30
+ map_element "formal-name", to: :formal_name
31
+ map_element "description", to: :description
32
+ map_element "prop", to: :prop
33
+ map_element "remarks", to: :remarks
34
+ map_element "example", to: :example
35
+ map_element "flag", to: :flag
36
+ map_element "define-flag", to: :define_flag
37
+ end
38
+ end
39
+ end
@@ -1,14 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'image_type'
6
- require_relative 'inline_markup_type'
7
- require_relative 'list_type'
8
- require_relative 'ordered_list_type'
9
- require_relative 'preformatted_type'
10
- require_relative 'table_type'
11
-
12
3
  module Metaschema
13
4
  class BlockQuoteType < Lutaml::Model::Serializable
14
5
  attribute :h1, InlineMarkupType, collection: true
@@ -27,23 +18,24 @@ module Metaschema
27
18
  attribute :img, ImageType, collection: true
28
19
 
29
20
  xml do
30
- root 'blockQuoteType', mixed: true
31
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
21
+ element "blockQuoteType"
22
+ mixed_content
23
+ namespace ::Metaschema::Namespace
32
24
 
33
- map_element 'h1', to: :h1
34
- map_element 'h2', to: :h2
35
- map_element 'h3', to: :h3
36
- map_element 'h4', to: :h4
37
- map_element 'h5', to: :h5
38
- map_element 'h6', to: :h6
39
- map_element 'ul', to: :ul
40
- map_element 'ol', to: :ol
41
- map_element 'pre', to: :pre
42
- map_element 'hr', to: :hr
43
- map_element 'blockquote', to: :blockquote
44
- map_element 'p', to: :p
45
- map_element 'table', to: :table
46
- map_element 'img', to: :img
25
+ map_element "h1", to: :h1
26
+ map_element "h2", to: :h2
27
+ map_element "h3", to: :h3
28
+ map_element "h4", to: :h4
29
+ map_element "h5", to: :h5
30
+ map_element "h6", to: :h6
31
+ map_element "ul", to: :ul
32
+ map_element "ol", to: :ol
33
+ map_element "pre", to: :pre
34
+ map_element "hr", to: :hr
35
+ map_element "blockquote", to: :blockquote
36
+ map_element "p", to: :p
37
+ map_element "table", to: :table
38
+ map_element "img", to: :img
47
39
  end
48
40
  end
49
41
  end
@@ -1,12 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'assembly_reference_type'
6
- require_relative 'field_reference_type'
7
- require_relative 'inline_assembly_definition_type'
8
- require_relative 'inline_field_definition_type'
9
-
10
3
  module Metaschema
11
4
  class ChoiceType < Lutaml::Model::Serializable
12
5
  attribute :assembly, AssemblyReferenceType, collection: true
@@ -15,13 +8,13 @@ module Metaschema
15
8
  attribute :define_field, InlineFieldDefinitionType, collection: true
16
9
 
17
10
  xml do
18
- root 'ChoiceType'
19
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
11
+ element "ChoiceType"
12
+ namespace ::Metaschema::Namespace
20
13
 
21
- map_element 'field', to: :field
22
- map_element 'define-assembly', to: :define_assembly
23
- map_element 'assembly', to: :assembly
24
- map_element 'define-field', to: :define_field
14
+ map_element "field", to: :field
15
+ map_element "define-assembly", to: :define_assembly
16
+ map_element "assembly", to: :assembly
17
+ map_element "define-field", to: :define_field
25
18
  end
26
19
  end
27
20
  end
@@ -1,15 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'anchor_type'
6
- require_relative 'image_type'
7
- require_relative 'inline_markup_type'
8
- require_relative 'insert_type'
9
-
10
3
  module Metaschema
11
4
  class CodeType < Lutaml::Model::Serializable
12
- attribute :content, :string
5
+ attribute :content, :string, collection: true
13
6
  attribute :klass, :string
14
7
  attribute :a, AnchorType, collection: true
15
8
  attribute :insert, InsertType, collection: true
@@ -25,23 +18,24 @@ module Metaschema
25
18
  attribute :img, ImageType, collection: true
26
19
 
27
20
  xml do
28
- root 'codeType', mixed: true
29
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
21
+ element "codeType"
22
+ namespace ::Metaschema::Namespace
23
+ mixed_content
30
24
 
31
25
  map_content to: :content
32
- map_attribute 'class', to: :klass
33
- map_element 'a', to: :a
34
- map_element 'insert', to: :insert
35
- map_element 'br', to: :br
36
- map_element 'code', to: :code
37
- map_element 'em', to: :em
38
- map_element 'i', to: :i
39
- map_element 'b', to: :b
40
- map_element 'strong', to: :strong
41
- map_element 'sub', to: :sub
42
- map_element 'sup', to: :sup
43
- map_element 'q', to: :q
44
- map_element 'img', to: :img
26
+ map_attribute "class", to: :klass
27
+ map_element "a", to: :a
28
+ map_element "insert", to: :insert
29
+ map_element "br", to: :br
30
+ map_element "code", to: :code
31
+ map_element "em", to: :em
32
+ map_element "i", to: :i
33
+ map_element "b", to: :b
34
+ map_element "strong", to: :strong
35
+ map_element "sub", to: :sub
36
+ map_element "sup", to: :sup
37
+ map_element "q", to: :q
38
+ map_element "img", to: :img
45
39
  end
46
40
  end
47
41
  end
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
- require_relative 'remarks_type'
6
-
7
3
  module Metaschema
8
4
  class ConstraintLetType < Lutaml::Model::Serializable
9
5
  attribute :var, :string
@@ -11,12 +7,12 @@ module Metaschema
11
7
  attribute :remarks, RemarksType
12
8
 
13
9
  xml do
14
- root 'ConstraintLetType'
15
- namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'
10
+ element "ConstraintLetType"
11
+ namespace ::Metaschema::Namespace
16
12
 
17
- map_attribute 'var', to: :var
18
- map_attribute 'expression', to: :expression
19
- map_element 'remarks', to: :remarks
13
+ map_attribute "var", to: :var
14
+ map_attribute "expression", to: :expression
15
+ map_element "remarks", to: :remarks
20
16
  end
21
17
  end
22
18
  end