lutaml-xsd 1.0.7 → 1.0.9
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/release.yml +1 -0
- data/.rubocop_todo.yml +37 -3
- data/docs/FAQ.adoc +1 -1
- data/docs/URL_FETCHING.adoc +5 -6
- data/docs/advanced/INTEGRATION_PATTERNS.adoc +10 -11
- data/docs/advanced/SCHEMA_MAPPING_PATTERNS.adoc +4 -3
- data/examples/02-urban-function/scripts/map_uro_types.rb +4 -3
- data/frontend/dist/app.iife.js +39 -0
- data/frontend/dist/style.css +1 -0
- data/lib/lutaml/xsd/commands/package_command.rb +4 -1
- data/lib/lutaml/xsd/definition_extractor.rb +6 -7
- data/lib/lutaml/xsd/package_builder.rb +39 -0
- data/lib/lutaml/xsd/spa/schema_serializer.rb +43 -25
- data/lib/lutaml/xsd/spa/utils/extract_enumeration.rb +4 -1
- data/lib/lutaml/xsd/spa/xml_instance_generator.rb +1 -1
- data/lib/lutaml/xsd/validation/xml_navigator.rb +3 -3
- data/lib/lutaml/xsd/version.rb +1 -1
- data/lib/lutaml/xsd.rb +0 -3
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2649418d3ea00927ab8b73628856fa55ed114ca61489f6834b6d6daca9d416b
|
|
4
|
+
data.tar.gz: 16452655b05b900cb227ea65d63b555d593cd8e31ffceeb8af78872e4ff7a94b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae2220574c0cd979eb05eed45efe8770ba855cf641d6b30d68f899f370a831598392e44e7ab81e6a85d3c5e4c975c24057a2c11e783757d4831e23a8aae6435a
|
|
7
|
+
data.tar.gz: 4773bd5fc5b44b98d4ca7b2cffc60a233abd60c221829c77611d002e03f07c4de9142c1731ffa58827e22cac0f1a606548d109e08a2466073bece6093fe56ce8
|
|
@@ -23,6 +23,7 @@ jobs:
|
|
|
23
23
|
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
|
24
24
|
with:
|
|
25
25
|
next_version: ${{ github.event.inputs.next_version }}
|
|
26
|
+
post_install: 'cd frontend && npm install && npm run build'
|
|
26
27
|
secrets:
|
|
27
28
|
rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
|
28
29
|
pat_token: ${{ secrets.GITHUB_TOKEN }}
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-04-
|
|
3
|
+
# on 2026-04-25 09:44:01 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -11,6 +11,29 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'lutaml-xsd.gemspec'
|
|
13
13
|
|
|
14
|
+
# Offense count: 2
|
|
15
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
16
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
17
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
18
|
+
Layout/ArrayAlignment:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
21
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
22
|
+
|
|
23
|
+
# Offense count: 4
|
|
24
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
25
|
+
# Configuration parameters: IndentationWidth.
|
|
26
|
+
Layout/AssignmentIndentation:
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
29
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
30
|
+
|
|
31
|
+
# Offense count: 7
|
|
32
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
33
|
+
Layout/ClosingParenthesisIndentation:
|
|
34
|
+
Exclude:
|
|
35
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
36
|
+
|
|
14
37
|
# Offense count: 1
|
|
15
38
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
39
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
@@ -45,7 +68,7 @@ Layout/IndentationWidth:
|
|
|
45
68
|
Exclude:
|
|
46
69
|
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
47
70
|
|
|
48
|
-
# Offense count:
|
|
71
|
+
# Offense count: 730
|
|
49
72
|
# This cop supports safe autocorrection (--autocorrect).
|
|
50
73
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
51
74
|
# URISchemes: http, https
|
|
@@ -60,11 +83,14 @@ Layout/MultilineMethodCallBraceLayout:
|
|
|
60
83
|
Exclude:
|
|
61
84
|
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
62
85
|
|
|
63
|
-
# Offense count:
|
|
86
|
+
# Offense count: 11
|
|
64
87
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
88
|
# Configuration parameters: AllowInHeredoc.
|
|
66
89
|
Layout/TrailingWhitespace:
|
|
67
90
|
Exclude:
|
|
91
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
92
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
93
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
68
94
|
- 'lib/lutaml/xsd/spa/xml_instance_generator.rb'
|
|
69
95
|
|
|
70
96
|
# Offense count: 11
|
|
@@ -222,6 +248,14 @@ Style/IdenticalConditionalBranches:
|
|
|
222
248
|
Exclude:
|
|
223
249
|
- 'lib/lutaml/xsd/package_tree_formatter.rb'
|
|
224
250
|
|
|
251
|
+
# Offense count: 3
|
|
252
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
253
|
+
Style/MultilineIfModifier:
|
|
254
|
+
Exclude:
|
|
255
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
256
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
257
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
258
|
+
|
|
225
259
|
# Offense count: 1
|
|
226
260
|
Style/OpenStructUse:
|
|
227
261
|
Exclude:
|
data/docs/FAQ.adoc
CHANGED
|
@@ -457,7 +457,7 @@ Note: `marshal` format packages may not be compatible across different Ruby majo
|
|
|
457
457
|
|
|
458
458
|
Yes! Lutaml::XSD is complementary to other XML tools:
|
|
459
459
|
|
|
460
|
-
* **
|
|
460
|
+
* **Moxml**: Unified XML adapter layer
|
|
461
461
|
* **REXML**: Use for lightweight XML processing
|
|
462
462
|
* **Ox**: Use for fast XML parsing
|
|
463
463
|
|
data/docs/URL_FETCHING.adoc
CHANGED
|
@@ -603,12 +603,11 @@ Validate schema content after fetching:
|
|
|
603
603
|
====
|
|
604
604
|
[source,ruby]
|
|
605
605
|
----
|
|
606
|
-
require '
|
|
606
|
+
require 'moxml'
|
|
607
607
|
|
|
608
608
|
def validate_schema_content(content)
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
end
|
|
609
|
+
ctx = Moxml::Context.new
|
|
610
|
+
doc = ctx.parse(content)
|
|
612
611
|
|
|
613
612
|
# Validate it's actually an XSD schema
|
|
614
613
|
unless doc.root&.name == 'schema' &&
|
|
@@ -617,12 +616,12 @@ def validate_schema_content(content)
|
|
|
617
616
|
end
|
|
618
617
|
|
|
619
618
|
# Check for suspicious patterns
|
|
620
|
-
if doc.
|
|
619
|
+
if doc.to_xml.match?(/<!ENTITY|<!DOCTYPE/)
|
|
621
620
|
raise SecurityError, "Schema contains potentially dangerous XML entities"
|
|
622
621
|
end
|
|
623
622
|
|
|
624
623
|
content
|
|
625
|
-
rescue
|
|
624
|
+
rescue StandardError => e
|
|
626
625
|
raise SecurityError, "Schema failed XML validation: #{e.message}"
|
|
627
626
|
end
|
|
628
627
|
----
|
|
@@ -466,13 +466,13 @@ generator.generate('docs/api')
|
|
|
466
466
|
|
|
467
467
|
=== Integrating with XML validators
|
|
468
468
|
|
|
469
|
-
.Using Lutaml::XSD with
|
|
469
|
+
.Using Lutaml::XSD with XML validation
|
|
470
470
|
[example]
|
|
471
471
|
====
|
|
472
472
|
[source,ruby]
|
|
473
473
|
----
|
|
474
474
|
require 'lutaml/xsd'
|
|
475
|
-
require '
|
|
475
|
+
require 'moxml'
|
|
476
476
|
|
|
477
477
|
class SchemaValidator
|
|
478
478
|
def initialize(lxr_package_path)
|
|
@@ -488,14 +488,13 @@ class SchemaValidator
|
|
|
488
488
|
xsd_file = result.schema_file
|
|
489
489
|
xsd_content = load_xsd_content(xsd_file)
|
|
490
490
|
|
|
491
|
-
#
|
|
492
|
-
|
|
491
|
+
# Parse XML document using Moxml
|
|
492
|
+
ctx = Moxml::Context.new
|
|
493
|
+
doc = ctx.parse(xml_content)
|
|
493
494
|
|
|
494
|
-
#
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
# Validate
|
|
498
|
-
errors = xsd.validate(doc)
|
|
495
|
+
# Validate against XSD schema
|
|
496
|
+
# (Use a dedicated XSD validation library for full schema validation)
|
|
497
|
+
errors = []
|
|
499
498
|
|
|
500
499
|
{
|
|
501
500
|
valid: errors.empty?,
|
|
@@ -538,7 +537,7 @@ end
|
|
|
538
537
|
[source,ruby]
|
|
539
538
|
----
|
|
540
539
|
require 'lutaml/xsd'
|
|
541
|
-
require '
|
|
540
|
+
require 'moxml'
|
|
542
541
|
|
|
543
542
|
class ValidationPipeline
|
|
544
543
|
def initialize(schemas_package)
|
|
@@ -1031,7 +1030,7 @@ manager.deploy(:production, '/var/app/schemas.lxr')
|
|
|
1031
1030
|
----
|
|
1032
1031
|
require 'lutaml/xsd'
|
|
1033
1032
|
require 'liquid'
|
|
1034
|
-
require '
|
|
1033
|
+
require 'moxml'
|
|
1035
1034
|
|
|
1036
1035
|
class SchemaWorkflow
|
|
1037
1036
|
def initialize(config_file)
|
|
@@ -702,18 +702,19 @@ end
|
|
|
702
702
|
[source,ruby]
|
|
703
703
|
----
|
|
704
704
|
require 'lutaml/xsd'
|
|
705
|
-
require '
|
|
705
|
+
require 'moxml'
|
|
706
706
|
require 'yaml'
|
|
707
707
|
|
|
708
708
|
def extract_imports_and_includes(xsd_file)
|
|
709
|
-
|
|
709
|
+
ctx = Moxml::Context.new
|
|
710
|
+
doc = ctx.parse(File.read(xsd_file))
|
|
710
711
|
|
|
711
712
|
imports = doc.xpath('//xs:import/@schemaLocation',
|
|
712
713
|
'xs' => 'http://www.w3.org/2001/XMLSchema')
|
|
713
714
|
includes = doc.xpath('//xs:include/@schemaLocation',
|
|
714
715
|
'xs' => 'http://www.w3.org/2001/XMLSchema')
|
|
715
716
|
|
|
716
|
-
(imports + includes).map(
|
|
717
|
+
(imports + includes).map { |attr| attr.is_a?(Moxml::Attribute) ? attr.value : attr.text }.uniq
|
|
717
718
|
end
|
|
718
719
|
|
|
719
720
|
def suggest_mapping(schema_location)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "moxml"
|
|
4
4
|
require "yaml"
|
|
5
5
|
|
|
6
6
|
# Parse both XSD files
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
ctx = Moxml::Context.new
|
|
8
|
+
urban_function_doc = ctx.parse(File.read("schemas/urbanFunction.xsd"))
|
|
9
|
+
urban_object_doc = ctx.parse(File.read("schemas/urbanObject.xsd"))
|
|
9
10
|
|
|
10
11
|
# Define namespaces
|
|
11
12
|
namespaces = {
|