Skip to content

Commit

Permalink
feat: make tests run and nearly round-trip
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Oct 19, 2024
1 parent ea37e61 commit d65512a
Show file tree
Hide file tree
Showing 66 changed files with 90 additions and 68 deletions.
2 changes: 1 addition & 1 deletion lib/metaschema/allowed_value_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AllowedValueType < Lutaml::Model::Serializable

xml do
root "AllowedValueType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_content to: :content
map_attribute "value", to: :value
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/allowed_values_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AllowedValuesType < Lutaml::Model::Serializable

xml do
root "AllowedValuesType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "id", to: :id
map_attribute "level", to: :level
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/anchor_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AnchorType < Lutaml::Model::Serializable

xml do
root "anchorType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_content to: :content
map_attribute "href", to: :href
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/any_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Metaschema
class AnyType < Lutaml::Model::Serializable
xml do
root "AnyType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"
end
end
end
2 changes: 1 addition & 1 deletion lib/metaschema/assembly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Assembly < Lutaml::Model::Serializable

xml do
root "assembly"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "target", to: :target
map_element "let", to: :let
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/assembly_model_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AssemblyModelType < Lutaml::Model::Serializable

xml do
root "AssemblyModelType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "assembly", to: :assembly
map_element "field", to: :field
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/assembly_reference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AssemblyReferenceType < Lutaml::Model::Serializable

xml do
root "AssemblyReferenceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "ref", to: :ref
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/block_quote_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BlockQuoteType < Lutaml::Model::Serializable

xml do
root "blockQuoteType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "h1", to: :h1
map_element "h2", to: :h2
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/choice_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ChoiceType < Lutaml::Model::Serializable

xml do
root "ChoiceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "assembly", to: :assembly
map_element "field", to: :field
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/code_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CodeType < Lutaml::Model::Serializable

xml do
root "codeType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_content to: :content
map_attribute "class", to: :class
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/constraint_let_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ConstraintLetType < Lutaml::Model::Serializable

xml do
root "ConstraintLetType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "var", to: :var
map_attribute "expression", to: :expression
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/define_assembly_constraints_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DefineAssemblyConstraintsType < Lutaml::Model::Serializable

xml do
root "DefineAssemblyConstraintsType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "let", to: :let
map_element "allowed-values", to: :allowed_values
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/define_field_constraints_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DefineFieldConstraintsType < Lutaml::Model::Serializable

xml do
root "DefineFieldConstraintsType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "let", to: :let
map_element "allowed-values", to: :allowed_values
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/define_flag_constraints_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DefineFlagConstraintsType < Lutaml::Model::Serializable

xml do
root "DefineFlagConstraintsType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_element "let", to: :let
map_element "allowed-values", to: :allowed_values
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/example_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ExampleType < Lutaml::Model::Serializable

xml do
root "ExampleType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "href", to: :href
map_attribute "path", to: :path
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/expect_constraint_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExpectConstraintType < Lutaml::Model::Serializable

xml do
root "ExpectConstraintType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "id", to: :id
map_attribute "level", to: :level
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Field < Lutaml::Model::Serializable

xml do
root "field"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "target", to: :target
map_element "let", to: :let
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/field_reference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FieldReferenceType < Lutaml::Model::Serializable

xml do
root "FieldReferenceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "ref", to: :ref
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Flag < Lutaml::Model::Serializable

xml do
root "flag"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "target", to: :target
map_element "let", to: :let
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/flag_reference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FlagReferenceType < Lutaml::Model::Serializable

xml do
root "FlagReferenceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "ref", to: :ref
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/global_assembly_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GlobalAssemblyDefinitionType < Lutaml::Model::Serializable

xml do
root "GlobalAssemblyDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "name", to: :name
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/global_field_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GlobalFieldDefinitionType < Lutaml::Model::Serializable

xml do
root "GlobalFieldDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "as-type", to: :as_type
map_attribute "default", to: :default
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/global_flag_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GlobalFlagDefinitionType < Lutaml::Model::Serializable

xml do
root "GlobalFlagDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "name", to: :name
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/group_as_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GroupAsType < Lutaml::Model::Serializable

xml do
root "GroupAsType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "name", to: :name
map_attribute "in-json", to: :in_json
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/grouped_assembly_reference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GroupedAssemblyReferenceType < Lutaml::Model::Serializable

xml do
root "GroupedAssemblyReferenceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "ref", to: :ref
map_attribute "deprecated", to: :deprecated
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/grouped_choice_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GroupedChoiceType < Lutaml::Model::Serializable

xml do
root "GroupedChoiceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "min-occurs", to: :min_occurs
map_attribute "max-occurs", to: :max_occurs
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/grouped_field_reference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GroupedFieldReferenceType < Lutaml::Model::Serializable

xml do
root "GroupedFieldReferenceType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "ref", to: :ref
map_attribute "deprecated", to: :deprecated
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/grouped_inline_assembly_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GroupedInlineAssemblyDefinitionType < Lutaml::Model::Serializable

xml do
root "GroupedInlineAssemblyDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "name", to: :name
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/grouped_inline_field_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GroupedInlineFieldDefinitionType < Lutaml::Model::Serializable

xml do
root "GroupedInlineFieldDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "as-type", to: :as_type
map_attribute "collapsible", to: :collapsible
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/image_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ImageType < Lutaml::Model::Serializable

xml do
root "imageType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "alt", to: :alt
map_attribute "src", to: :src
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Import < Lutaml::Model::Serializable

xml do
root "import"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "href", to: :href
end
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/index_has_key_constraint_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class IndexHasKeyConstraintType < Lutaml::Model::Serializable

xml do
root "IndexHasKeyConstraintType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "id", to: :id
map_attribute "level", to: :level
Expand Down
6 changes: 4 additions & 2 deletions lib/metaschema/inline_assembly_definition_type.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "lutaml/model"

require_relative "assembly_model_type"
# require_relative "assembly_model_type"
require_relative "define_assembly_constraints_type"
require_relative "example_type"
require_relative "flag_reference_type"
Expand All @@ -13,6 +13,8 @@
require_relative "remarks_type"

module Metaschema
class AssemblyModelType < Lutaml::Model::Serializable; end

class InlineAssemblyDefinitionType < Lutaml::Model::Serializable
attribute :min_occurs, :integer, default: -> { "0" }
attribute :max_occurs, :string, default: -> { "1" }
Expand All @@ -35,7 +37,7 @@ class InlineAssemblyDefinitionType < Lutaml::Model::Serializable

xml do
root "InlineAssemblyDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "min-occurs", to: :min_occurs
map_attribute "max-occurs", to: :max_occurs
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/inline_field_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InlineFieldDefinitionType < Lutaml::Model::Serializable

xml do
root "InlineFieldDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "as-type", to: :as_type
map_attribute "default", to: :default
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/inline_flag_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InlineFlagDefinitionType < Lutaml::Model::Serializable

xml do
root "InlineFlagDefinitionType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "name", to: :name
map_attribute "index", to: :index
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/inline_markup_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InlineMarkupType < Lutaml::Model::Serializable

xml do
root "inlineMarkupType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_content to: :content
map_element "a", to: :a
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/insert_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class InsertType < Lutaml::Model::Serializable

xml do
root "insertType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "type", to: :type
map_attribute "id-ref", to: :id_ref
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/json_key_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class JsonKeyType < Lutaml::Model::Serializable

xml do
root "JsonKeyType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "flag-ref", to: :flag_ref
end
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/json_value_key_flag_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class JsonValueKeyFlagType < Lutaml::Model::Serializable

xml do
root "JsonValueKeyFlagType"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "flag-ref", to: :flag_ref
end
Expand Down
2 changes: 1 addition & 1 deletion lib/metaschema/key_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class KeyField < Lutaml::Model::Serializable

xml do
root "key-field"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0", "xmlns"
namespace "http://csrc.nist.gov/ns/oscal/metaschema/1.0"

map_attribute "target", to: :target
map_attribute "pattern", to: :pattern
Expand Down
Loading

0 comments on commit d65512a

Please sign in to comment.