metaschema 0.1.2 → 0.2.0

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +19 -1
  3. data/.rubocop_todo.yml +60 -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 +17 -24
  8. data/lib/metaschema/allowed_values_type.rb +15 -22
  9. data/lib/metaschema/anchor_type.rb +14 -19
  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/block_quote_type.rb +17 -25
  15. data/lib/metaschema/choice_type.rb +6 -13
  16. data/lib/metaschema/code_type.rb +16 -22
  17. data/lib/metaschema/constraint_let_type.rb +5 -9
  18. data/lib/metaschema/define_assembly_constraints_type.rb +17 -26
  19. data/lib/metaschema/define_field_constraints_type.rb +13 -19
  20. data/lib/metaschema/define_flag_constraints_type.rb +9 -17
  21. data/lib/metaschema/example_type.rb +6 -11
  22. data/lib/metaschema/expect_constraint_type.rb +12 -18
  23. data/lib/metaschema/field.rb +13 -20
  24. data/lib/metaschema/field_reference_type.rb +19 -27
  25. data/lib/metaschema/flag.rb +9 -18
  26. data/lib/metaschema/flag_reference_type.rb +14 -21
  27. data/lib/metaschema/formal_name.rb +9 -0
  28. data/lib/metaschema/global_assembly_definition_type.rb +21 -34
  29. data/lib/metaschema/global_field_definition_type.rb +26 -39
  30. data/lib/metaschema/global_flag_definition_type.rb +18 -27
  31. data/lib/metaschema/group_as_type.rb +7 -9
  32. data/lib/metaschema/grouped_assembly_reference_type.rb +11 -18
  33. data/lib/metaschema/grouped_choice_type.rb +16 -24
  34. data/lib/metaschema/grouped_field_reference_type.rb +11 -18
  35. data/lib/metaschema/grouped_inline_assembly_definition_type.rb +17 -29
  36. data/lib/metaschema/grouped_inline_field_definition_type.rb +26 -37
  37. data/lib/metaschema/image_type.rb +5 -7
  38. data/lib/metaschema/import.rb +3 -5
  39. data/lib/metaschema/index_has_key_constraint_type.rb +12 -19
  40. data/lib/metaschema/inline_assembly_definition_type.rb +25 -38
  41. data/lib/metaschema/inline_field_definition_type.rb +31 -43
  42. data/lib/metaschema/inline_flag_definition_type.rb +17 -25
  43. data/lib/metaschema/inline_markup_type.rb +16 -21
  44. data/lib/metaschema/insert_type.rb +4 -6
  45. data/lib/metaschema/json_base_uri.rb +9 -0
  46. data/lib/metaschema/json_key_type.rb +3 -5
  47. data/lib/metaschema/json_value_key.rb +9 -0
  48. data/lib/metaschema/json_value_key_flag_type.rb +3 -5
  49. data/lib/metaschema/key_field.rb +5 -9
  50. data/lib/metaschema/list_item_type.rb +28 -38
  51. data/lib/metaschema/list_type.rb +3 -7
  52. data/lib/metaschema/markup_line_datatype.rb +15 -22
  53. data/lib/metaschema/matches_constraint_type.rb +12 -18
  54. data/lib/metaschema/metaschema_constraints.rb +24 -0
  55. data/lib/metaschema/metaschema_import_type.rb +3 -5
  56. data/lib/metaschema/namespace.rb +8 -0
  57. data/lib/metaschema/namespace_binding_type.rb +4 -6
  58. data/lib/metaschema/namespace_value.rb +9 -0
  59. data/lib/metaschema/ordered_list_type.rb +4 -8
  60. data/lib/metaschema/preformatted_type.rb +15 -22
  61. data/lib/metaschema/property_type.rb +6 -8
  62. data/lib/metaschema/remarks_type.rb +18 -27
  63. data/lib/metaschema/root.rb +21 -31
  64. data/lib/metaschema/root_name.rb +3 -5
  65. data/lib/metaschema/schema_version.rb +9 -0
  66. data/lib/metaschema/scope.rb +7 -13
  67. data/lib/metaschema/short_name.rb +9 -0
  68. data/lib/metaschema/table_cell_type.rb +17 -24
  69. data/lib/metaschema/table_row_type.rb +4 -8
  70. data/lib/metaschema/table_type.rb +3 -7
  71. data/lib/metaschema/targeted_allowed_values_constraint_type.rb +16 -23
  72. data/lib/metaschema/targeted_expect_constraint_type.rb +13 -19
  73. data/lib/metaschema/targeted_has_cardinality_constraint_type.rb +13 -19
  74. data/lib/metaschema/targeted_index_constraint_type.rb +13 -20
  75. data/lib/metaschema/targeted_index_has_key_constraint_type.rb +13 -20
  76. data/lib/metaschema/targeted_key_constraint_type.rb +12 -19
  77. data/lib/metaschema/targeted_matches_constraint_type.rb +13 -19
  78. data/lib/metaschema/use_name_type.rb +3 -5
  79. data/lib/metaschema/version.rb +1 -1
  80. data/lib/metaschema.rb +89 -9
  81. metadata +20 -95
  82. data/lib/metaschema/metaschemaconstraints.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60b00aaab348d3f988738d342131af2960af449c6476284f372017a884b609ea
4
- data.tar.gz: 3d1105245b18f7db1269698ee5aaf68bc7f0c2cb40dde4efd00a6d7ba068bfc0
3
+ metadata.gz: 8430ee05ae7a85561689c25a0404d06ec3484b6ce006fad3ac194fee3bf909ed
4
+ data.tar.gz: 986832e20e5a6c492b766187183f88f498ab62f04d914c25b1853ff01791420e
5
5
  SHA512:
6
- metadata.gz: d15f2fb39b07d584bbcbb30ea497281ea9f38068ca978a746ed1afc00889e2823b89101259edb3b3c27a010b671f9c6992daed8c0db081726a1b33219fe09797
7
- data.tar.gz: 0cbe2b526a88045f7ea3cb8d75165bf00fa4c7d52cf64ea830bfd69755cedae2d77d24d7b891c9df981b32e5ce31df49294d9e62bf5c59daeca55d6c1d85dfc0
6
+ metadata.gz: a9e6dfbf033a45d9ab7d92db610a4afd2a74c3e2101bc2ce47522dbf77207762122356fddc3390267679a5e45ac3a1e478bc8162b1dedd8e24737fb05502c47d
7
+ data.tar.gz: 6cff0e8d3fd500ad980ae84d2a1b7f1f5db53f76151004c84dc55c4b06e038fd21f9beccfddbab567cacd04855db62250807764439fbaa47492fdf40af5ccd5a
data/.rubocop.yml CHANGED
@@ -1 +1,19 @@
1
- inherit_from: .rubocop_todo.yml
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
6
+
7
+ inherit_mode:
8
+ merge:
9
+ - Exclude
10
+
11
+ # local repo-specific modifications
12
+ # ...
13
+ plugins:
14
+ - rubocop-rspec
15
+ - rubocop-performance
16
+ - rubocop-rake
17
+
18
+ AllCops:
19
+ TargetRubyVersion: 3.0
data/.rubocop_todo.yml CHANGED
@@ -1,18 +1,70 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-06 00:55:21 UTC using RuboCop version 1.69.2.
3
+ # on 2026-04-14 10:25:31 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
10
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
9
+ # Offense count: 1
10
+ Gemspec/RequiredRubyVersion:
11
+ Exclude:
12
+ - 'metaschema.gemspec'
13
+
14
+ # Offense count: 14
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
19
+ Exclude:
20
+ - 'lib/metaschema.rb'
21
+
22
+ # Offense count: 1
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: EnforcedStyle.
25
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
26
+ Layout/EmptyLinesAroundModuleBody:
27
+ Exclude:
28
+ - 'lib/metaschema.rb'
29
+
30
+ # Offense count: 16
31
+ # This cop supports safe autocorrection (--autocorrect).
32
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
33
+ # URISchemes: http, https
34
+ Layout/LineLength:
35
+ Exclude:
36
+ - 'lib/metaschema.rb'
37
+ - 'spec/metaschema_spec.rb'
38
+
39
+ # Offense count: 14
40
+ # This cop supports safe autocorrection (--autocorrect).
41
+ # Configuration parameters: AllowInHeredoc.
42
+ Layout/TrailingWhitespace:
43
+ Exclude:
44
+ - 'lib/metaschema.rb'
45
+
46
+ # Offense count: 1
47
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
11
48
  # AllowedMethods: refine
12
49
  Metrics/BlockLength:
13
- Max: 44
50
+ Max: 28
51
+
52
+ # Offense count: 2
53
+ # Configuration parameters: CountAsOne.
54
+ RSpec/ExampleLength:
55
+ Max: 10
56
+
57
+ # Offense count: 1
58
+ # Configuration parameters: AllowedPatterns.
59
+ # AllowedPatterns: ^expect_, ^assert_
60
+ RSpec/NoExpectationExample:
61
+ Exclude:
62
+ - 'spec/metaschema_spec.rb'
14
63
 
15
- # Offense count: 66
16
- # Configuration parameters: AllowedConstants.
17
- Style/Documentation:
18
- Enabled: false
64
+ # Offense count: 2
65
+ # This cop supports safe autocorrection (--autocorrect).
66
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
67
+ # SupportedStyles: single_quotes, double_quotes
68
+ Style/StringLiterals:
69
+ Exclude:
70
+ - 'lib/metaschema.rb'
data/CLAUDE.md ADDED
@@ -0,0 +1,78 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ This is a Ruby gem implementing a parser and generator for the [NIST Metaschema Information Modeling Framework](https://pages.nist.gov/metaschema). It parses Metaschema XML files and can round-trip them (parse to Ruby objects and back to XML).
8
+
9
+ ## Common Commands
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ bundle install
14
+
15
+ # Run tests
16
+ bundle exec rake spec
17
+
18
+ # Run a single test file
19
+ bundle exec rspec spec/metaschema_spec.rb
20
+
21
+ # Run tests with specific format
22
+ bundle exec rspec spec/metaschema_spec.rb --format documentation
23
+
24
+ # Run linting
25
+ bundle exec rake rubocop
26
+
27
+ # Auto-correct linting issues
28
+ bundle exec rake rubocop:autocorrect_all
29
+
30
+ # Build the gem
31
+ bundle exec rake build
32
+ ```
33
+
34
+ ## Architecture
35
+
36
+ The gem uses **lutaml-model** with **Nokogiri** for XML serialization/deserialization. All model classes inherit from `Lutaml::Model::Serializable`.
37
+
38
+ ### Entry Point
39
+
40
+ `lib/metaschema/root.rb` - The `Metaschema::Root` class is the top-level model representing a complete Metaschema XML document. It contains:
41
+ - `schema_name`, `schema_version`, `short_name`, `namespace`, `json_base_uri`
42
+ - Top-level definitions: `define_assembly`, `define_field`, `define_flag`
43
+ - Imports and namespace bindings
44
+
45
+ ### Type System
46
+
47
+ The `lib/metaschema/` directory contains ~74 type classes. Key patterns:
48
+
49
+ - **Definition types** (e.g., `GlobalAssemblyDefinitionType`, `GlobalFieldDefinitionType`) - Define schema structures with `name`, `formal_name`, `description`, `model`, `constraint`
50
+ - **Reference types** (e.g., `AssemblyReferenceType`, `FieldReferenceType`) - Reference definitions by name
51
+ - **Inline definition types** (e.g., `InlineAssemblyDefinitionType`) - Definitions nested within other definitions
52
+ - **Constraint types** (e.g., `DefineAssemblyConstraintsType`, `AllowedValuesType`) - Validation constraints
53
+ - **Value types** (e.g., `MarkupLineDatatype`, `FormalName`) - Simple value wrappers
54
+
55
+ Each type class uses the lutaml-model XML DSL:
56
+ ```ruby
57
+ xml do
58
+ element "ElementName"
59
+ ordered # children must appear in defined order
60
+ namespace ::Metaschema::Namespace
61
+ map_attribute "attr", to: :attr_name
62
+ map_element "child-element", to: :child_attr
63
+ end
64
+ ```
65
+
66
+ ### Test Fixtures
67
+
68
+ - `spec/fixtures/metaschema/` - Submoduled NIST Metaschema project containing test schemas
69
+ - `spec/fixtures/metaschema/examples/` - Example Metaschema XML files (e.g., `computer-example.xml`)
70
+ - `spec/fixtures/metaschema/test-suite/schema-generation/` - Feature-specific test cases
71
+
72
+ ### Loading a Metaschema File
73
+
74
+ ```ruby
75
+ require 'metaschema'
76
+ ms = Metaschema::Root.from_file("path/to/metaschema.xml")
77
+ ms.to_xml # Returns XML string
78
+ ```
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,13 +1,5 @@
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
5
  attribute :content, :string
@@ -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,11 +1,5 @@
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
5
  attribute :content, :string
@@ -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
@@ -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