lutaml-model 0.8.16 → 0.8.18
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.
- checksums.yaml +4 -4
- data/.github/workflows/downstream-performance.yml +27 -1
- data/.github/workflows/js-pr-check.yml +102 -0
- data/.github/workflows/js-sync.yml +51 -0
- data/.github/workflows/opal.yml +26 -6
- data/.github/workflows/performance.yml +32 -7
- data/.github/workflows/rake.yml +78 -32
- data/.github/workflows/release.yml +0 -3
- data/.gitmodules +6 -0
- data/.rubocop_todo.yml +76 -12
- data/Gemfile +16 -1
- data/README.adoc +267 -0
- data/Rakefile +166 -4
- data/docs/_guides/schema-import.adoc +42 -0
- data/docs/_guides/xml/namespace-semantics.adoc +2 -0
- data/docs/_guides/xml-mapping.adoc +21 -0
- data/docs/_guides/xml-namespace-qualification.adoc +142 -0
- data/docs/_pages/validation.adoc +65 -0
- data/docs/_tutorials/xml-element-attribute-namespace-guide.adoc +2 -0
- data/docs/_tutorials/xml-schema-primer-style-guide.adoc +2 -0
- data/docs/namespace-management.adoc +2 -0
- data/docs/xml-schema-qualification.md +6 -0
- data/lib/compat/opal/generate_boot.rb +123 -0
- data/lib/compat/opal/js_bundle_entry.rb +42 -0
- data/lib/compat/opal/lutaml_model_boot.rb +497 -0
- data/lib/compat/opal/moxml_boot.rb +68 -0
- data/lib/compat/opal/yaml_compat.rb +32 -0
- data/lib/lutaml/json.rb +1 -1
- data/lib/lutaml/jsonld.rb +1 -4
- data/lib/lutaml/key_value/transform.rb +3 -8
- data/lib/lutaml/key_value/transformation/value_serializer.rb +14 -1
- data/lib/lutaml/key_value/transformation.rb +17 -5
- data/lib/lutaml/model/adapter_resolver.rb +2 -2
- data/lib/lutaml/model/attribute.rb +88 -11
- data/lib/lutaml/model/cached_type_resolver.rb +1 -1
- data/lib/lutaml/model/choice.rb +34 -0
- data/lib/lutaml/model/compiled_rule.rb +7 -0
- data/lib/lutaml/model/error/union_schema_unsupported_error.rb +11 -0
- data/lib/lutaml/model/global_context.rb +11 -8
- data/lib/lutaml/model/instrumentation.rb +2 -2
- data/lib/lutaml/model/mapping/mapping_rule.rb +0 -6
- data/lib/lutaml/model/register.rb +2 -2
- data/lib/lutaml/model/runtime_compatibility.rb +50 -0
- data/lib/lutaml/model/schema/class_loader.rb +58 -0
- data/lib/lutaml/model/schema/compiled_output.rb +83 -0
- data/lib/lutaml/model/schema/definitions/attribute.rb +32 -0
- data/lib/lutaml/model/schema/definitions/choice.rb +20 -0
- data/lib/lutaml/model/schema/definitions/facet.rb +40 -0
- data/lib/lutaml/model/schema/definitions/group_import.rb +22 -0
- data/lib/lutaml/model/schema/definitions/member_walk.rb +33 -0
- data/lib/lutaml/model/schema/definitions/model.rb +40 -0
- data/lib/lutaml/model/schema/definitions/namespace.rb +23 -0
- data/lib/lutaml/model/schema/definitions/restricted_type.rb +30 -0
- data/lib/lutaml/model/schema/definitions/sequence.rb +19 -0
- data/lib/lutaml/model/schema/definitions/simple_content.rb +22 -0
- data/lib/lutaml/model/schema/definitions/transform_facet.rb +21 -0
- data/lib/lutaml/model/schema/definitions/type_ref.rb +20 -0
- data/lib/lutaml/model/schema/definitions/union_type.rb +28 -0
- data/lib/lutaml/model/schema/definitions/xml_root.rb +20 -0
- data/lib/lutaml/model/schema/definitions.rb +24 -0
- data/lib/lutaml/model/schema/file_writer.rb +70 -0
- data/lib/lutaml/model/schema/generator/definitions_collection.rb +16 -2
- data/lib/lutaml/model/schema/generator/property.rb +21 -4
- data/lib/lutaml/model/schema/module_nesting.rb +31 -0
- data/lib/lutaml/model/schema/namespace_naming.rb +46 -0
- data/lib/lutaml/model/schema/registry_generator.rb +115 -0
- data/lib/lutaml/model/schema/renderers/base.rb +40 -0
- data/lib/lutaml/model/schema/renderers/mappings.rb +72 -0
- data/lib/lutaml/model/schema/renderers/member_decls.rb +115 -0
- data/lib/lutaml/model/schema/renderers/model.rb +121 -0
- data/lib/lutaml/model/schema/renderers/namespace.rb +30 -0
- data/lib/lutaml/model/schema/renderers/registration.rb +64 -0
- data/lib/lutaml/model/schema/renderers/required_files_calculator.rb +93 -0
- data/lib/lutaml/model/schema/renderers/restricted_type.rb +88 -0
- data/lib/lutaml/model/schema/renderers/union.rb +83 -0
- data/lib/lutaml/model/schema/renderers.rb +19 -0
- data/lib/lutaml/model/schema/rnc_compiler/source_resolver.rb +47 -0
- data/lib/lutaml/model/schema/rnc_compiler.rb +62 -0
- data/lib/lutaml/model/schema/rng_compiler/define_classifier.rb +91 -0
- data/lib/lutaml/model/schema/rng_compiler/element_visitor.rb +392 -0
- data/lib/lutaml/model/schema/rng_compiler/member_collector.rb +30 -0
- data/lib/lutaml/model/schema/rng_compiler/rng_helpers.rb +152 -0
- data/lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb +125 -0
- data/lib/lutaml/model/schema/rng_compiler.rb +220 -0
- data/lib/lutaml/model/schema/templates.rb +162 -0
- data/lib/lutaml/model/schema/xml_compiler/element_order.rb +41 -0
- data/lib/lutaml/model/schema/xml_compiler/registry_generator.rb +31 -107
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb +191 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb +216 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +153 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder.rb +167 -0
- data/lib/lutaml/model/schema/xml_compiler/supported_data_types.rb +87 -0
- data/lib/lutaml/model/schema/xml_compiler.rb +38 -517
- data/lib/lutaml/model/schema.rb +19 -0
- data/lib/lutaml/model/serialize/attribute_definition.rb +14 -2
- data/lib/lutaml/model/serialize/builder.rb +15 -2
- data/lib/lutaml/model/serialize/value_mapping.rb +9 -57
- data/lib/lutaml/model/serialize.rb +6 -9
- data/lib/lutaml/model/services/rule_value_extractor.rb +2 -3
- data/lib/lutaml/model/services.rb +0 -2
- data/lib/lutaml/model/store.rb +2 -1
- data/lib/lutaml/model/toml.rb +1 -1
- data/lib/lutaml/model/transform.rb +17 -39
- data/lib/lutaml/model/transformation_registry.rb +1 -1
- data/lib/lutaml/model/type.rb +1 -0
- data/lib/lutaml/model/union.rb +320 -0
- data/lib/lutaml/model/utils.rb +6 -0
- data/lib/lutaml/model/validation.rb +1 -4
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +19 -0
- data/lib/lutaml/{jsonld → rdf}/context.rb +1 -1
- data/lib/lutaml/{jsonld/transform.rb → rdf/linked_data_transform.rb} +33 -35
- data/lib/lutaml/{jsonld → rdf}/term_definition.rb +1 -1
- data/lib/lutaml/rdf.rb +3 -0
- data/lib/lutaml/toml.rb +1 -1
- data/lib/lutaml/xml/adapter.rb +1 -1
- data/lib/lutaml/xml/adapter_element.rb +2 -2
- data/lib/lutaml/xml/adapter_loader.rb +1 -1
- data/lib/lutaml/xml/builder/base.rb +1 -1
- data/lib/lutaml/xml/builder.rb +1 -1
- data/lib/lutaml/xml/error/schema_validation_error.rb +25 -0
- data/lib/lutaml/xml/model_transform.rb +5 -1
- data/lib/lutaml/xml/schema/relaxng_schema.rb +5 -0
- data/lib/lutaml/xml/schema/xsd_schema.rb +4 -0
- data/lib/lutaml/xml/serialization/format_conversion.rb +48 -0
- data/lib/lutaml/xml/serialization/instance_methods.rb +13 -0
- data/lib/lutaml/xml/transformation/element_builder.rb +59 -31
- data/lib/lutaml/xml/transformation/ordered_applier.rb +6 -0
- data/lib/lutaml/xml/xsd_validator.rb +66 -0
- data/lib/lutaml/xml.rb +53 -12
- data/lib/lutaml/yamlld/adapter.rb +25 -0
- data/lib/lutaml/yamlld.rb +25 -0
- data/lutaml-model.gemspec +4 -2
- data/spec/fixtures/xml/schema/rnc/address_book.rnc +15 -0
- data/spec/fixtures/xml/schema/rnc/book_features.rnc +18 -0
- data/spec/fixtures/xml/schema/rnc/includes/book.rnc +6 -0
- data/spec/fixtures/xml/schema/rnc/includes/circular_a.rnc +8 -0
- data/spec/fixtures/xml/schema/rnc/includes/circular_b.rnc +8 -0
- data/spec/fixtures/xml/schema/rnc/includes/library.rnc +8 -0
- data/spec/fixtures/xml/schema/rng/address_book.rng +16 -0
- data/spec/fixtures/xml/schema/rng/book.rng +27 -0
- data/spec/fixtures/xml/schema/rng/fixed_value.rng +11 -0
- data/spec/fixtures/xml/schema/rng/fragment_in_choice.rng +30 -0
- data/spec/fixtures/xml/schema/rng/full_name.rng +39 -0
- data/spec/fixtures/xml/schema/rng/integer_range.rng +32 -0
- data/spec/fixtures/xml/schema/rng/list_type.rng +12 -0
- data/spec/fixtures/xml/schema/rng/namespaced.rng +9 -0
- data/spec/fixtures/xml/schema/rng/paragraph.rng +13 -0
- data/spec/fixtures/xml/schema/rng/person.rng +23 -0
- data/spec/fixtures/xml/schema/rng/union.rng +14 -0
- data/spec/fixtures/xml/validate_xml_with_address.xsd +13 -0
- data/spec/fixtures/xml/validate_xml_with_contact.xsd +11 -0
- data/spec/fixtures/xml/validate_xml_with_person.xsd +11 -0
- data/spec/fixtures/xml/validate_xml_with_person_strict.xsd +17 -0
- data/spec/fixtures/xml/validate_xml_with_product.xsd +37 -0
- data/spec/lutaml/integration/multi_format_spec.rb +23 -0
- data/spec/lutaml/model/attribute_apply_value_map_spec.rb +134 -0
- data/spec/lutaml/model/attribute_spec.rb +177 -13
- data/spec/lutaml/model/boot_manifest_spec.rb +30 -0
- data/spec/lutaml/model/choice_restrict_spec.rb +225 -0
- data/spec/lutaml/model/collection_spec.rb +18 -0
- data/spec/lutaml/model/custom_model_spec.rb +4 -4
- data/spec/lutaml/model/mixed_content_spec.rb +173 -2
- data/spec/lutaml/model/multiple_mapping_spec.rb +4 -4
- data/spec/lutaml/model/opal_smoke_spec.rb +67 -2
- data/spec/lutaml/model/ordered_content_spec.rb +33 -3
- data/spec/lutaml/model/raw_element_spec.rb +125 -0
- data/spec/lutaml/model/rule_value_extractor_spec.rb +7 -14
- data/spec/lutaml/model/runtime_compatibility_spec.rb +25 -0
- data/spec/lutaml/model/schema/renderers/model_spec.rb +149 -0
- data/spec/lutaml/model/schema/renderers/namespace_spec.rb +36 -0
- data/spec/lutaml/model/schema/renderers/restricted_type_spec.rb +75 -0
- data/spec/lutaml/model/schema/renderers/union_spec.rb +58 -0
- data/spec/lutaml/model/transform_apply_value_map_spec.rb +64 -0
- data/spec/lutaml/model/uninitialized_class_spec.rb +1 -1
- data/spec/lutaml/model/union_attribute_spec.rb +658 -0
- data/spec/lutaml/model/union_spec.rb +257 -0
- data/spec/lutaml/model/utils_spec.rb +14 -0
- data/spec/lutaml/model/xsd_form_default_patterns_spec.rb +2 -2
- data/spec/lutaml/model/xsd_patterns_spec.rb +4 -4
- data/spec/lutaml/{jsonld → rdf}/context_spec.rb +2 -2
- data/spec/lutaml/{jsonld/transform_spec.rb → rdf/linked_data_transform_spec.rb} +15 -1
- data/spec/lutaml/{jsonld → rdf}/term_definition_spec.rb +2 -2
- data/spec/lutaml/turtle/transform_spec.rb +2 -2
- data/spec/lutaml/xml/enhanced_mapping_spec.rb +230 -1
- data/spec/lutaml/xml/mapping_spec.rb +4 -4
- data/spec/lutaml/xml/namespace_placement_spec.rb +11 -8
- data/spec/lutaml/xml/namespace_three_phase_spec.rb +1 -1
- data/spec/lutaml/xml/opal_xml_spec.rb +22 -20
- data/spec/lutaml/xml/prefix_control_spec.rb +4 -4
- data/spec/lutaml/xml/schema/compiler_spec.rb +21 -4
- data/spec/lutaml/xml/schema/rnc_compiler_spec.rb +404 -0
- data/spec/lutaml/xml/schema/rng_compiler_spec.rb +893 -0
- data/spec/lutaml/xml/serializable_namespace_spec.rb +6 -6
- data/spec/lutaml/xml/type_namespace_examples_spec.rb +1 -1
- data/spec/lutaml/xml/type_namespace_integration_spec.rb +3 -3
- data/spec/lutaml/xml/validate_xml_with_constructs_spec.rb +222 -0
- data/spec/lutaml/xml/validate_xml_with_spec.rb +186 -0
- data/spec/lutaml/yamlld/adapter_spec.rb +56 -0
- data/spec/lutaml/yamlld/registration_spec.rb +33 -0
- data/spec/spec_helper.rb +28 -11
- data/spec/support/opal.rb +5 -2
- metadata +108 -37
- data/lib/lutaml/model/schema/xml_compiler/attribute.rb +0 -106
- data/lib/lutaml/model/schema/xml_compiler/attribute_group.rb +0 -47
- data/lib/lutaml/model/schema/xml_compiler/choice.rb +0 -67
- data/lib/lutaml/model/schema/xml_compiler/complex_content.rb +0 -27
- data/lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb +0 -34
- data/lib/lutaml/model/schema/xml_compiler/complex_type.rb +0 -173
- data/lib/lutaml/model/schema/xml_compiler/element.rb +0 -121
- data/lib/lutaml/model/schema/xml_compiler/group.rb +0 -113
- data/lib/lutaml/model/schema/xml_compiler/restriction.rb +0 -104
- data/lib/lutaml/model/schema/xml_compiler/sequence.rb +0 -52
- data/lib/lutaml/model/schema/xml_compiler/simple_content.rb +0 -40
- data/lib/lutaml/model/schema/xml_compiler/simple_type.rb +0 -265
- data/lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb +0 -110
- data/lib/lutaml/model/services/default_value_resolver.rb +0 -60
- data/spec/lutaml/model/services/default_value_resolver_spec.rb +0 -162
- data/spec/lutaml/xml/schema/compiler/attribute_group_spec.rb +0 -71
- data/spec/lutaml/xml/schema/compiler/attribute_spec.rb +0 -67
- data/spec/lutaml/xml/schema/compiler/choice_spec.rb +0 -74
- data/spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb +0 -60
- data/spec/lutaml/xml/schema/compiler/complex_content_spec.rb +0 -41
- data/spec/lutaml/xml/schema/compiler/complex_type_spec.rb +0 -202
- data/spec/lutaml/xml/schema/compiler/element_spec.rb +0 -68
- data/spec/lutaml/xml/schema/compiler/group_spec.rb +0 -90
- data/spec/lutaml/xml/schema/compiler/restriction_spec.rb +0 -77
- data/spec/lutaml/xml/schema/compiler/sequence_spec.rb +0 -65
- data/spec/lutaml/xml/schema/compiler/simple_content_spec.rb +0 -61
- data/spec/lutaml/xml/schema/compiler/simple_type_spec.rb +0 -184
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -92,14 +92,14 @@ dependencies:
|
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.1.
|
|
95
|
+
version: 0.1.25
|
|
96
96
|
type: :runtime
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 0.1.
|
|
102
|
+
version: 0.1.25
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
104
|
name: ostruct
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,11 +158,14 @@ files:
|
|
|
158
158
|
- ".github/workflows/dependent-tests.yml"
|
|
159
159
|
- ".github/workflows/docs.yml"
|
|
160
160
|
- ".github/workflows/downstream-performance.yml"
|
|
161
|
+
- ".github/workflows/js-pr-check.yml"
|
|
162
|
+
- ".github/workflows/js-sync.yml"
|
|
161
163
|
- ".github/workflows/opal.yml"
|
|
162
164
|
- ".github/workflows/performance.yml"
|
|
163
165
|
- ".github/workflows/rake.yml"
|
|
164
166
|
- ".github/workflows/release.yml"
|
|
165
167
|
- ".gitignore"
|
|
168
|
+
- ".gitmodules"
|
|
166
169
|
- ".irbrc"
|
|
167
170
|
- ".pryrc"
|
|
168
171
|
- ".rspec"
|
|
@@ -293,6 +296,11 @@ files:
|
|
|
293
296
|
- exe/lutaml-model
|
|
294
297
|
- flake.lock
|
|
295
298
|
- flake.nix
|
|
299
|
+
- lib/compat/opal/generate_boot.rb
|
|
300
|
+
- lib/compat/opal/js_bundle_entry.rb
|
|
301
|
+
- lib/compat/opal/lutaml_model_boot.rb
|
|
302
|
+
- lib/compat/opal/moxml_boot.rb
|
|
303
|
+
- lib/compat/opal/yaml_compat.rb
|
|
296
304
|
- lib/lutaml/hash_format.rb
|
|
297
305
|
- lib/lutaml/hash_format/adapter.rb
|
|
298
306
|
- lib/lutaml/hash_format/adapter/document.rb
|
|
@@ -322,9 +330,6 @@ files:
|
|
|
322
330
|
- lib/lutaml/jsonl/adapter/transform.rb
|
|
323
331
|
- lib/lutaml/jsonld.rb
|
|
324
332
|
- lib/lutaml/jsonld/adapter.rb
|
|
325
|
-
- lib/lutaml/jsonld/context.rb
|
|
326
|
-
- lib/lutaml/jsonld/term_definition.rb
|
|
327
|
-
- lib/lutaml/jsonld/transform.rb
|
|
328
333
|
- lib/lutaml/key_value.rb
|
|
329
334
|
- lib/lutaml/key_value/adapter.rb
|
|
330
335
|
- lib/lutaml/key_value/adapter/hash.rb
|
|
@@ -457,6 +462,7 @@ files:
|
|
|
457
462
|
- lib/lutaml/model/error/type_only_mapping_error.rb
|
|
458
463
|
- lib/lutaml/model/error/type_only_namespace_error.rb
|
|
459
464
|
- lib/lutaml/model/error/undefined_attribute_error.rb
|
|
465
|
+
- lib/lutaml/model/error/union_schema_unsupported_error.rb
|
|
460
466
|
- lib/lutaml/model/error/unknown_adapter_type_error.rb
|
|
461
467
|
- lib/lutaml/model/error/unknown_sequence_mapping_error.rb
|
|
462
468
|
- lib/lutaml/model/error/unknown_type_error.rb
|
|
@@ -495,11 +501,29 @@ files:
|
|
|
495
501
|
- lib/lutaml/model/runtime_compatibility.rb
|
|
496
502
|
- lib/lutaml/model/schema.rb
|
|
497
503
|
- lib/lutaml/model/schema/base_schema.rb
|
|
504
|
+
- lib/lutaml/model/schema/class_loader.rb
|
|
505
|
+
- lib/lutaml/model/schema/compiled_output.rb
|
|
498
506
|
- lib/lutaml/model/schema/decorators.rb
|
|
499
507
|
- lib/lutaml/model/schema/decorators/attribute.rb
|
|
500
508
|
- lib/lutaml/model/schema/decorators/choices.rb
|
|
501
509
|
- lib/lutaml/model/schema/decorators/class_definition.rb
|
|
502
510
|
- lib/lutaml/model/schema/decorators/definition_collection.rb
|
|
511
|
+
- lib/lutaml/model/schema/definitions.rb
|
|
512
|
+
- lib/lutaml/model/schema/definitions/attribute.rb
|
|
513
|
+
- lib/lutaml/model/schema/definitions/choice.rb
|
|
514
|
+
- lib/lutaml/model/schema/definitions/facet.rb
|
|
515
|
+
- lib/lutaml/model/schema/definitions/group_import.rb
|
|
516
|
+
- lib/lutaml/model/schema/definitions/member_walk.rb
|
|
517
|
+
- lib/lutaml/model/schema/definitions/model.rb
|
|
518
|
+
- lib/lutaml/model/schema/definitions/namespace.rb
|
|
519
|
+
- lib/lutaml/model/schema/definitions/restricted_type.rb
|
|
520
|
+
- lib/lutaml/model/schema/definitions/sequence.rb
|
|
521
|
+
- lib/lutaml/model/schema/definitions/simple_content.rb
|
|
522
|
+
- lib/lutaml/model/schema/definitions/transform_facet.rb
|
|
523
|
+
- lib/lutaml/model/schema/definitions/type_ref.rb
|
|
524
|
+
- lib/lutaml/model/schema/definitions/union_type.rb
|
|
525
|
+
- lib/lutaml/model/schema/definitions/xml_root.rb
|
|
526
|
+
- lib/lutaml/model/schema/file_writer.rb
|
|
503
527
|
- lib/lutaml/model/schema/generator.rb
|
|
504
528
|
- lib/lutaml/model/schema/generator/definition.rb
|
|
505
529
|
- lib/lutaml/model/schema/generator/definitions_collection.rb
|
|
@@ -510,26 +534,41 @@ files:
|
|
|
510
534
|
- lib/lutaml/model/schema/helpers/template_helper.rb
|
|
511
535
|
- lib/lutaml/model/schema/json_schema.rb
|
|
512
536
|
- lib/lutaml/model/schema/json_schema_parser.rb
|
|
537
|
+
- lib/lutaml/model/schema/module_nesting.rb
|
|
538
|
+
- lib/lutaml/model/schema/namespace_naming.rb
|
|
539
|
+
- lib/lutaml/model/schema/registry_generator.rb
|
|
513
540
|
- lib/lutaml/model/schema/renderer.rb
|
|
541
|
+
- lib/lutaml/model/schema/renderers.rb
|
|
542
|
+
- lib/lutaml/model/schema/renderers/base.rb
|
|
543
|
+
- lib/lutaml/model/schema/renderers/mappings.rb
|
|
544
|
+
- lib/lutaml/model/schema/renderers/member_decls.rb
|
|
545
|
+
- lib/lutaml/model/schema/renderers/model.rb
|
|
546
|
+
- lib/lutaml/model/schema/renderers/namespace.rb
|
|
547
|
+
- lib/lutaml/model/schema/renderers/registration.rb
|
|
548
|
+
- lib/lutaml/model/schema/renderers/required_files_calculator.rb
|
|
549
|
+
- lib/lutaml/model/schema/renderers/restricted_type.rb
|
|
550
|
+
- lib/lutaml/model/schema/renderers/union.rb
|
|
551
|
+
- lib/lutaml/model/schema/rnc_compiler.rb
|
|
552
|
+
- lib/lutaml/model/schema/rnc_compiler/source_resolver.rb
|
|
553
|
+
- lib/lutaml/model/schema/rng_compiler.rb
|
|
554
|
+
- lib/lutaml/model/schema/rng_compiler/define_classifier.rb
|
|
555
|
+
- lib/lutaml/model/schema/rng_compiler/element_visitor.rb
|
|
556
|
+
- lib/lutaml/model/schema/rng_compiler/member_collector.rb
|
|
557
|
+
- lib/lutaml/model/schema/rng_compiler/rng_helpers.rb
|
|
558
|
+
- lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb
|
|
514
559
|
- lib/lutaml/model/schema/schema_builder/nokogiri.rb
|
|
515
560
|
- lib/lutaml/model/schema/schema_builder/oga.rb
|
|
516
561
|
- lib/lutaml/model/schema/shared_methods.rb
|
|
562
|
+
- lib/lutaml/model/schema/templates.rb
|
|
517
563
|
- lib/lutaml/model/schema/templates/model.erb
|
|
518
564
|
- lib/lutaml/model/schema/xml_compiler.rb
|
|
519
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
520
|
-
- lib/lutaml/model/schema/xml_compiler/attribute_group.rb
|
|
521
|
-
- lib/lutaml/model/schema/xml_compiler/choice.rb
|
|
522
|
-
- lib/lutaml/model/schema/xml_compiler/complex_content.rb
|
|
523
|
-
- lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb
|
|
524
|
-
- lib/lutaml/model/schema/xml_compiler/complex_type.rb
|
|
525
|
-
- lib/lutaml/model/schema/xml_compiler/element.rb
|
|
526
|
-
- lib/lutaml/model/schema/xml_compiler/group.rb
|
|
565
|
+
- lib/lutaml/model/schema/xml_compiler/element_order.rb
|
|
527
566
|
- lib/lutaml/model/schema/xml_compiler/registry_generator.rb
|
|
528
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
529
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
530
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
531
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
532
|
-
- lib/lutaml/model/schema/xml_compiler/
|
|
567
|
+
- lib/lutaml/model/schema/xml_compiler/spec_builder.rb
|
|
568
|
+
- lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb
|
|
569
|
+
- lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb
|
|
570
|
+
- lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb
|
|
571
|
+
- lib/lutaml/model/schema/xml_compiler/supported_data_types.rb
|
|
533
572
|
- lib/lutaml/model/schema/yaml_schema.rb
|
|
534
573
|
- lib/lutaml/model/schema_location.rb
|
|
535
574
|
- lib/lutaml/model/sequence.rb
|
|
@@ -547,7 +586,6 @@ files:
|
|
|
547
586
|
- lib/lutaml/model/serialize/value_mapping.rb
|
|
548
587
|
- lib/lutaml/model/services.rb
|
|
549
588
|
- lib/lutaml/model/services/base.rb
|
|
550
|
-
- lib/lutaml/model/services/default_value_resolver.rb
|
|
551
589
|
- lib/lutaml/model/services/logger.rb
|
|
552
590
|
- lib/lutaml/model/services/rule_value_extractor.rb
|
|
553
591
|
- lib/lutaml/model/services/transformer.rb
|
|
@@ -589,6 +627,7 @@ files:
|
|
|
589
627
|
- lib/lutaml/model/type_resolver.rb
|
|
590
628
|
- lib/lutaml/model/type_substitution.rb
|
|
591
629
|
- lib/lutaml/model/uninitialized_class.rb
|
|
630
|
+
- lib/lutaml/model/union.rb
|
|
592
631
|
- lib/lutaml/model/utils.rb
|
|
593
632
|
- lib/lutaml/model/validation.rb
|
|
594
633
|
- lib/lutaml/model/validation/concerns/has_issues.rb
|
|
@@ -607,9 +646,11 @@ files:
|
|
|
607
646
|
- lib/lutaml/model/yaml.rb
|
|
608
647
|
- lib/lutaml/model/yamls.rb
|
|
609
648
|
- lib/lutaml/rdf.rb
|
|
649
|
+
- lib/lutaml/rdf/context.rb
|
|
610
650
|
- lib/lutaml/rdf/error.rb
|
|
611
651
|
- lib/lutaml/rdf/iri.rb
|
|
612
652
|
- lib/lutaml/rdf/language_tagged.rb
|
|
653
|
+
- lib/lutaml/rdf/linked_data_transform.rb
|
|
613
654
|
- lib/lutaml/rdf/literal.rb
|
|
614
655
|
- lib/lutaml/rdf/mapping.rb
|
|
615
656
|
- lib/lutaml/rdf/mapping_rule.rb
|
|
@@ -623,6 +664,7 @@ files:
|
|
|
623
664
|
- lib/lutaml/rdf/namespaces/rdfs_namespace.rb
|
|
624
665
|
- lib/lutaml/rdf/namespaces/skos_namespace.rb
|
|
625
666
|
- lib/lutaml/rdf/namespaces/xsd_namespace.rb
|
|
667
|
+
- lib/lutaml/rdf/term_definition.rb
|
|
626
668
|
- lib/lutaml/rdf/transform.rb
|
|
627
669
|
- lib/lutaml/toml.rb
|
|
628
670
|
- lib/lutaml/toml/adapter.rb
|
|
@@ -697,6 +739,7 @@ files:
|
|
|
697
739
|
- lib/lutaml/xml/error/invalid_namespace_error.rb
|
|
698
740
|
- lib/lutaml/xml/error/invalid_xsd_type_error.rb
|
|
699
741
|
- lib/lutaml/xml/error/namespace_mismatch_error.rb
|
|
742
|
+
- lib/lutaml/xml/error/schema_validation_error.rb
|
|
700
743
|
- lib/lutaml/xml/error/xml_configuration_error.rb
|
|
701
744
|
- lib/lutaml/xml/error/xml_error.rb
|
|
702
745
|
- lib/lutaml/xml/format_chooser.rb
|
|
@@ -843,6 +886,7 @@ files:
|
|
|
843
886
|
- lib/lutaml/xml/xml_element.rb
|
|
844
887
|
- lib/lutaml/xml/xml_namespace.rb
|
|
845
888
|
- lib/lutaml/xml/xml_orderable.rb
|
|
889
|
+
- lib/lutaml/xml/xsd_validator.rb
|
|
846
890
|
- lib/lutaml/yaml.rb
|
|
847
891
|
- lib/lutaml/yaml/adapter.rb
|
|
848
892
|
- lib/lutaml/yaml/adapter/document.rb
|
|
@@ -853,6 +897,8 @@ files:
|
|
|
853
897
|
- lib/lutaml/yaml/schema.rb
|
|
854
898
|
- lib/lutaml/yaml/schema/yaml_schema.rb
|
|
855
899
|
- lib/lutaml/yaml/type/serializers.rb
|
|
900
|
+
- lib/lutaml/yamlld.rb
|
|
901
|
+
- lib/lutaml/yamlld/adapter.rb
|
|
856
902
|
- lib/lutaml/yamls.rb
|
|
857
903
|
- lib/lutaml/yamls/adapter.rb
|
|
858
904
|
- lib/lutaml/yamls/adapter/document.rb
|
|
@@ -895,6 +941,23 @@ files:
|
|
|
895
941
|
- spec/fixtures/xml/latin_encoding.xml
|
|
896
942
|
- spec/fixtures/xml/math_document_schema.xsd
|
|
897
943
|
- spec/fixtures/xml/product_catalog.xsd
|
|
944
|
+
- spec/fixtures/xml/schema/rnc/address_book.rnc
|
|
945
|
+
- spec/fixtures/xml/schema/rnc/book_features.rnc
|
|
946
|
+
- spec/fixtures/xml/schema/rnc/includes/book.rnc
|
|
947
|
+
- spec/fixtures/xml/schema/rnc/includes/circular_a.rnc
|
|
948
|
+
- spec/fixtures/xml/schema/rnc/includes/circular_b.rnc
|
|
949
|
+
- spec/fixtures/xml/schema/rnc/includes/library.rnc
|
|
950
|
+
- spec/fixtures/xml/schema/rng/address_book.rng
|
|
951
|
+
- spec/fixtures/xml/schema/rng/book.rng
|
|
952
|
+
- spec/fixtures/xml/schema/rng/fixed_value.rng
|
|
953
|
+
- spec/fixtures/xml/schema/rng/fragment_in_choice.rng
|
|
954
|
+
- spec/fixtures/xml/schema/rng/full_name.rng
|
|
955
|
+
- spec/fixtures/xml/schema/rng/integer_range.rng
|
|
956
|
+
- spec/fixtures/xml/schema/rng/list_type.rng
|
|
957
|
+
- spec/fixtures/xml/schema/rng/namespaced.rng
|
|
958
|
+
- spec/fixtures/xml/schema/rng/paragraph.rng
|
|
959
|
+
- spec/fixtures/xml/schema/rng/person.rng
|
|
960
|
+
- spec/fixtures/xml/schema/rng/union.rng
|
|
898
961
|
- spec/fixtures/xml/schema/xsd/build_test_package.rb
|
|
899
962
|
- spec/fixtures/xml/schema/xsd/citygml/2.0/cityGMLBase.xsd
|
|
900
963
|
- spec/fixtures/xml/schema/xsd/citygml/appearance/2.0/appearance.xsd
|
|
@@ -1555,24 +1618,29 @@ files:
|
|
|
1555
1618
|
- spec/fixtures/xml/test_schema.xsd
|
|
1556
1619
|
- spec/fixtures/xml/user.xsd
|
|
1557
1620
|
- spec/fixtures/xml/valid_math_document.xml
|
|
1621
|
+
- spec/fixtures/xml/validate_xml_with_address.xsd
|
|
1622
|
+
- spec/fixtures/xml/validate_xml_with_contact.xsd
|
|
1623
|
+
- spec/fixtures/xml/validate_xml_with_person.xsd
|
|
1624
|
+
- spec/fixtures/xml/validate_xml_with_person_strict.xsd
|
|
1625
|
+
- spec/fixtures/xml/validate_xml_with_product.xsd
|
|
1558
1626
|
- spec/fixtures/yamls_range_concept.rb
|
|
1559
1627
|
- spec/lutaml/integration/edge_cases_spec.rb
|
|
1560
1628
|
- spec/lutaml/integration/multi_format_spec.rb
|
|
1561
1629
|
- spec/lutaml/integration/round_trip_spec.rb
|
|
1562
1630
|
- spec/lutaml/jsonld/adapter_spec.rb
|
|
1563
|
-
- spec/lutaml/jsonld/context_spec.rb
|
|
1564
|
-
- spec/lutaml/jsonld/term_definition_spec.rb
|
|
1565
|
-
- spec/lutaml/jsonld/transform_spec.rb
|
|
1566
1631
|
- spec/lutaml/key_value/transformation/collection_serializer_spec.rb
|
|
1567
1632
|
- spec/lutaml/key_value/transformation/rule_compiler_spec.rb
|
|
1568
1633
|
- spec/lutaml/key_value/transformation/value_serializer_spec.rb
|
|
1569
1634
|
- spec/lutaml/key_value/transformation_spec.rb
|
|
1635
|
+
- spec/lutaml/model/attribute_apply_value_map_spec.rb
|
|
1570
1636
|
- spec/lutaml/model/attribute_collection_spec.rb
|
|
1571
1637
|
- spec/lutaml/model/attribute_default_cache_spec.rb
|
|
1572
1638
|
- spec/lutaml/model/attribute_form_default_spec.rb
|
|
1573
1639
|
- spec/lutaml/model/attribute_spec.rb
|
|
1640
|
+
- spec/lutaml/model/boot_manifest_spec.rb
|
|
1574
1641
|
- spec/lutaml/model/cached_type_resolver_spec.rb
|
|
1575
1642
|
- spec/lutaml/model/cdata_spec.rb
|
|
1643
|
+
- spec/lutaml/model/choice_restrict_spec.rb
|
|
1576
1644
|
- spec/lutaml/model/choice_spec.rb
|
|
1577
1645
|
- spec/lutaml/model/cli_spec.rb
|
|
1578
1646
|
- spec/lutaml/model/collection_index_spec.rb
|
|
@@ -1642,18 +1710,22 @@ files:
|
|
|
1642
1710
|
- spec/lutaml/model/schema/json_schema_to_models_spec.rb
|
|
1643
1711
|
- spec/lutaml/model/schema/relaxng_schema_spec.rb
|
|
1644
1712
|
- spec/lutaml/model/schema/renderer_spec.rb
|
|
1713
|
+
- spec/lutaml/model/schema/renderers/model_spec.rb
|
|
1714
|
+
- spec/lutaml/model/schema/renderers/namespace_spec.rb
|
|
1715
|
+
- spec/lutaml/model/schema/renderers/restricted_type_spec.rb
|
|
1716
|
+
- spec/lutaml/model/schema/renderers/union_spec.rb
|
|
1645
1717
|
- spec/lutaml/model/schema/xsd_schema_spec.rb
|
|
1646
1718
|
- spec/lutaml/model/schema/yaml_schema_spec.rb
|
|
1647
1719
|
- spec/lutaml/model/sequence_spec.rb
|
|
1648
1720
|
- spec/lutaml/model/serializable_spec.rb
|
|
1649
1721
|
- spec/lutaml/model/serializable_validation_spec.rb
|
|
1650
1722
|
- spec/lutaml/model/serialize_perf_guard_spec.rb
|
|
1651
|
-
- spec/lutaml/model/services/default_value_resolver_spec.rb
|
|
1652
1723
|
- spec/lutaml/model/services/transformer_spec.rb
|
|
1653
1724
|
- spec/lutaml/model/simple_model_spec.rb
|
|
1654
1725
|
- spec/lutaml/model/store_spec.rb
|
|
1655
1726
|
- spec/lutaml/model/toml_adapter_spec.rb
|
|
1656
1727
|
- spec/lutaml/model/toml_spec.rb
|
|
1728
|
+
- spec/lutaml/model/transform_apply_value_map_spec.rb
|
|
1657
1729
|
- spec/lutaml/model/transform_cache_spec.rb
|
|
1658
1730
|
- spec/lutaml/model/transform_dynamic_attributes_spec.rb
|
|
1659
1731
|
- spec/lutaml/model/transformation_builder_spec.rb
|
|
@@ -1685,6 +1757,8 @@ files:
|
|
|
1685
1757
|
- spec/lutaml/model/type_substitution_spec.rb
|
|
1686
1758
|
- spec/lutaml/model/uninitialized_class_deep_dup_spec.rb
|
|
1687
1759
|
- spec/lutaml/model/uninitialized_class_spec.rb
|
|
1760
|
+
- spec/lutaml/model/union_attribute_spec.rb
|
|
1761
|
+
- spec/lutaml/model/union_spec.rb
|
|
1688
1762
|
- spec/lutaml/model/utils_spec.rb
|
|
1689
1763
|
- spec/lutaml/model/validation/concerns/has_issues_spec.rb
|
|
1690
1764
|
- spec/lutaml/model/validation/context_spec.rb
|
|
@@ -1714,8 +1788,10 @@ files:
|
|
|
1714
1788
|
- spec/lutaml/model/yamls_sequence_spec.rb
|
|
1715
1789
|
- spec/lutaml/model/yamls_spec.rb
|
|
1716
1790
|
- spec/lutaml/model_spec.rb
|
|
1791
|
+
- spec/lutaml/rdf/context_spec.rb
|
|
1717
1792
|
- spec/lutaml/rdf/graph_serialization_spec.rb
|
|
1718
1793
|
- spec/lutaml/rdf/iri_spec.rb
|
|
1794
|
+
- spec/lutaml/rdf/linked_data_transform_spec.rb
|
|
1719
1795
|
- spec/lutaml/rdf/literal_spec.rb
|
|
1720
1796
|
- spec/lutaml/rdf/mapping_rule_spec.rb
|
|
1721
1797
|
- spec/lutaml/rdf/mapping_spec.rb
|
|
@@ -1723,6 +1799,7 @@ files:
|
|
|
1723
1799
|
- spec/lutaml/rdf/namespace_set_spec.rb
|
|
1724
1800
|
- spec/lutaml/rdf/namespace_spec.rb
|
|
1725
1801
|
- spec/lutaml/rdf/rdf_transform_spec.rb
|
|
1802
|
+
- spec/lutaml/rdf/term_definition_spec.rb
|
|
1726
1803
|
- spec/lutaml/turtle/adapter_spec.rb
|
|
1727
1804
|
- spec/lutaml/turtle/mapping_spec.rb
|
|
1728
1805
|
- spec/lutaml/turtle/transform_spec.rb
|
|
@@ -1798,19 +1875,9 @@ files:
|
|
|
1798
1875
|
- spec/lutaml/xml/reusable_mapping_spec.rb
|
|
1799
1876
|
- spec/lutaml/xml/reused_elements_namespace_spec.rb
|
|
1800
1877
|
- spec/lutaml/xml/root_mappings/nested_child_mappings_spec.rb
|
|
1801
|
-
- spec/lutaml/xml/schema/compiler/attribute_group_spec.rb
|
|
1802
|
-
- spec/lutaml/xml/schema/compiler/attribute_spec.rb
|
|
1803
|
-
- spec/lutaml/xml/schema/compiler/choice_spec.rb
|
|
1804
|
-
- spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb
|
|
1805
|
-
- spec/lutaml/xml/schema/compiler/complex_content_spec.rb
|
|
1806
|
-
- spec/lutaml/xml/schema/compiler/complex_type_spec.rb
|
|
1807
|
-
- spec/lutaml/xml/schema/compiler/element_spec.rb
|
|
1808
|
-
- spec/lutaml/xml/schema/compiler/group_spec.rb
|
|
1809
|
-
- spec/lutaml/xml/schema/compiler/restriction_spec.rb
|
|
1810
|
-
- spec/lutaml/xml/schema/compiler/sequence_spec.rb
|
|
1811
|
-
- spec/lutaml/xml/schema/compiler/simple_content_spec.rb
|
|
1812
|
-
- spec/lutaml/xml/schema/compiler/simple_type_spec.rb
|
|
1813
1878
|
- spec/lutaml/xml/schema/compiler_spec.rb
|
|
1879
|
+
- spec/lutaml/xml/schema/rnc_compiler_spec.rb
|
|
1880
|
+
- spec/lutaml/xml/schema/rng_compiler_spec.rb
|
|
1814
1881
|
- spec/lutaml/xml/schema/xsd/errors/error_context_spec.rb
|
|
1815
1882
|
- spec/lutaml/xml/schema/xsd/errors/suggestion_spec.rb
|
|
1816
1883
|
- spec/lutaml/xml/schema/xsd/file_validation_result_spec.rb
|
|
@@ -1840,6 +1907,8 @@ files:
|
|
|
1840
1907
|
- spec/lutaml/xml/type_namespace_prefix_spec.rb
|
|
1841
1908
|
- spec/lutaml/xml/type_namespace_resolver_spec.rb
|
|
1842
1909
|
- spec/lutaml/xml/type_namespace_roundtrip_spec.rb
|
|
1910
|
+
- spec/lutaml/xml/validate_xml_with_constructs_spec.rb
|
|
1911
|
+
- spec/lutaml/xml/validate_xml_with_spec.rb
|
|
1843
1912
|
- spec/lutaml/xml/w3c_types_spec.rb
|
|
1844
1913
|
- spec/lutaml/xml/xml_adapter_spec.rb
|
|
1845
1914
|
- spec/lutaml/xml/xml_declaration_spec.rb
|
|
@@ -1849,6 +1918,8 @@ files:
|
|
|
1849
1918
|
- spec/lutaml/xml/xml_space_spec.rb
|
|
1850
1919
|
- spec/lutaml/xml/xml_space_type_spec.rb
|
|
1851
1920
|
- spec/lutaml/xml/xml_spec.rb
|
|
1921
|
+
- spec/lutaml/yamlld/adapter_spec.rb
|
|
1922
|
+
- spec/lutaml/yamlld/registration_spec.rb
|
|
1852
1923
|
- spec/parent_root_spec.rb
|
|
1853
1924
|
- spec/person_spec.rb
|
|
1854
1925
|
- spec/sample_model_spec.rb
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Model
|
|
5
|
-
module Schema
|
|
6
|
-
module XmlCompiler
|
|
7
|
-
class Attribute
|
|
8
|
-
attr_accessor :id,
|
|
9
|
-
:ref,
|
|
10
|
-
:name,
|
|
11
|
-
:type,
|
|
12
|
-
:default
|
|
13
|
-
|
|
14
|
-
TEMPLATE = ERB.new(<<~TEMPLATE, trim_mode: "-")
|
|
15
|
-
<%= indent %>attribute :<%= resolved_name %>, <%= type_reference %>
|
|
16
|
-
TEMPLATE
|
|
17
|
-
|
|
18
|
-
XML_MAPPING_TEMPLATE = ERB.new(<<~XML_MAPPING_TEMPLATE, trim_mode: "-")
|
|
19
|
-
<%= indent %>map_attribute :<%= resolved_name(change_case: false) %>, to: :<%= resolved_name %>
|
|
20
|
-
XML_MAPPING_TEMPLATE
|
|
21
|
-
|
|
22
|
-
def initialize(name: nil, ref: nil)
|
|
23
|
-
@name = name
|
|
24
|
-
@ref = ref
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def to_attributes(indent)
|
|
28
|
-
return if skippable?
|
|
29
|
-
|
|
30
|
-
TEMPLATE.result(binding)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def to_xml_mapping(indent)
|
|
34
|
-
return if skippable?
|
|
35
|
-
|
|
36
|
-
XML_MAPPING_TEMPLATE.result(binding)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def required_files
|
|
40
|
-
return if skippable?
|
|
41
|
-
|
|
42
|
-
files = []
|
|
43
|
-
|
|
44
|
-
raw_type = resolved_type(change_case: false)
|
|
45
|
-
|
|
46
|
-
# Add W3C require for xml: attributes
|
|
47
|
-
if w3c_type?(raw_type)
|
|
48
|
-
files << "require \"lutaml/xml/w3c\""
|
|
49
|
-
elsif raw_type == "decimal"
|
|
50
|
-
files << "require \"bigdecimal\""
|
|
51
|
-
elsif !SimpleType.skippable?(raw_type)
|
|
52
|
-
files << "require_relative \"#{Utils.snake_case(raw_type)}\""
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
files.compact # Return all files as array
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
private
|
|
59
|
-
|
|
60
|
-
def resolved_name(change_case: true)
|
|
61
|
-
@current_name ||= name || referenced_instance&.name
|
|
62
|
-
change_case ? Utils.snake_case(@current_name) : @current_name
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def resolved_type(change_case: true)
|
|
66
|
-
@current_type ||= type || referenced_instance&.type
|
|
67
|
-
|
|
68
|
-
# For W3C types, return the full class name
|
|
69
|
-
return @current_type if w3c_type?(@current_type)
|
|
70
|
-
|
|
71
|
-
klass_name = last_of_split(@current_type)
|
|
72
|
-
change_case ? Utils.snake_case(klass_name) : klass_name
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def type_reference
|
|
76
|
-
raw_type = resolved_type(change_case: false)
|
|
77
|
-
|
|
78
|
-
# W3C types are full class names, use directly
|
|
79
|
-
if w3c_type?(raw_type)
|
|
80
|
-
"::#{raw_type}"
|
|
81
|
-
else
|
|
82
|
-
# Regular types are symbols
|
|
83
|
-
":#{resolved_type}"
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def w3c_type?(type_name)
|
|
88
|
-
type_name&.to_s&.start_with?("Lutaml::Xml::W3c::")
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def referenced_instance
|
|
92
|
-
@referenced_instance ||= XmlCompiler.attributes[last_of_split]
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def last_of_split(field = ref)
|
|
96
|
-
field&.split(":")&.last
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def skippable?
|
|
100
|
-
resolved_name == "schema_location"
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Model
|
|
5
|
-
module Schema
|
|
6
|
-
module XmlCompiler
|
|
7
|
-
class AttributeGroup
|
|
8
|
-
attr_accessor :name, :ref, :instances
|
|
9
|
-
|
|
10
|
-
def initialize(name: nil, ref: nil)
|
|
11
|
-
@name = name
|
|
12
|
-
@ref = ref
|
|
13
|
-
@instances = []
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def <<(instance)
|
|
17
|
-
return if instance.nil?
|
|
18
|
-
|
|
19
|
-
@instances << instance
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def to_attributes(indent)
|
|
23
|
-
resolved_instances.map { |instance| instance.to_attributes(indent) }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def to_xml_mapping(indent)
|
|
27
|
-
resolved_instances.map do |instance|
|
|
28
|
-
instance.to_xml_mapping(indent)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def required_files
|
|
33
|
-
resolved_instances.map(&:required_files)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def resolved_instances
|
|
39
|
-
return @instances unless Utils.present?(@ref)
|
|
40
|
-
|
|
41
|
-
XmlCompiler.attribute_groups[@ref]&.instances
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Model
|
|
5
|
-
module Schema
|
|
6
|
-
module XmlCompiler
|
|
7
|
-
class Choice
|
|
8
|
-
attr_accessor :instances, :min_occurs, :max_occurs
|
|
9
|
-
|
|
10
|
-
INDENT = " "
|
|
11
|
-
|
|
12
|
-
TEMPLATE = ERB.new(<<~TEMPLATE, trim_mode: "-")
|
|
13
|
-
<%= indent %>choice<%= block_options %> do
|
|
14
|
-
<%= instances.map { |instance| instance.to_attributes(indent + INDENT) }.join -%>
|
|
15
|
-
<%= indent %>end
|
|
16
|
-
TEMPLATE
|
|
17
|
-
|
|
18
|
-
def initialize
|
|
19
|
-
@instances = []
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def <<(instance)
|
|
23
|
-
return if instance.nil?
|
|
24
|
-
|
|
25
|
-
@instances << instance
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def to_attributes(indent = INDENT)
|
|
29
|
-
TEMPLATE.result(binding)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def to_xml_mapping(indent = INDENT)
|
|
33
|
-
instances.filter_map do |instance|
|
|
34
|
-
instance.to_xml_mapping(indent)
|
|
35
|
-
end.join
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def required_files
|
|
39
|
-
@instances.flat_map(&:required_files).compact
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
def min_option
|
|
45
|
-
"min: #{min_occurs.nil? ? 1 : min_occurs.to_i}"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def max_option
|
|
49
|
-
value = case max_occurs
|
|
50
|
-
when "unbounded"
|
|
51
|
-
"Float::INFINITY"
|
|
52
|
-
when NilClass
|
|
53
|
-
1
|
|
54
|
-
else
|
|
55
|
-
max_occurs.to_i
|
|
56
|
-
end
|
|
57
|
-
", max: #{value}"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def block_options
|
|
61
|
-
["(", min_option, max_option, ")"].compact.join
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
module Lutaml
|
|
2
|
-
module Model
|
|
3
|
-
module Schema
|
|
4
|
-
module XmlCompiler
|
|
5
|
-
class ComplexContent
|
|
6
|
-
attr_accessor :restriction
|
|
7
|
-
|
|
8
|
-
def initialize(restriction = nil)
|
|
9
|
-
@restriction = restriction
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def to_attributes(indent)
|
|
13
|
-
restriction&.to_attributes(indent)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def to_xml_mapping(indent)
|
|
17
|
-
restriction&.to_xml_mapping(indent)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def required_files
|
|
21
|
-
restriction&.required_files
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
module Lutaml
|
|
2
|
-
module Model
|
|
3
|
-
module Schema
|
|
4
|
-
module XmlCompiler
|
|
5
|
-
class ComplexContentRestriction
|
|
6
|
-
attr_accessor :base, :instances
|
|
7
|
-
|
|
8
|
-
def initialize(base: nil, instances: [])
|
|
9
|
-
@base = base
|
|
10
|
-
@instances = instances
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def <<(instance)
|
|
14
|
-
return if instance.nil?
|
|
15
|
-
|
|
16
|
-
@instances << instance
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def to_attributes(indent)
|
|
20
|
-
instances.map { |instance| instance.to_attributes(indent) }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def to_xml_mapping(indent)
|
|
24
|
-
instances.map { |instance| instance.to_xml_mapping(indent) }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def required_files
|
|
28
|
-
instances.map(&:required_files)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|