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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1534c767ed74c87ca337f399ec76413ce25851dcf0d744c0d7074803ef228850
4
- data.tar.gz: 9656e981503e23f9c290e017f10a035b6522274e0aa0c81c26bb760f00402803
3
+ metadata.gz: e2649418d3ea00927ab8b73628856fa55ed114ca61489f6834b6d6daca9d416b
4
+ data.tar.gz: 16452655b05b900cb227ea65d63b555d593cd8e31ffceeb8af78872e4ff7a94b
5
5
  SHA512:
6
- metadata.gz: c9809bb698c5914d29591513a1d809680e8e1f65a2536c340825f85a2f87265fed941dd446b38db6e81577aca4cabdfc4e39d144d4c9c3fb87f5435788f2e110
7
- data.tar.gz: 55096747f4c344cb2b81cfd7226c7feebb1f33df1fb9c8d1c0cdd2dc672278079e349056930014b405bef80bc3846838105ca9a8d6be288d326176aa5bee1f6f
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-22 11:16:09 UTC using RuboCop version 1.86.1.
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: 729
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: 1
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
- * **Nokogiri**: Use for XML parsing/validation
460
+ * **Moxml**: Unified XML adapter layer
461
461
  * **REXML**: Use for lightweight XML processing
462
462
  * **Ox**: Use for fast XML parsing
463
463
 
@@ -603,12 +603,11 @@ Validate schema content after fetching:
603
603
  ====
604
604
  [source,ruby]
605
605
  ----
606
- require 'nokogiri'
606
+ require 'moxml'
607
607
 
608
608
  def validate_schema_content(content)
609
- doc = Nokogiri::XML(content) do |config|
610
- config.strict.nonet # Disable network access during XML parsing
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.to_s.match?(/<!ENTITY|<!DOCTYPE/)
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 Nokogiri::XML::SyntaxError => e
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 Nokogiri validation
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 'nokogiri'
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
- # Create Nokogiri XSD validator
492
- xsd = Nokogiri::XML::Schema(xsd_content)
491
+ # Parse XML document using Moxml
492
+ ctx = Moxml::Context.new
493
+ doc = ctx.parse(xml_content)
493
494
 
494
- # Parse XML document
495
- doc = Nokogiri::XML(xml_content)
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 'nokogiri'
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 'nokogiri'
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 'nokogiri'
705
+ require 'moxml'
706
706
  require 'yaml'
707
707
 
708
708
  def extract_imports_and_includes(xsd_file)
709
- doc = Nokogiri::XML(File.read(xsd_file))
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(&:value).uniq
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 "nokogiri"
3
+ require "moxml"
4
4
  require "yaml"
5
5
 
6
6
  # Parse both XSD files
7
- urban_function_doc = Nokogiri::XML(File.read("schemas/urbanFunction.xsd"))
8
- urban_object_doc = Nokogiri::XML(File.read("schemas/urbanObject.xsd"))
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 = {