lutaml-model 0.8.187 → 0.8.188

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 (306) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos-tools-informational.json +8 -0
  3. data/.github/workflows/dependent-repos-tools.json +1 -5
  4. data/.github/workflows/dependent-tests.yml +26 -2
  5. data/Gemfile +2 -0
  6. data/Rakefile +6 -0
  7. data/exe/lutaml-lml-lsp +11 -0
  8. data/lib/compat/opal/generate_boot.rb +12 -5
  9. data/lib/compat/opal/lutaml_model_boot.rb +96 -4
  10. data/lib/lutaml/lml/association_label_resolver.rb +52 -0
  11. data/lib/lutaml/lml/data_processor/attribute_processing.rb +133 -0
  12. data/lib/lutaml/lml/data_processor/collection_processing.rb +37 -0
  13. data/lib/lutaml/lml/data_processor/instance_processing.rb +77 -0
  14. data/lib/lutaml/lml/data_processor/value_declaration_processing.rb +70 -0
  15. data/lib/lutaml/lml/data_processor/value_processing.rb +103 -0
  16. data/lib/lutaml/lml/data_processor/view_processing.rb +26 -0
  17. data/lib/lutaml/lml/data_processor.rb +66 -0
  18. data/lib/lutaml/lml/diagnostic.rb +149 -0
  19. data/lib/lutaml/lml/document_builder.rb +486 -0
  20. data/lib/lutaml/lml/entity_types.rb +31 -0
  21. data/lib/lutaml/lml/executor/adapter_helpers.rb +45 -0
  22. data/lib/lutaml/lml/executor/condition_evaluator.rb +175 -0
  23. data/lib/lutaml/lml/executor/csv_adapter.rb +89 -0
  24. data/lib/lutaml/lml/executor/format_adapter.rb +54 -0
  25. data/lib/lutaml/lml/executor/xml_adapter.rb +102 -0
  26. data/lib/lutaml/lml/executor.rb +96 -0
  27. data/lib/lutaml/lml/format/adapter/document.rb +11 -0
  28. data/lib/lutaml/lml/format/adapter/mapping.rb +31 -0
  29. data/lib/lutaml/lml/format/adapter/standard_adapter.rb +164 -0
  30. data/lib/lutaml/lml/format/adapter/transform.rb +11 -0
  31. data/lib/lutaml/lml/format.rb +34 -0
  32. data/lib/lutaml/lml/formatter/base.rb +81 -0
  33. data/lib/lutaml/lml/formatter/canonical.rb +738 -0
  34. data/lib/lutaml/lml/formatter.rb +11 -0
  35. data/lib/lutaml/lml/grammar/lml.artifact.json +14993 -0
  36. data/lib/lutaml/lml/grammar/lml.parg +389 -0
  37. data/lib/lutaml/lml/grammar.rb +60 -0
  38. data/lib/lutaml/lml/has_attributes.rb +14 -0
  39. data/lib/lutaml/lml/import_resolver.rb +96 -0
  40. data/lib/lutaml/lml/layout/engine.rb +17 -0
  41. data/lib/lutaml/lml/layout.rb +9 -0
  42. data/lib/lutaml/lml/literal_value.rb +32 -0
  43. data/lib/lutaml/lml/lsp/conversions.rb +78 -0
  44. data/lib/lutaml/lml/lsp/keywords.rb +43 -0
  45. data/lib/lutaml/lml/lsp/server.rb +380 -0
  46. data/lib/lutaml/lml/lsp/store.rb +68 -0
  47. data/lib/lutaml/lml/lsp/transport.rb +53 -0
  48. data/lib/lutaml/lml/lsp.rb +16 -0
  49. data/lib/lutaml/lml/model_compiler/enums.rb +170 -0
  50. data/lib/lutaml/lml/model_compiler/hydration.rb +122 -0
  51. data/lib/lutaml/lml/model_compiler/serialization_mappings.rb +188 -0
  52. data/lib/lutaml/lml/model_compiler/string_formats.rb +42 -0
  53. data/lib/lutaml/lml/model_compiler/validation.rb +65 -0
  54. data/lib/lutaml/lml/model_compiler.rb +329 -0
  55. data/lib/lutaml/lml/models/action.rb +10 -0
  56. data/lib/lutaml/lml/models/association.rb +31 -0
  57. data/lib/lutaml/lml/models/cardinality.rb +10 -0
  58. data/lib/lutaml/lml/models/collection.rb +11 -0
  59. data/lib/lutaml/lml/models/constraint.rb +25 -0
  60. data/lib/lutaml/lml/models/data_type.rb +43 -0
  61. data/lib/lutaml/lml/models/derived_field.rb +14 -0
  62. data/lib/lutaml/lml/models/diagram.rb +22 -0
  63. data/lib/lutaml/lml/models/document.rb +86 -0
  64. data/lib/lutaml/lml/models/enum.rb +40 -0
  65. data/lib/lutaml/lml/models/fidelity.rb +10 -0
  66. data/lib/lutaml/lml/models/group.rb +11 -0
  67. data/lib/lutaml/lml/models/instance.rb +28 -0
  68. data/lib/lutaml/lml/models/instance_collection.rb +18 -0
  69. data/lib/lutaml/lml/models/instances_export.rb +10 -0
  70. data/lib/lutaml/lml/models/instances_import.rb +11 -0
  71. data/lib/lutaml/lml/models/mapping.rb +15 -0
  72. data/lib/lutaml/lml/models/mapping_rule.rb +16 -0
  73. data/lib/lutaml/lml/models/member_field.rb +16 -0
  74. data/lib/lutaml/lml/models/namespace.rb +18 -0
  75. data/lib/lutaml/lml/models/operation.rb +28 -0
  76. data/lib/lutaml/lml/models/operation_parameter.rb +12 -0
  77. data/lib/lutaml/lml/models/package.rb +28 -0
  78. data/lib/lutaml/lml/models/primitive_type.rb +35 -0
  79. data/lib/lutaml/lml/models/reference.rb +23 -0
  80. data/lib/lutaml/lml/models/serialization_mapping.rb +21 -0
  81. data/lib/lutaml/lml/models/string_format.rb +16 -0
  82. data/lib/lutaml/lml/models/top_element_attribute.rb +118 -0
  83. data/lib/lutaml/lml/models/uml_class.rb +87 -0
  84. data/lib/lutaml/lml/models/value.rb +17 -0
  85. data/lib/lutaml/lml/models/view_filter.rb +11 -0
  86. data/lib/lutaml/lml/models/view_import.rb +11 -0
  87. data/lib/lutaml/lml/parser.rb +19 -0
  88. data/lib/lutaml/lml/pipeline.rb +73 -0
  89. data/lib/lutaml/lml/positioned.rb +13 -0
  90. data/lib/lutaml/lml/preprocessor.rb +132 -0
  91. data/lib/lutaml/lml/quoting.rb +60 -0
  92. data/lib/lutaml/lml/source.rb +49 -0
  93. data/lib/lutaml/lml/source_position.rb +20 -0
  94. data/lib/lutaml/lml/symbol_index.rb +202 -0
  95. data/lib/lutaml/lml/transform.rb +119 -0
  96. data/lib/lutaml/lml/types/text_type.rb +28 -0
  97. data/lib/lutaml/lml/types.rb +10 -0
  98. data/lib/lutaml/lml/validator.rb +460 -0
  99. data/lib/lutaml/lml/view_resolution.rb +32 -0
  100. data/lib/lutaml/lml/view_resolver.rb +48 -0
  101. data/lib/lutaml/lml/yaml_parser.rb +17 -0
  102. data/lib/lutaml/lml.rb +130 -0
  103. data/lib/lutaml/model/adapter_resolver.rb +21 -2
  104. data/lib/lutaml/model/config.rb +22 -0
  105. data/lib/lutaml/model/serialize/format_conversion.rb +8 -6
  106. data/lib/lutaml/model/version.rb +1 -1
  107. data/lib/lutaml/xml/adapter/base_adapter.rb +26 -0
  108. data/lib/lutaml/xml/adapter/moxml_adapter.rb +49 -0
  109. data/lib/lutaml/xml/adapter/xml_parser.rb +4 -4
  110. data/lib/lutaml/xml/adapter/xml_serializer.rb +1 -1
  111. data/lib/lutaml/xml/adapter.rb +5 -0
  112. data/lib/lutaml/xml/adapter_loader.rb +5 -0
  113. data/lib/lutaml/xml/format.rb +23 -2
  114. data/lib/lutaml/xml/leptris/native_emission.rb +6 -1
  115. data/lib/lutaml/xml/leptris/plan_serializer.rb +5 -1
  116. data/lib/lutaml/xml/parse_session.rb +8 -1
  117. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  118. data/lib/lutaml/xml/schema/builder.rb +1 -1
  119. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  120. data/lib/lutaml/xml/schema/vc_namespace.rb +24 -0
  121. data/lib/lutaml/xml/schema/xsd/any.rb +4 -0
  122. data/lib/lutaml/xml/schema/xsd/any_attribute.rb +4 -0
  123. data/lib/lutaml/xml/schema/xsd/base.rb +7 -0
  124. data/lib/lutaml/xml/schema/xsd/schema.rb +38 -0
  125. data/lib/lutaml/xml/schema/xsd/schema_validator.rb +1 -1
  126. data/lib/lutaml/xml/schema/xsd.rb +1 -0
  127. data/lib/lutaml/xml/schema/xsd_schema.rb +1 -1
  128. data/lib/lutaml/xml/serialization/format_conversion.rb +6 -0
  129. data/lib/lutaml/xml/xsd_validator.rb +1 -1
  130. data/lutaml-model.gemspec +2 -0
  131. data/spec/lml/fixtures/dsl/broken_diagram.lutaml +34 -0
  132. data/spec/lml/fixtures/dsl/diagram.lutaml +4 -0
  133. data/spec/lml/fixtures/dsl/diagram_attributes.lutaml +6 -0
  134. data/spec/lml/fixtures/dsl/diagram_blank_definion.lutaml +6 -0
  135. data/spec/lml/fixtures/dsl/diagram_blank_entities.lutaml +8 -0
  136. data/spec/lml/fixtures/dsl/diagram_class_assocation.lutaml +29 -0
  137. data/spec/lml/fixtures/dsl/diagram_class_fields.lutaml +25 -0
  138. data/spec/lml/fixtures/dsl/diagram_commented_includes.lutaml +5 -0
  139. data/spec/lml/fixtures/dsl/diagram_comments.lutaml +28 -0
  140. data/spec/lml/fixtures/dsl/diagram_concept_model.lutaml +132 -0
  141. data/spec/lml/fixtures/dsl/diagram_data_types.lutaml +44 -0
  142. data/spec/lml/fixtures/dsl/diagram_definitions.lutaml +25 -0
  143. data/spec/lml/fixtures/dsl/diagram_includes.lutaml +6 -0
  144. data/spec/lml/fixtures/dsl/diagram_multiply_classes.lutaml +7 -0
  145. data/spec/lml/fixtures/dsl/diagram_non_existing_include.lutaml +6 -0
  146. data/spec/lml/fixtures/dsl/shared.lutaml +5 -0
  147. data/spec/lml/fixtures/dsl/shared1.lutaml +4 -0
  148. data/spec/lml/fixtures/generated_dot/AddressClassProfile.dot +170 -0
  149. data/spec/lml/fixtures/generated_dot/AddressProfile.dot +34 -0
  150. data/spec/lml/fixtures/generated_dot/address_class_profile_with_associations.dot +127 -0
  151. data/spec/lml/fixtures/generated_dot/address_profile_with_associations.dot +28 -0
  152. data/spec/lml/fixtures/generated_dot/document.dot +28 -0
  153. data/spec/lml/fixtures/generated_dot/document.dot.backup +33 -0
  154. data/spec/lml/fixtures/generated_dot/document_with_fidelity.dot +27 -0
  155. data/spec/lml/fixtures/lml/data_s102_check.lml +79 -0
  156. data/spec/lml/fixtures/lml/data_s158_metadata.lml +28 -0
  157. data/spec/lml/fixtures/lml/iho_data_models.lml +59 -0
  158. data/spec/lml/fixtures/lml/iho_s102_check.lml +101 -0
  159. data/spec/lml/fixtures/mixed_lml/diagram.lml +26 -0
  160. data/spec/lml/fixtures/mixed_lml/instances.lml +72 -0
  161. data/spec/lml/fixtures/mixed_lml/model.lml +30 -0
  162. data/spec/lml/fixtures/real_world/basicdoc-models/AdmonitionType.lutaml +32 -0
  163. data/spec/lml/fixtures/real_world/basicdoc-models/BasicBlock.lutaml +11 -0
  164. data/spec/lml/fixtures/real_world/basicdoc-models/BasicDocument.lutaml +41 -0
  165. data/spec/lml/fixtures/real_world/basicdoc-models/BasicSection.lutaml +38 -0
  166. data/spec/lml/fixtures/real_world/basicdoc-models/BibliographicItem.lutaml +6 -0
  167. data/spec/lml/fixtures/real_world/basicdoc-models/FigureBlock.lutaml +65 -0
  168. data/spec/lml/fixtures/real_world/basicdoc-models/FormattedString.lutaml +12 -0
  169. data/spec/lml/fixtures/real_world/basicdoc-models/List.lutaml +12 -0
  170. data/spec/lml/fixtures/real_world/basicdoc-models/OrderedListType.lutaml +32 -0
  171. data/spec/lml/fixtures/real_world/basicdoc-models/Signature.lutaml +22 -0
  172. data/spec/lml/fixtures/real_world/basicdoc-models/String.lutaml +2 -0
  173. data/spec/lml/fixtures/real_world/basicdoc-models/TableBlock.lutaml +60 -0
  174. data/spec/lml/fixtures/real_world/basicdoc-models/TextElement.lutaml +13 -0
  175. data/spec/lml/fixtures/real_world/basicdoc-models/Uri.lutaml +7 -0
  176. data/spec/lml/fixtures/real_world/metanorma-model-iso/BibliographicItem.lutaml +4 -0
  177. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoAdmonitionType.lutaml +31 -0
  178. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoBibDataExtensionType.lutaml +40 -0
  179. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoSections.lutaml +30 -0
  180. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoStandardDocument.lutaml +46 -0
  181. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoTerm.lutaml +20 -0
  182. data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardBibDataExtensionType.lutaml +2 -0
  183. data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardDocument.lutaml +2 -0
  184. data/spec/lml/fixtures/rs3001/01_class_tail_comment.lml +5 -0
  185. data/spec/lml/fixtures/rs3001/02_definition_block.lml +9 -0
  186. data/spec/lml/fixtures/rs3001/03_package_ceramics.lml +20 -0
  187. data/spec/lml/fixtures/rs3001/04_attribute_definition_form.lml +10 -0
  188. data/spec/lml/fixtures/rs3001/05_attribute_cardinality_unbounded.lml +10 -0
  189. data/spec/lml/fixtures/rs3001/06_attribute_values_set.lml +10 -0
  190. data/spec/lml/fixtures/rs3001/07_attribute_pattern.lml +10 -0
  191. data/spec/lml/fixtures/rs3001/08_attribute_default_colon.lml +15 -0
  192. data/spec/lml/fixtures/rs3001/09_value_porcelain.lml +9 -0
  193. data/spec/lml/fixtures/rs3001/10_enum_glaze_technique.lml +19 -0
  194. data/spec/lml/fixtures/rs3001/11_enum_values_as_instances.lml +29 -0
  195. data/spec/lml/fixtures/rs3001/12_instance_named.lml +13 -0
  196. data/spec/lml/fixtures/rs3001/13_instances_collection_refs.lml +11 -0
  197. data/spec/lml/fixtures/rs3001/14_require_models.lml +7 -0
  198. data/spec/lml/fixtures/rs3001/15_comment_line.lml +1 -0
  199. data/spec/lml/fixtures/rs3001/16_comment_tail.lml +5 -0
  200. data/spec/lml/fixtures/rs3001/17_comment_documented_class.lml +5 -0
  201. data/spec/lml/fixtures/rs3001/18_comment_block.lml +4 -0
  202. data/spec/lml/fixtures/rs3001/19_top_level_instance_definition.lml +21 -0
  203. data/spec/lml/fixtures/rs3001/20_instance_typed_definition.lml +22 -0
  204. data/spec/lml/fixtures/rs3001/21_instance_collection_studios.lml +19 -0
  205. data/spec/lml/fixtures/rs3001/22_instance_collection_tiles.lml +15 -0
  206. data/spec/lml/fixtures/rs3001/23_reference_cross_collection.lml +11 -0
  207. data/spec/lml/fixtures/rs3001/24_null_and_empty.lml +15 -0
  208. data/spec/lml/fixtures/rs3001/25_string_escapes.lml +23 -0
  209. data/spec/lml/fixtures/rs3001/26_quoted_keys.lml +7 -0
  210. data/spec/lml/fixtures/test.lutaml +20 -0
  211. data/spec/lml/fixtures/test_data/components.csv +4 -0
  212. data/spec/lml/fixtures/test_data/products.xml +18 -0
  213. data/spec/lml/fixtures/uml/address_class_profile_with_associations.yml +58 -0
  214. data/spec/lml/fixtures/uml/address_profile_with_associations.yml +31 -0
  215. data/spec/lml/fixtures/uml/association.yml +11 -0
  216. data/spec/lml/fixtures/uml/class.yml +28 -0
  217. data/spec/lml/fixtures/uml/data_type.yml +30 -0
  218. data/spec/lml/fixtures/uml/diagram.yml +7 -0
  219. data/spec/lml/fixtures/uml/document.yml +44 -0
  220. data/spec/lml/fixtures/uml/document_with_fidelity.yml +47 -0
  221. data/spec/lml/fixtures/uml/enum.yml +14 -0
  222. data/spec/lml/fixtures/uml/operation.yml +8 -0
  223. data/spec/lml/fixtures/uml/package.yml +10 -0
  224. data/spec/lml/fixtures/uml/top_element.yml +11 -0
  225. data/spec/lml/fixtures/uml/top_element_attribute.yml +10 -0
  226. data/spec/lml/fixtures/uml/trigger.yml +12 -0
  227. data/spec/lml/fixtures/uml/value.yml +8 -0
  228. data/spec/lml/fixtures/view/cycle_a.lutaml +3 -0
  229. data/spec/lml/fixtures/view/cycle_b.lutaml +3 -0
  230. data/spec/lml/fixtures/view/import_model.lutaml +3 -0
  231. data/spec/lml/fixtures/view/import_view.lutaml +3 -0
  232. data/spec/lml/fixtures/view/import_with_hide.lutaml +4 -0
  233. data/spec/lml/fixtures/view/import_with_show.lutaml +4 -0
  234. data/spec/lml/fixtures/view/models/bar.lutaml +3 -0
  235. data/spec/lml/fixtures/view/models/baz.lutaml +3 -0
  236. data/spec/lml/fixtures/view/models/foo.lutaml +4 -0
  237. data/spec/lml/integration/instance_import_export_spec.rb +102 -0
  238. data/spec/lml/lml_spec_setup.rb +25 -0
  239. data/spec/lml/lutaml/lml/association_label_resolver_spec.rb +139 -0
  240. data/spec/lml/lutaml/lml/data_processor_spec.rb +274 -0
  241. data/spec/lml/lutaml/lml/declarations_spec.rb +337 -0
  242. data/spec/lml/lutaml/lml/document_builder_registry_spec.rb +52 -0
  243. data/spec/lml/lutaml/lml/document_builder_spec.rb +99 -0
  244. data/spec/lml/lutaml/lml/element_visibility_spec.rb +128 -0
  245. data/spec/lml/lutaml/lml/entity_types_spec.rb +56 -0
  246. data/spec/lml/lutaml/lml/enum_spec.rb +77 -0
  247. data/spec/lml/lutaml/lml/executor/adapter_helpers_spec.rb +96 -0
  248. data/spec/lml/lutaml/lml/executor/condition_evaluator_spec.rb +393 -0
  249. data/spec/lml/lutaml/lml/executor/csv_adapter_spec.rb +151 -0
  250. data/spec/lml/lutaml/lml/executor/format_adapter_spec.rb +31 -0
  251. data/spec/lml/lutaml/lml/executor/xml_adapter_spec.rb +201 -0
  252. data/spec/lml/lutaml/lml/executor_spec.rb +71 -0
  253. data/spec/lml/lutaml/lml/format_adapter_spec.rb +272 -0
  254. data/spec/lml/lutaml/lml/format_autoload_spec.rb +31 -0
  255. data/spec/lml/lutaml/lml/grammar_spec.rb +581 -0
  256. data/spec/lml/lutaml/lml/has_attributes_spec.rb +54 -0
  257. data/spec/lml/lutaml/lml/import_resolver_spec.rb +116 -0
  258. data/spec/lml/lutaml/lml/instance_hydration_spec.rb +178 -0
  259. data/spec/lml/lutaml/lml/lsp/server_spec.rb +285 -0
  260. data/spec/lml/lutaml/lml/model_compiler_spec.rb +406 -0
  261. data/spec/lml/lutaml/lml/models/association_spec.rb +40 -0
  262. data/spec/lml/lutaml/lml/models/collection_spec.rb +27 -0
  263. data/spec/lml/lutaml/lml/models/data_type_spec.rb +34 -0
  264. data/spec/lml/lutaml/lml/models/diagram_spec.rb +18 -0
  265. data/spec/lml/lutaml/lml/models/document_spec.rb +64 -0
  266. data/spec/lml/lutaml/lml/models/enum_spec.rb +42 -0
  267. data/spec/lml/lutaml/lml/models/inheritance_spec.rb +77 -0
  268. data/spec/lml/lutaml/lml/models/instance_collection_spec.rb +62 -0
  269. data/spec/lml/lutaml/lml/models/instance_spec.rb +81 -0
  270. data/spec/lml/lutaml/lml/models/instances_export_spec.rb +23 -0
  271. data/spec/lml/lutaml/lml/models/instances_import_spec.rb +28 -0
  272. data/spec/lml/lutaml/lml/models/package_spec.rb +26 -0
  273. data/spec/lml/lutaml/lml/models/primitive_type_spec.rb +34 -0
  274. data/spec/lml/lutaml/lml/models/top_element_attribute_spec.rb +153 -0
  275. data/spec/lml/lutaml/lml/models/uml_class_spec.rb +70 -0
  276. data/spec/lml/lutaml/lml/models_version_spec.rb +27 -0
  277. data/spec/lml/lutaml/lml/operations_spec.rb +59 -0
  278. data/spec/lml/lutaml/lml/parser_spec.rb +348 -0
  279. data/spec/lml/lutaml/lml/pipeline_spec.rb +93 -0
  280. data/spec/lml/lutaml/lml/preprocessor_spec.rb +174 -0
  281. data/spec/lml/lutaml/lml/property_laws_spec.rb +344 -0
  282. data/spec/lml/lutaml/lml/real_world_spec.rb +191 -0
  283. data/spec/lml/lutaml/lml/reference_spec.rb +64 -0
  284. data/spec/lml/lutaml/lml/round_trip_spec.rb +457 -0
  285. data/spec/lml/lutaml/lml/rs3001_corpus_spec.rb +83 -0
  286. data/spec/lml/lutaml/lml/rs3001_syntax_spec.rb +77 -0
  287. data/spec/lml/lutaml/lml/serialization_mapping_spec.rb +127 -0
  288. data/spec/lml/lutaml/lml/source_spec.rb +62 -0
  289. data/spec/lml/lutaml/lml/transform_spec.rb +37 -0
  290. data/spec/lml/lutaml/lml/types/text_type_spec.rb +43 -0
  291. data/spec/lml/lutaml/lml/validator_spec.rb +238 -0
  292. data/spec/lml/lutaml/lml/view_resolver_spec.rb +78 -0
  293. data/spec/lml/lutaml/lml/view_spec.rb +112 -0
  294. data/spec/lml/lutaml/parsers/dsl_spec.rb +275 -0
  295. data/spec/lml/lutaml/parsers/yaml_spec.rb +52 -0
  296. data/spec/lml/lutaml/qualified_type_spec.rb +33 -0
  297. data/spec/lutaml/model/adapter_type_unset_restore_spec.rb +61 -0
  298. data/spec/lutaml/model/custom_bibtex_adapter_spec.rb +4 -1
  299. data/spec/lutaml/xml/adapter/moxml_lane_spec.rb +112 -0
  300. data/spec/lutaml/xml/adapter_metadata_default_spec.rb +21 -2
  301. data/spec/lutaml/xml/adapter_moxml_engine_spec.rb +57 -0
  302. data/spec/lutaml/xml/leptris/native_emission_plain_model_spec.rb +50 -0
  303. data/spec/lutaml/xml/plain_model_mapping_resolution_spec.rb +88 -0
  304. data/spec/lutaml/xml/schema/xsd/vc_versioning_spec.rb +49 -0
  305. data/spec/lutaml/xml/schema/xsd/xsd_11_constructs_spec.rb +43 -0
  306. metadata +286 -2
@@ -99,15 +99,34 @@ module Lutaml
99
99
  # Set the adapter type for a format (validates and loads).
100
100
  #
101
101
  # @param format [Symbol] the format name
102
- # @param type_name [Symbol] the adapter type name (:nokogiri, :ox, etc.)
103
- # @return [Class] the loaded adapter class
102
+ # @param type_name [Symbol, nil] the adapter type name (:nokogiri,
103
+ # :ox, etc.); nil restores the unset/default delegate form
104
+ # (#1234) — the documented save/restore contract writes the
105
+ # saved reader value back, and that value is nil when no pin
106
+ # was set
107
+ # @return [Class, void] the loaded adapter class, nothing for nil
104
108
  def set_adapter_type(format, type_name)
109
+ return unset_adapter_type(format) if type_name.nil?
110
+
105
111
  type_name = type_name.to_sym
106
112
  validate!(format, type_name)
107
113
  configured_types[format] = type_name
108
114
  resolved[format] = load_adapter(format, type_name)
109
115
  end
110
116
 
117
+ # Clear a format's adapter pin (#1224): the configured type and
118
+ # the resolved class both drop, restoring the selection ladder —
119
+ # explicit configuration falls back to auto-detection (moxml's
120
+ # runtime answer) and then the metadata default. A consumer can
121
+ # undo another gem's process-wide pin through this supported
122
+ # call instead of fighting it.
123
+ def unset_adapter_type(format)
124
+ configured_types.delete(format)
125
+ resolved.delete(format)
126
+ detected_types.delete(format)
127
+ detected_formats.delete(format)
128
+ end
129
+
111
130
  # Store a pre-resolved adapter class for a format.
112
131
  #
113
132
  # Used by FormatRegistry.register for key-value formats that have
@@ -60,6 +60,14 @@ module Lutaml
60
60
  AdapterResolver.adapter_for(format)
61
61
  end
62
62
 
63
+ # Unset a format's adapter pin (#1224): the format returns to
64
+ # the selection ladder — auto-detection (moxml's runtime
65
+ # answer), then the metadata default. The supported way to undo
66
+ # another gem's process-wide pin.
67
+ def unset_adapter_type(format)
68
+ AdapterResolver.unset_adapter_type(format)
69
+ end
70
+
63
71
  # Store a pre-resolved adapter class for a format.
64
72
  #
65
73
  # @param format [Symbol] the format name
@@ -90,6 +98,12 @@ module Lutaml
90
98
  define_method(:"#{format}_adapter_type") do
91
99
  AdapterResolver.configured_type(format)
92
100
  end
101
+
102
+ # Unset this format's adapter pin, restoring auto-detection
103
+ # (#1234)
104
+ define_method(:"unset_#{format}_adapter_type") do
105
+ AdapterResolver.unset_adapter_type(format)
106
+ end
93
107
  end
94
108
 
95
109
  # Store used by classes that declare `cache_conversions`.
@@ -159,6 +173,14 @@ module Lutaml
159
173
  define_method(:"#{format}_adapter_type") do
160
174
  AdapterResolver.configured_type(format)
161
175
  end
176
+
177
+ # Unset the adapter pin (#1224): the format returns to the
178
+ # selection ladder (explicit configuration > auto-detection >
179
+ # the metadata default). The only supported way to undo
180
+ # another gem's process-wide pin.
181
+ define_method(:"unset_#{format}_adapter_type") do
182
+ AdapterResolver.unset_adapter_type(format)
183
+ end
162
184
  end
163
185
 
164
186
  def to_class_name(str)
@@ -173,9 +173,11 @@ module Lutaml
173
173
  # rewrites :prefix to :use_prefix before this gate.
174
174
  options.key?(:prefix) || options.key?(:use_prefix)
175
175
 
176
- adapter_name = Lutaml::Model::Config.adapter_for(:xml)
177
- adapter_name &&= adapter_name.name
178
- return nil unless adapter_name.to_s.end_with?("LeptrisAdapter")
176
+ # The deferred (:moxml) lane resolves through to its engine
177
+ # here; concrete adapters answer themselves (#1224).
178
+ adapter = Lutaml::Model::Config.adapter_for(:xml)
179
+ return nil unless adapter&.engine_adapter_class&.name.to_s
180
+ .end_with?("LeptrisAdapter")
179
181
 
180
182
  register = extract_register_id(nil)
181
183
  plan = Lutaml::Xml::Leptris::PlanCompiler.compile(self, register)
@@ -208,9 +210,9 @@ module Lutaml
208
210
  # the declaring class instead (#1208).
209
211
  return nil if model && model != self
210
212
 
211
- adapter_name = Lutaml::Model::Config.adapter_for(:xml)
212
- adapter_name = adapter_name&.name
213
- return nil unless adapter_name.to_s.end_with?("LeptrisAdapter")
213
+ adapter = Lutaml::Model::Config.adapter_for(:xml)
214
+ return nil unless adapter&.engine_adapter_class&.name.to_s
215
+ .end_with?("LeptrisAdapter")
214
216
 
215
217
  register = extract_register_id(nil)
216
218
  plan = Lutaml::Xml::Leptris::PlanCompiler.compile(self, register)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.187"
5
+ VERSION = "0.8.188"
6
6
  end
7
7
  end
@@ -31,6 +31,32 @@ module Lutaml
31
31
  EMPTY_DOCUMENT_ERROR_TYPE = :invalid_format
32
32
  PARSE_ERROR_CLASS = nil
33
33
 
34
+ # Deferred-resolution seams (#1224): the adapter contract the
35
+ # parse/serialize machinery reads. Concrete adapters answer
36
+ # from their constants; the deferred (:moxml) lane overrides
37
+ # these to resolve the engine at call time.
38
+ def self.parsed_element_class
39
+ self::PARSED_ELEMENT_CLASS
40
+ end
41
+
42
+ def self.moxml_adapter_class
43
+ self::MOXML_ADAPTER
44
+ end
45
+
46
+ def self.parse_error_class_or_nil
47
+ self::PARSE_ERROR_CLASS
48
+ end
49
+
50
+ # The lutaml adapter class of the engine actually serving this
51
+ # lane. Concrete adapters are their own engine; the deferred
52
+ # (:moxml) lane overrides this alongside the seams above.
53
+ # Callers that must know the concrete engine class by name (the
54
+ # leptris plan fast-path gates) ask here instead of
55
+ # string-matching the resolved adapter class.
56
+ def self.engine_adapter_class
57
+ self
58
+ end
59
+
34
60
  # Convert a Formal Public Identifier (FPI) to a URN per RFC 3151.
35
61
  # FPI examples: "-//OASIS//DTD XML Exchange Table Model 19990315//EN"
36
62
  # Returns nil if the string is not an FPI.
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "moxml"
4
+
5
+ module Lutaml
6
+ module Xml
7
+ module Adapter
8
+ # The deferred (facade) lane (#1224): the `:moxml` adapter type.
9
+ # The ENGINE resolves at call time from moxml's runtime answer —
10
+ # the engine stays a deployment decision owned by moxml, the way
11
+ # detection has always treated it ("moxml is the authority on
12
+ # XML adapter availability"). Resolution caches per engine name:
13
+ # a bundle that pins moxml's default to leptris gets the
14
+ # leptris lane, a nokogiri pin gets nokogiri, without
15
+ # re-resolving per parse.
16
+ class MoxmlAdapter < BaseAdapter
17
+ class << self
18
+ def resolved_adapter
19
+ engine = Moxml::Config.runtime_default_adapter
20
+ @resolved ||= {}
21
+ @resolved[engine] ||= begin
22
+ # the loader's normalization shape: :leptris ->
23
+ # "leptris_adapter" -> Lutaml::Xml::Adapter::LeptrisAdapter
24
+ type_name = "#{engine}_adapter"
25
+ Lutaml::Xml::AdapterLoader.load_adapter_file(:xml, type_name)
26
+ Lutaml::Xml::AdapterLoader.class_for(:xml, type_name)
27
+ end
28
+ end
29
+
30
+ def parsed_element_class
31
+ resolved_adapter.parsed_element_class
32
+ end
33
+
34
+ def moxml_adapter_class
35
+ resolved_adapter.moxml_adapter_class
36
+ end
37
+
38
+ def parse_error_class_or_nil
39
+ resolved_adapter.parse_error_class_or_nil
40
+ end
41
+
42
+ def engine_adapter_class
43
+ resolved_adapter
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -24,7 +24,7 @@ module Lutaml
24
24
 
25
25
  raise_empty_document_error(parsed.parse_errors) if root_element.nil?
26
26
 
27
- root = self::PARSED_ELEMENT_CLASS.new(root_element)
27
+ root = parsed_element_class.new(root_element)
28
28
  doc_pis = extract_document_processing_instructions(parsed)
29
29
  root.processing_instructions = doc_pis unless doc_pis.empty?
30
30
  new(root, parse_encoding, **parse_document_options(raw_xml))
@@ -49,14 +49,14 @@ module Lutaml
49
49
  end
50
50
 
51
51
  def parse_with_moxml(xml, parse_encoding)
52
- parse_error_class = self::PARSE_ERROR_CLASS
52
+ parse_error_class = parse_error_class_or_nil
53
53
  unless parse_error_class
54
- return self::MOXML_ADAPTER.parse(xml,
54
+ return moxml_adapter_class.parse(xml,
55
55
  encoding: parse_encoding)
56
56
  end
57
57
 
58
58
  begin
59
- self::MOXML_ADAPTER.parse(xml, encoding: parse_encoding)
59
+ moxml_adapter_class.parse(xml, encoding: parse_encoding)
60
60
  rescue parse_error_class => e
61
61
  raise Lutaml::Model::InvalidFormatError.new(:xml, e.message)
62
62
  end
@@ -88,7 +88,7 @@ module Lutaml
88
88
  end
89
89
 
90
90
  builder = self.class::BUILDER_CLASS.build(builder_options) do |xml|
91
- if root.is_a?(self.class::PARSED_ELEMENT_CLASS)
91
+ if root.is_a?(self.class.parsed_element_class)
92
92
  root.build_xml(xml)
93
93
  else
94
94
  build_serializable_xml(xml, options)
@@ -14,10 +14,15 @@ module Lutaml
14
14
  "#{__dir__}/adapter/namespace_uri_collector"
15
15
  autoload :OgaAdapter, "#{__dir__}/adapter/oga_adapter"
16
16
  autoload :RexmlAdapter, "#{__dir__}/adapter/rexml_adapter"
17
+ # Plain autoload (in addition to the native table): the Opal boot
18
+ # generator harvests `autoload :Name, "path"` declarations only,
19
+ # so the facade must appear here to ride the sequential boot.
20
+ autoload :MoxmlAdapter, "#{__dir__}/adapter/moxml_adapter"
17
21
  Lutaml::Model::RuntimeCompatibility.autoload_native(
18
22
  self,
19
23
  NokogiriAdapter: "#{__dir__}/adapter/nokogiri_adapter",
20
24
  OxAdapter: "#{__dir__}/adapter/ox_adapter",
25
+ MoxmlAdapter: "#{__dir__}/adapter/moxml_adapter",
21
26
  )
22
27
  end
23
28
  end
@@ -32,6 +32,11 @@ module Lutaml
32
32
  # @param type_name [Symbol] The adapter type (:nokogiri, :ox, etc.)
33
33
  # @param _adapter_name [Symbol] The format name (:xml)
34
34
  def self.load_moxml_adapter(type_name, _adapter_name)
35
+ # The deferred lane (#1224): :moxml names no engine - the
36
+ # MoxmlAdapter class resolves the engine at call time, so
37
+ # there is nothing to pre-load here.
38
+ return if type_name.to_sym == :moxml
39
+
35
40
  Moxml::Adapter.load(type_name)
36
41
  end
37
42
 
@@ -88,6 +88,23 @@ module Lutaml
88
88
  Lutaml::Model::Config.xml_adapter_type
89
89
  end
90
90
 
91
+ # The moxml ENGINE matching the current configuration.
92
+ #
93
+ # The configured xml adapter type names a LANE (:moxml is the
94
+ # deferred lane); the engine Moxml deploys underneath comes from
95
+ # Moxml::Config's own default. Schema/builder surfaces that
96
+ # construct Moxml contexts directly must ask here, not at
97
+ # Config.xml_adapter_type, whose lane value is not a valid Moxml
98
+ # adapter name (#1224).
99
+ #
100
+ # @return [Symbol] a Moxml adapter name (:nokogiri, :leptris, ...)
101
+ def self.moxml_engine
102
+ type = Lutaml::Model::Config.xml_adapter_type
103
+ return Moxml::Config.default.adapter_name if type.nil? || type == :moxml
104
+
105
+ type
106
+ end
107
+
91
108
  # Autoload core classes
92
109
  autoload :Location, "#{__dir__}/schema_location"
93
110
  autoload :SchemaLocation, "#{__dir__}/schema_location"
@@ -200,14 +217,18 @@ Lutaml::Model::FormatRegistry.register(
200
217
  }
201
218
  else
202
219
  {
203
- available: %i[nokogiri ox oga rexml leptris],
220
+ available: %i[nokogiri ox oga rexml leptris moxml],
204
221
  # #908: the metadata default is the LAST resort —
205
222
  # explicit configuration and moxml runtime detection
206
223
  # answer first. When resolution falls this far, prefer
207
224
  # leptris, consistent with moxml's runtime preference
208
225
  # (leptris whenever present); bundles without it
209
226
  # resolve through auto-detection long before here.
210
- default: :leptris,
227
+ # #1224: the metadata default is the DEFERRED lane -
228
+ # resolution defers the engine to moxml at parse
229
+ # time (the facade lane), so a consumer selecting the
230
+ # default never hard-codes an engine name.
231
+ default: :moxml,
211
232
  }
212
233
  end,
213
234
  )
@@ -867,7 +867,12 @@ module Lutaml
867
867
  # documents whose XML attribute sequence must be replayed)
868
868
  # take the per-instance path.
869
869
  def emit_attributes(buf, len, instance, plan, plan_index, register)
870
- recorded = instance.attribute_order
870
+ # Plain `model` instances may not carry the XML face accessors
871
+ # (a runtime capability installed by the serialization hooks),
872
+ # so the capability check mirrors should_use_element_order?
873
+ # rather than assuming Serializable's accessor set (#1232).
874
+ recorded = instance.respond_to?(:attribute_order) &&
875
+ instance.attribute_order
871
876
  if recorded && !recorded.empty?
872
877
  return emit_attributes_recorded(buf, len, instance, plan,
873
878
  plan_index, register,
@@ -645,7 +645,11 @@ module Lutaml
645
645
  # (parsed models), else plan row order.
646
646
  def write_attributes(element, instance, plan, reg = nil,
647
647
  ns_ctx = nil)
648
- recorded = instance.attribute_order
648
+ # Plain `model` instances may not carry the XML face accessors
649
+ # (a runtime capability installed by the serialization hooks);
650
+ # the capability check mirrors should_use_element_order? (#1232).
651
+ recorded = instance.respond_to?(:attribute_order) &&
652
+ instance.attribute_order
649
653
  attr_prefixes = nil
650
654
  if ns_ctx && !(plan[:tree][:attributes] || []).empty?
651
655
  attr_prefixes = {}
@@ -101,8 +101,15 @@ module Lutaml
101
101
  @model_class ||= instance.class
102
102
  end
103
103
 
104
+ # Non-Serialize custom models (a plain class handed to a Serializable
105
+ # mapper via `model`, e.g. relaton's Bibcollection) have no mappings:
106
+ # their class does not answer mappings_for, so resolving one would
107
+ # raise NoMethodError mid-parse (#1212 follow-up).
104
108
  def xml_mapping
105
- @xml_mapping ||= model_class.mappings_for(:xml, register)
109
+ @xml_mapping ||=
110
+ if instance_is_serialize
111
+ model_class.mappings_for(:xml, register)
112
+ end
106
113
  end
107
114
 
108
115
  # The document's own namespace when it differs from the model's
@@ -21,7 +21,7 @@ module Lutaml
21
21
 
22
22
  def initialize(options = {}, &block)
23
23
  encoding = options[:encoding] || "UTF-8"
24
- backend = Lutaml::Model::Config.xml_adapter_type || :nokogiri
24
+ backend = Lutaml::Xml.moxml_engine
25
25
  @context = ::Moxml.new(backend)
26
26
  @builder = ::Moxml::Builder.new(@context)
27
27
  # Nokogiri's Builder emits the declaration when an
@@ -23,7 +23,7 @@ module Lutaml
23
23
 
24
24
  def initialize(adapter_type: nil, options: {}, &block)
25
25
  # Use specified adapter, or configured XML adapter, or default to Nokogiri
26
- requested_adapter = adapter_type || Lutaml::Model::Config.xml_adapter_type || :nokogiri
26
+ requested_adapter = adapter_type || Lutaml::Xml.moxml_engine
27
27
 
28
28
  # Engines with a dedicated wrapper keep it (byte-identical
29
29
  # emission); every other configured engine generates through
@@ -15,7 +15,7 @@ module Lutaml
15
15
  def self.generate(klass, options = {})
16
16
  register = extract_register_from(klass)
17
17
  adapter = options[:adapter] ||
18
- Lutaml::Model::Config.xml_adapter_type || :nokogiri
18
+ Lutaml::Xml.moxml_engine
19
19
  builder = Builder.new(
20
20
  adapter_type: adapter,
21
21
  options: { encoding: "UTF-8" },
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../namespace"
4
+
5
+ module Lutaml
6
+ module Xml
7
+ module Schema
8
+ # W3C XML Schema Versioning Namespace (XSD 1.1 §C.1)
9
+ #
10
+ # The vc: namespace carries the schema-dialect markers
11
+ # (vc:minVersion / vc:maxVersion / vc:typeAvailable ...) that
12
+ # gate 1.1-only constructs on 1.0-labeled schemas. The engine
13
+ # tier compiles alternatives, openContent and assertions only
14
+ # when the marker survives to compilation — the roundtrip must
15
+ # not erase it (#1222).
16
+ #
17
+ # @see https://www.w3.org/2007/XMLSchema-versioning
18
+ class VcNamespace < Lutaml::Xml::Namespace
19
+ uri "http://www.w3.org/2007/XMLSchema-versioning"
20
+ prefix_default "vc"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -9,6 +9,8 @@ module Lutaml
9
9
  attribute :min_occurs, :string
10
10
  attribute :max_occurs, :string
11
11
  attribute :namespace, :string
12
+ attribute :not_namespace, :string
13
+ attribute :not_qname, :string
12
14
  attribute :process_contents, :string
13
15
  attribute :annotation, :annotation
14
16
 
@@ -19,6 +21,8 @@ module Lutaml
19
21
 
20
22
  map_attribute :id, to: :id
21
23
  map_attribute :namespace, to: :namespace
24
+ map_attribute :notNamespace, to: :not_namespace
25
+ map_attribute :notQName, to: :not_qname
22
26
  map_attribute :minOccurs, to: :min_occurs
23
27
  map_attribute :maxOccurs, to: :max_occurs
24
28
  map_attribute :processContents, to: :process_contents
@@ -7,6 +7,8 @@ module Lutaml
7
7
  class AnyAttribute < Base
8
8
  attribute :id, :string
9
9
  attribute :namespace, :string
10
+ attribute :not_namespace, :string
11
+ attribute :not_qname, :string
10
12
  attribute :process_contents, :string
11
13
  attribute :annotation, :annotation
12
14
 
@@ -17,6 +19,8 @@ module Lutaml
17
19
 
18
20
  map_attribute :id, to: :id
19
21
  map_attribute :namespace, to: :namespace
22
+ map_attribute :notNamespace, to: :not_namespace
23
+ map_attribute :notQName, to: :not_qname
20
24
  map_attribute :processContents, to: :process_contents
21
25
  map_element :annotation, to: :annotation
22
26
  end
@@ -196,6 +196,13 @@ module Lutaml
196
196
  next unless element == instance
197
197
 
198
198
  method_name = ::Lutaml::Model::Utils.snake_case(instance.name)
199
+ # Unmapped element names (a schema may declare <xs:element
200
+ # name="head"> with no metaschema member carrying it) have
201
+ # no collection accessor to index into; the entry stays as
202
+ # recorded instead of crashing the walk (UnitsML's bundled
203
+ # modules, ruby 3.3 lane).
204
+ next unless respond_to?(method_name, true)
205
+
199
206
  array[i] = Array(public_send(method_name))[index]
200
207
  index += 1
201
208
  end
@@ -5,6 +5,8 @@ module Lutaml
5
5
  module Schema
6
6
  module Xsd
7
7
  class Schema < Base
8
+ attribute :vc_min_version, :string
9
+ attribute :vc_max_version, :string
8
10
  attribute :id, :string
9
11
  attribute :lang, :string
10
12
  attribute :xmlns, :string
@@ -66,6 +68,12 @@ module Lutaml
66
68
  map_attribute :finalDefault, to: :final_default
67
69
  map_attribute :blockDefault, to: :block_default
68
70
  map_attribute :version, to: :version
71
+ map_attribute "minVersion", to: :vc_min_version,
72
+ with: { from: :vc_min_version_from,
73
+ to: :vc_min_version_to }
74
+ map_attribute "maxVersion", to: :vc_max_version,
75
+ with: { from: :vc_max_version_from,
76
+ to: :vc_max_version_to }
69
77
  map_attribute :id, to: :id
70
78
  map_attribute :lang, to: :lang
71
79
  end
@@ -147,6 +155,36 @@ module Lutaml
147
155
  attribute_group.sort_by { |item| item.name.to_s }
148
156
  end
149
157
 
158
+ def vc_min_version_from(model, value)
159
+ model.vc_min_version = value
160
+ end
161
+
162
+ def vc_min_version_to(model, parent, _wrapper)
163
+ return if model.vc_min_version.nil?
164
+
165
+ parent.add_attribute(
166
+ ::Lutaml::Xml::DataModel::XmlAttribute.new(
167
+ "minVersion", model.vc_min_version,
168
+ Lutaml::Xml::Schema::VcNamespace
169
+ ),
170
+ )
171
+ end
172
+
173
+ def vc_max_version_from(model, value)
174
+ model.vc_max_version = value
175
+ end
176
+
177
+ def vc_max_version_to(model, parent, _wrapper)
178
+ return if model.vc_max_version.nil?
179
+
180
+ parent.add_attribute(
181
+ ::Lutaml::Xml::DataModel::XmlAttribute.new(
182
+ "maxVersion", model.vc_max_version,
183
+ Lutaml::Xml::Schema::VcNamespace
184
+ ),
185
+ )
186
+ end
187
+
150
188
  def target_namespace_from(model, value)
151
189
  model.target_namespace = value
152
190
  model.target_namespace_prefix =
@@ -114,7 +114,7 @@ module Lutaml
114
114
  # the backend follows the CURRENT config (hosts and suites
115
115
  # switch adapters mid-process); construction is cheap.
116
116
  def self.parse_context
117
- Moxml.new(Lutaml::Model::Config.xml_adapter_type || :nokogiri)
117
+ Moxml.new(Lutaml::Xml.moxml_engine)
118
118
  end
119
119
 
120
120
  # Check if document has XSD 1.1 specific features
@@ -11,6 +11,7 @@ end
11
11
 
12
12
  # Require the XsdNamespace class for XSD schema support
13
13
  require_relative "xsd_namespace"
14
+ require_relative "vc_namespace"
14
15
 
15
16
  # Ensure parent module hierarchy exists before loading child files
16
17
  # This allows child files to use compact module syntax (module Lutaml::Xml::Schema::Xsd)
@@ -100,7 +100,7 @@ module Lutaml
100
100
  validate_xsd_types!(klass, register) unless options[:skip_validation]
101
101
 
102
102
  # Use Builder with adapter from options or config
103
- adapter_type = options[:adapter] || Lutaml::Model::Config.xml_adapter_type || :nokogiri
103
+ adapter_type = options[:adapter] || Lutaml::Xml.moxml_engine
104
104
 
105
105
  schema_builder = Builder.new(
106
106
  adapter_type: adapter_type,
@@ -215,6 +215,12 @@ module Lutaml
215
215
  :mixed)
216
216
  Lutaml::Model::Utils.add_accessor_if_not_defined(klass,
217
217
  :element_order)
218
+ # The attribute-side twin of element_order: parsed documents
219
+ # record their XML attribute sequence here for replay on
220
+ # serialization; the leptris emission reads it on every
221
+ # instance, so plain model classes must carry it too (#1232).
222
+ Lutaml::Model::Utils.add_accessor_if_not_defined(klass,
223
+ :attribute_order)
218
224
  Lutaml::Model::Utils.add_accessor_if_not_defined(klass, :encoding)
219
225
  Lutaml::Model::Utils.add_accessor_if_not_defined(klass, :doctype)
220
226
  # XML namespace metadata accessors for custom model classes
@@ -71,7 +71,7 @@ module Lutaml
71
71
  # configured type, whose FIXED_ADAPTER_TYPE sentinel is internal
72
72
  # and must never reach Moxml (the closed #1183 leak).
73
73
  def self.backend
74
- Lutaml::Model::Config.xml_adapter_type || :nokogiri
74
+ Lutaml::Xml.moxml_engine
75
75
  end
76
76
 
77
77
  def self.engine_supports_xsd?
data/lutaml-model.gemspec CHANGED
@@ -52,6 +52,8 @@ Gem::Specification.new do |spec|
52
52
  # directory-guarded in the Rakefile for both lines.
53
53
  spec.add_dependency "moxml", "~> 0.6.1"
54
54
  spec.add_dependency "ostruct"
55
+ # LML grammar machinery (subsumed language core)
56
+ spec.add_dependency "parsanol", "~> 1.5.0"
55
57
  spec.add_dependency "rubyzip", "~> 3.7"
56
58
  spec.add_dependency "thor", "~> 1.4"
57
59
 
@@ -0,0 +1,34 @@
1
+ diagram MyView {
2
+ title "my diagram"
3
+
4
+ class AddressClassProfile {
5
+ addressClassProfile
6
+ }
7
+ class AttributeProfile {
8
+ attributeProfile
9
+ }
10
+
11
+ association BidirectionalAsscoiation {
12
+ owner_type aggregation
13
+ member_type direct
14
+ owner AddressClassProfile#addressClassProfile
15
+ member AttributeProfile#attributeProfile [0..*]
16
+ }
17
+
18
+ association DirectAsscoiation {
19
+ member_type direct
20
+ owner AddressClassProfile
21
+ member AttributeProfile#attributeProfile
22
+ }
23
+
24
+ class Foo {
25
+ +structuredidentifier[0..*]: StructuredIdentifierType
26
+ +technicalcommittee[1..*]: TechnicalCommitteeType
27
+ }
28
+
29
+ association ReverseAsscoiation {
30
+ owner_type aggregation
31
+ owner AddressClassProfile#addressClassProfile
32
+ member AttributeProfile
33
+ }
34
+ }
@@ -0,0 +1,4 @@
1
+ diagram MyView {
2
+ // <article>
3
+ class Foo {}
4
+ }
@@ -0,0 +1,6 @@
1
+ diagram MyView {
2
+ fontname "Arial"
3
+ title "my diagram, another symbols: text."
4
+ class Foo {}
5
+ caption "Block elements of StandardDocument, adapted from BasicDocument. Another - symbol"
6
+ }
@@ -0,0 +1,6 @@
1
+ diagram MyView {
2
+ class ImageMapAreaType {
3
+ definition {
4
+ }
5
+ }
6
+ }