lutaml-xsd 1.2.95 → 1.2.96

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: a752804ef8cfcbbe98845ffcfcbd8830d2c37020d392d34524795f645351cef9
4
- data.tar.gz: 467cd19ffcc587cbdc4007e614b02f2f299a26917c684e997138fa5116686a7b
3
+ metadata.gz: b47e6206406d15078ca3896061eb50d415a599a3a6fe62df9a59d191c31f410a
4
+ data.tar.gz: d60605597341f39c26d19ac3bb8d88e6a0ff06d4f7ad03c9504d6903fc6a6ca9
5
5
  SHA512:
6
- metadata.gz: 904b2740eaa42225aa419c6a27586cc115fbcba3efaa4e4fe987b979f7139bd00e5e96007f094f65b5631a8383bdd12d0e50eaef82482733662d2dcda8658507
7
- data.tar.gz: 545c68eb6ce9cda1d4b834d3bf608974d3da82e774fee7465918ba39d5c2d7183892c0a314c3314d15f68e8f20a6af27e264fb752f5023008db7a5cfa84be512
6
+ metadata.gz: 231da0fb555d2591583462fa173efef19ee7835938aab19b52a3dc637a2e1c62a2e97f428fe492bea6b7b6891da3af45602a8ebf7112c1733d914098e32a3c38
7
+ data.tar.gz: baa25447cd81057253277cf53348399487b15a2d8b5735e3531a57f6f87d7dec4dc12bfe0a3e2c87f80a20f9580c094b823616b093c5764f95789a1b0724d373
data/TODO.conformance.md CHANGED
@@ -526,6 +526,24 @@ tuple keys, node-set field violations and absent-field rows handled, cross-eleme
526
526
  STACK IS PINNED BACK to the known-good 1.9.406.0/0.6.2/0.8.161
527
527
  (98.28% restored, zero regressions vs the 406 baseline). The
528
528
  407 wins ride again when #47 and #529 land. NET: no score
529
+ - ID-VALUE-CONSTRAINT ROUND (2026-11-07): +1 IC (idZ011; suite
530
+ 4619->4620 = 98.38%, zero regressions, rspec green). Value
531
+ constraints (fixed/default) are FORBIDDEN on attribute declarations
532
+ typed xs:ID or derived from it (XSD 1.0 §3.2.6) — the schema is
533
+ uncompilable, so every instance reached is invalid regardless of
534
+ instance use. The attribute rule's declaration-scoped step 1c
535
+ checks the builtin-prefixed reference, ref-resolved declarations,
536
+ and the inline/named restriction base chain (depth 6); the
537
+ idZ011_a companion (xs:STRING default) stays clean. Family probes:
538
+ Attribute 113/113 clean, AttributeGroup 14 = the parked moxml#522
539
+ set unchanged. PROBE LESSON (repeat): single-process family probes
540
+ CRAWL after ~50 engine-heavy cases (engine-state accumulation;
541
+ enumeration order is unstable so the hang point moves) — the case
542
+ runs alone in <1s; batched methodology or the full measure is the
543
+ only reliable family signal at this scale. Remaining IC
544
+ singletons: idZ012 (IDREFS default references no ID), idZ015 (a
545
+ skip-wildcard-governed attribute supplies no IC field value).
546
+
529
547
  change; the pin protects the register.
530
548
  - NON-SIMPLE-FIELD ROUND (2026-11-07): +2 IC (idK012, idZ010; suite
531
549
  4617->4619 = 98.36%, zero regressions, rspec green). An identity
@@ -106,6 +106,13 @@ module Lutaml
106
106
  xml_attributes, collector,
107
107
  wildcards: wildcards)
108
108
 
109
+ # Step 1c: an xs:ID declaration cannot carry a value
110
+ # constraint — the schema itself is uncompilable, so the
111
+ # instance is invalid wherever the declaration is reached
112
+ # (XSD 1.0 §3.2.6, idZ011).
113
+ validate_id_value_constraints(schema_attributes, collector,
114
+ xml_element, repository)
115
+
109
116
  # Step 2: Validate attribute values
110
117
  validate_attribute_values(xml_element, resolved_attributes,
111
118
  xml_attributes, collector,
@@ -436,6 +443,73 @@ module Lutaml
436
443
  end
437
444
  end
438
445
 
446
+ # An xs:ID declaration with fixed or default is an illegal
447
+ # value constraint (XSD 1.0 §3.2.6): the type definition is
448
+ # or is derived from xs:ID. Declaration-scoped — fires on the
449
+ # element's type regardless of instance use (idZ011).
450
+ #
451
+ # @return [void]
452
+ def validate_id_value_constraints(schema_attrs, collector,
453
+ xml_element, repository)
454
+ schema_attrs.each do |schema_attr|
455
+ next if schema_attr.fixed.to_s.empty? &&
456
+ schema_attr.default.to_s.empty?
457
+ next unless id_typed_attribute?(schema_attr, repository)
458
+
459
+ report_error(
460
+ collector,
461
+ code: "id_value_constraint_violation",
462
+ message: "Attribute '#{schema_attr.name}' is typed " \
463
+ "xs:ID (or derived from it) and cannot carry " \
464
+ "a fixed or default value constraint",
465
+ location: xml_element.xpath,
466
+ context: { attribute: schema_attr.name },
467
+ )
468
+ end
469
+ end
470
+
471
+ # Whether the declaration's type is xs:ID or derives from it:
472
+ # a builtin-prefixed reference, or a restriction base chain
473
+ # (inline or named) whose terminal is xs:ID.
474
+ #
475
+ # @return [Boolean]
476
+ def id_typed_attribute?(schema_attr, repository)
477
+ return true if builtin_id_type?(schema_attr.type)
478
+
479
+ ref = schema_attr.ref.to_s
480
+ if ref.match?(/\S/) && repository
481
+ resolved = repository.resolve_attribute(ref.split(":").last,
482
+ nil)
483
+ return true if resolved && builtin_id_type?(resolved.type)
484
+ end
485
+
486
+ named = schema_attr.type.to_s.split(":").last
487
+ chain = schema_attr.simple_type ||
488
+ (named && repository&.resolve_named_type(named))
489
+ id_derived_chain?(chain, repository, 0)
490
+ end
491
+
492
+ # @return [Boolean]
493
+ def builtin_id_type?(reference)
494
+ parts = reference.to_s.split(":")
495
+ %w[xs xsd].include?(parts.first) && parts.last == "ID"
496
+ end
497
+
498
+ # @param type [Lutaml::Xml::Schema::Xsd::SimpleType, nil]
499
+ # @return [Boolean]
500
+ def id_derived_chain?(type, repository, depth)
501
+ return false if depth > 6 || type.nil?
502
+
503
+ base = type.restriction&.base.to_s
504
+ return true if builtin_id_type?(base)
505
+ return false if base.empty?
506
+
507
+ id_derived_chain?(
508
+ repository&.resolve_named_type(base.split(":").last),
509
+ repository, depth + 1
510
+ )
511
+ end
512
+
439
513
  # Check if attribute is required
440
514
  #
441
515
  # @param schema_attr [Lutaml::Xsd::Attribute] Schema attribute
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Xsd
5
- VERSION = "1.2.95"
5
+ VERSION = "1.2.96"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-xsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.95
4
+ version: 1.2.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.