leptris 1.9.186.0 → 1.9.186.1
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/CHANGELOG.md +12 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/relaxng.rb +32 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b96846659a7745d4cd915d4bb375f7081c7c5ba703bc4482fc44a3073c59961
|
|
4
|
+
data.tar.gz: dfed75d7ae1d31974ba748491de60e57bc4b6ecaf59902e7d53a88f6ff5ba0bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 201cd532c264025a6a614e0f40fb576f63603175307b650a1dcd2d09dd53b74fff00bc9141e40c66246f4424643f8d4cba1439af8014d03aeb5bce0fcb12ac0c
|
|
7
|
+
data.tar.gz: 616ee2ad30c627196720c1be0301572cdb8e909f872f2ea78b7678eddf3b127ca43442a3e5b7ce053bce6967b45707b13ef1459b69a7341cd83c2bb220307323
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to Leptris will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.9.186.1] - 2026-09-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `RelaxNG::Schema#validate_errors(document)` — structured
|
|
13
|
+
`[{ line:, column:, message: }]` rows (Jing's exact attribution,
|
|
14
|
+
upstream #878 accumulation), for callers that need the fields
|
|
15
|
+
for log formatting instead of re-parsing the Jing-form strings
|
|
16
|
+
from `#validate`. `#validate` now renders its strings from the
|
|
17
|
+
same rows (one enumeration of the error surface; identical
|
|
18
|
+
output, including the back-compat zero-count fallback).
|
|
19
|
+
|
|
8
20
|
## [1.9.186.0] - 2026-09-17
|
|
9
21
|
|
|
10
22
|
### Changed — libleptris 1.9.181 → 1.9.186 (lockstep)
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/relaxng.rb
CHANGED
|
@@ -22,6 +22,7 @@ module Leptris::XML::RelaxNG
|
|
|
22
22
|
# rng = Leptris::XML::RelaxNG.parse(schema_xml)
|
|
23
23
|
# rng.valid?(doc) # => true/false
|
|
24
24
|
# rng.validate(doc) # => [] or ["1:0: error: element ..."]
|
|
25
|
+
# rng.validate_errors(doc) # => [] or [{line:, column:, message:}]
|
|
25
26
|
#
|
|
26
27
|
class Schema
|
|
27
28
|
# GC-managed compiled handle.
|
|
@@ -63,25 +64,45 @@ module Leptris::XML::RelaxNG
|
|
|
63
64
|
# libleptris 1.9.179 (#878): errors accumulate — every failure
|
|
64
65
|
# from the validate call is returned, not just the first.
|
|
65
66
|
def validate(document)
|
|
67
|
+
structured = validate_errors(document)
|
|
68
|
+
unless structured.empty?
|
|
69
|
+
return structured.map do |e|
|
|
70
|
+
e[:line] > 0 ? "#{e[:line]}:#{e[:column]}: error: #{e[:message]}"
|
|
71
|
+
: e[:message]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
# Invalid verdict with nothing accumulated: the back-compat
|
|
75
|
+
# single-error accessor is the last resort (nil-safe).
|
|
76
|
+
return [] if valid?(document)
|
|
77
|
+
[Leptris::XML::FFI.leptris_rng_error(@handle)].compact
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def valid?(document)
|
|
81
|
+
Leptris::XML::FFI.leptris_rng_validate(@handle,
|
|
82
|
+
document.c_ptr) != 0
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Structured errors: [{ line:, column:, message: }] — the fields
|
|
86
|
+
# callers need for log formatting, instead of re-parsing the
|
|
87
|
+
# Jing-form strings from #validate. Empty when valid. Message,
|
|
88
|
+
# line, and column carry Jing's exact attribution (libleptris
|
|
89
|
+
# >= 1.9.179, upstream #878). This is the single enumeration of
|
|
90
|
+
# the error-accumulation surface; #validate renders these rows.
|
|
91
|
+
def validate_errors(document)
|
|
66
92
|
ok = Leptris::XML::FFI.leptris_rng_validate(@handle,
|
|
67
93
|
document.c_ptr)
|
|
68
94
|
return [] if ok != 0
|
|
69
95
|
count = Leptris::XML::FFI.leptris_rng_error_count(@handle)
|
|
70
|
-
return [
|
|
71
|
-
# Jing's rendering for every accumulated error, matching the
|
|
72
|
-
# single-error accessor's format ("line:col: error: msg").
|
|
96
|
+
return [] if count.zero?
|
|
73
97
|
Array.new(count) do |i|
|
|
74
98
|
msg = Leptris::XML::FFI.leptris_rng_error_message(@handle, i)
|
|
75
99
|
next nil if msg.nil?
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
100
|
+
{
|
|
101
|
+
line: Leptris::XML::FFI.leptris_rng_error_line(@handle, i),
|
|
102
|
+
column: Leptris::XML::FFI.leptris_rng_error_column(@handle, i),
|
|
103
|
+
message: msg,
|
|
104
|
+
}
|
|
79
105
|
end.compact
|
|
80
106
|
end
|
|
81
|
-
|
|
82
|
-
def valid?(document)
|
|
83
|
-
Leptris::XML::FFI.leptris_rng_validate(@handle,
|
|
84
|
-
document.c_ptr) != 0
|
|
85
|
-
end
|
|
86
107
|
end
|
|
87
108
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.186.
|
|
4
|
+
version: 1.9.186.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|