Update Rust crate serde-saphyr to v2 #15
Loading…
Reference in a new issue
No description provided.
Delete branch "renovate/serde-saphyr-2.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
0.0.29→2.0.0Release Notes
bourumir-wyngs/serde-saphyr (serde-saphyr)
v2.2.0Compare Source
Added
Options::null_as_string(default:false) to preserve plainnull,Null,NULL,~, and empty scalars as text for string targets in bothmapping keys and values, including
String,&str, andCow<str>(#267). Explicit
!!nulltags remain rejected for strings;
Option<T>, untyped null inference, mapping-keycomparison, and
no_schemaquoting requirements keep their existing behavior.Options::bom_inside_document_as_content(defaultfalse) to preserve aBOM at the start of a token inside a document as plain scalar content, including
in included YAML. A BOM in a document prefix is still skipped.
Fixed
0X,0O,0B, including signed forms) asstrings during implicit type inference, including untagged enums and flattened
fields (#266). Direct typed integer parsing, explicit
!!inttags, and mapping-keycomparison retain their existing behavior.
+.nan,-.NaN,-.NAN) as stringsduring implicit type inference, since the YAML 1.2 Core schema allows a sign on
.infonly (#271; #272,#273). This applies under
every
NonFiniteFloatPolicy, including untagged enums and flattened fields.Also accept these spellings without quotes when
no_schema: truefor stringvalues and mapping keys, including
String,&str, andCow<str>. Directuntagged float targets continue to accept them as NaN. Explicit
!!floatscalarsnow preserve the supplied NaN sign when deserialized as floats.
Changed
context and tabs before quoted continuations are now accepted by default;
strict_indentation: truecontinues to reject them.v2.1.1Compare Source
Fixed
Performance improvements
v2.1.0Compare Source
Added
PropertySyntax::DockerComposeWithNulls: Compose interpolation where a value that issolely a reference to an unset property, or whose expansion is
null/~, becomes YAML null.Explicitly empty properties and empty defaults stay empty strings, and
DockerComposeitselfis unchanged.
Options::reject_tagged_field_namesto catch misplaced tags onstruct field names, with
Error::TaggedStructFieldNamediagnostics. Struct field names canonly be strings,
!!stris still accepted. As other tags can only be ignored, tag on a structurefield name is almost for sure placed wrongly. This setting will be default in next major release.
Options::leading_zero_numbers_as_stringsandOptions::underscored_numbers_as_stringsto preserve numeric spellings such as0755and1_000as strings in untyped values, including untagged enums andflattened fields (#225).
Both default to
false; direct typed parsing, explicit numeric tags, andmapping-key comparison keep their existing behavior.
Error::render_toto append diagnostics to anystd::fmt::WriteusingRenderOptions, without collecting the complete output in an intermediate string(#221).
DuplicateKeyPolicy::PassThroughto delegate repeated explicit mapping entriesto Serde visitors, matching
serde_yaml's handling for structs, standard maps, and custommultimap visitors (#226).
The default remains
Error; merge expansion retains its precedence rules. See the READMEmigration note for the scope of this option.
Deprecated
SerializerOptions::empty_as_braces. Setting it tofalseemits YAML nullfor empty block collections without tags or anchors. These values do not round-trip into
collection types. Omit the setting to keep the default
trueand emit[]or{}.Existing serialization behavior remains supported for compatibility.
Fixed
the
gardeandvalidatorintegrations. A document such as!Maybe nullnow reachesenum dispatch instead of being skipped. This also affects default options: an
Option<String>target receives aNoneitem for!Foo null, while aStringtargetreports
NullIntoString. Untagged null documents and explicit!!nullare still skipped.no_schema:!Number 42can deserialize into a numeric payload, while a string payload stillrequires quoting, as in
!Text "42". This applies independently of property interpolation.and interpolation work budgets. Reader iterators stop after an interpolation-budget
breach, including breaches reported through an alias.
avoiding trailing whitespace while preserving whitespace in the string content
(#249).
std::io::Errorfrom deserialization failures throughstd::error::Error::source(). The outer message isIO error, so error chainsinclude the underlying cause only once. Standalone Miette, Figment, and Figment2
diagnostics retain the cause in their messages. Custom Miette formatters retain
control over the complete message through
MessageFormatter::format_standalone_message.Error::WithSnippetwhen followingstd::error::Error::source()by forwarding the wrapped error's source.Use
without_snippet()to inspect the wrapped error. Alias errors retain theircomplete source chain, including snippet wrappers, for compatibility.
and enum targets, including externally tagged enum mapping keys (#235).
Incompatible tags and tagged null-like payloads no longer bypass validation.
flattened values. The local
!timeduration tag is distinct from standard YAML!!timestamp; robotics tags require the feature andangle_conversions: true.of silently constructing empty values (#233).
Blank values and the plain spellings
~,null,Null, andNULLare handled consistently.Write
[]for an empty sequence or{}for an empty mapping.Option<T>null handlingand defaults for absent fields are unchanged; see the README migration notes.
discarding them (#236). Use a bare variant name, a tag with empty content, or a
tag followed by
~ornull; quoted strings and collections are rejected.~,null,Null, andNULL.Other capitalization such as
NulLremains a string instead of being rejected, convertedto an empty value, or skipped as a document (#234).
strict_booleans: truenow recognizes only the six YAML 1.2 Core boolean spellings.Other capitalization such as
tRuEremains a string during inference, is acceptedas unquoted text with
no_schema, and is rejected for boolean targets..infand.nanduring inference (#254).v2.0.0Compare Source
YAML changes
Added
path_map::PathKind,PathKey::segments(), andPathMap::locations_for()for inspecting validation paths and resolving their YAML use/definition locations,
including best-effort spelling matches and recorded ancestor/root fallback.
RenderOptions::line_offsetandRenderOptions::source_namefor displayingembedded YAML diagnostics at their containing document's line numbers and naming
the root source in snippet headers, including the new
miette::to_miette_report_with_optionsentry point. Included files retain their ownnames and coordinates, and stored error locations and spans are unchanged.
PropertySyntax::DockerComposefor Compose-compatible property interpolation.commentsfeature, forwarding to granit-parser's matchingfeature. Builds with
default-features = falsemust enable it to useCommented<T>,CommentPosition, comment options, or comment budget fields and reports. Without it,YAML comments are still accepted and validated, but their text is not retained.
Options::non_finite_float_policywithNonFiniteFloatPolicy::{PassThrough, Reject, AsString}to configure non-finite floats delivered through
deserialize_any. Explicit policies overridethe legacy boolean; leaving the field unconfigured preserves its behavior.
borrowed_contextexample showing recursiveSerializeadapters that borrowan existing value tree and per-call formatting context, composing with
Tagged<T>andstyle wrappers without building a second container tree or using thread-local state.
SerializerOptions::no_lang_directive(defaultfalse) to suppress the%YAML 1.2directive and its leading---marker independently ofyaml_12's quoting.from_str_multiple,from_bytes_multiple, and their_with_optionsvariants todeserialize multiple YAML documents into any
C: Default + Extend<T>, including vectors,queues, sets, and custom accumulators. Values can borrow from the input string or UTF-8 byte
slice. Explicit type arguments specify both the document and collection types, for example
from_str_multiple::<String, Vec<_>>(input).error: Box<Error>field toError::AliasError, which keeps the original errorwhen an aliased value fails to deserialize. A custom
MessageFormatterorLocalizernow applies to that error, and
std::error::Error::sourcereturns it(#199).
Changed
from_multiple,from_multiple_with_options,from_slice_multiple, andfrom_slice_multiple_with_optionsnow acceptT: Deserialize<'de>so values can borrow fromthe input. They retain their names, single type parameter, and
Vec<T>returns and are notdeprecated. Ordinary calls, including
from_multiple::<Config>(input)and generic callerswith
T: DeserializeOwned, continue to work. Function pointers or callbacks accepting arbitraryinput lifetimes may need forwarding closures, such as
|input| from_multiple::<String>(input).serde-saphyr's
commentsfeature. Serialization-only builds remain independent ofgranit-parser, including when comment emission is enabled.
deserialize_any, including overflowingliterals such as
1e999. Opt intoPassThroughto preserve them in float-capable visitors,untagged enums, and flattened float fields, or
AsStringto receive canonical strings.With
PassThrough,serde_json::Valueconverts them toNullwithout an error.Direct
f32/f64deserialization is unchanged.Error::AliasErrorhas a new mandatoryerror: Box<Error>field.Manual constructors must supply it, and patterns listing every field must add
erroror...The variant name is unchanged. Rendering and
source()use the original error; thedeserializer still populates
msgwith anerror.to_string()snapshot for existing handlers.Deprecated
Options::reject_non_finite_typeless_floatin favor ofnon_finite_float_policy.When the new field is unconfigured, the boolean retains its original behavior:
true(the default) rejects and
falseconverts to strings. UseRejectorAsString, respectively,when migrating. Explicit policies override the boolean. Serialized options that omit both
fields retain the 1.3.0 behavior of converting non-finite floats to strings;
Options::default()continues to reject them.msgfield ofError::AliasErrorin favor of its structurederrorfield.Existing
Error::AliasError { msg, .. }patterns still work with a deprecation warning.Fixed
~,null,Null, andNULL.Other capitalization such as
NulLremains a string instead of being rejected, convertedto an empty value, or skipped as a document (#234).
LastWinsvalues and inline merges no longer produce alias errors when noalias was used. Replay preserves per-node origins, including genuine nested aliases,
ordinary value locations, and merge use-sites for
Spanned<T>.strict_booleans: truenow recognizes only the six YAML 1.2 Core boolean spellings.Other capitalization such as
tRuEremains a string during inference, is acceptedas unquoted text with
no_schema, and is rejected for boolean targets.(used at line X, column Y).The new
Localizer::alias_used_athook controls this suffix independently of failure anddefinition locations. Custom localizers that previously used
attach_locationto formator suppress alias-use coordinates should override
alias_used_atas well.include context. Validation messages honor external-message overrides, and multi-document
summaries honor custom message formatters. English defaults are unchanged.
Custom
Localizerimplementations migrating from 1.x must also overrideanchor_defined_hereto translate the alias anchor-definition label.(defined)or(defined here), including errors in included YAML files.Error::SerdeInvalidLengthwith separatelen,expected, andlocationfields, allowing custom formatters to inspect them.Default diagnostic wording is preserved (#205, item 6).
Localizer::root_path_labelin plain, snippet, andmiettediagnostics (#205, item 5c).characters inside each issue. Built-in formatters use the new optional
MessageFormatter::format_validation_issue_lineshook; existing custom whole-messageoverrides retain their behavior (#205, item 5a).
outer anchor location while exposing the original error directly through
error,source(),and the legacy
msgfield (#205, item 1).including fields outside the anchor's snippet window. Plain messages, snippets, and
miettereports include the distinct failing location; equal locations are not repeated.
MessageFormatter, includingformatters that delegate other variants to the built-in formatter. Plain messages report
the alias definition and use locations once through the active
Localizer; snippet andmiettediagnostics use location labels without embedding plain-text location suffixes.Custom location formatting and suppression now apply throughout aliased values
(#199).
std::error::Error::sourceexposes the inner error for bothError::AliasErrorandError::WithSnippet, preserving the source chain through the default snippet wrapper.huge_documentsandserde_derived_typesenabledeserialize, fixing isolated featurebuilds with
--no-default-features, including autopkgtests of Debian team (as observed).Documentation
serde_yamlmigration caveat for null values inStringfields,including when to use
Option<String>, quoted strings, or!!str(#229).
v1.3.0Compare Source
Fixed
resolution, including inside composite keys (
0xBand11compare equal). Deserializing to stringspreserves the original spelling;
FirstWinsandLastWinsretain the selected key's spellingand associated value.
for example,
{{"null": 1}: 2}now round-trips correctly.and merge resolution, including inside composite keys.
!!str null, including when deserializing toOption<String>.!!intand!!float) now deserialize correctly throughdeserialize_any,including quoted and block scalars.
from_str::<f64>("!!str 1.5")now returns an error.\uFFFEand\uFFFF.LitStrandLitString, by using keep chomping and retaining every empty line.literal and folded block scalars, including empty strings.
added two methods to
Inputfor performance improvements. As serde-saphyr re-exports it,the version number must be increased to 1.3 as well, even if no new features are added to
this crate itself.
v1.2.0Compare Source
Changed
Budget; property resource-limitfailures are now reported through
Error::BudgetandBudgetBreach.Options::reject_unsupported_tagsstrict mode. It rejects explicitly taggedscalar, sequence, and mapping nodes when their tag is unknown to serde-saphyr; the default remains
permissive for compatibility with custom tagged enums. YAML 1.1
!!mergeand!!valueareaccepted in this mode only as the exact scalar mapping keys
<<and=, respectively, whilerobotics-only
!degreesand!radiansrequire both theroboticscrate feature andangle_conversions, and!includerequires both theincludecrate feature and a configuredresolver.
reject_unsupported_tagsis disabled.indent_stepis now limited to1..=64, allserializer entry points validate it, and indentation arithmetic returns an error instead of
overflowing. We do not consider this breaking because values outside this range does not look sane.
contain whitespace, control characters, or YAML flow punctuation; unsupported names now return
a serialization error.
Fixes
#, such asa#b, while retaining quotes for leading or whitespace-separated hashes. Borrowed fromcommit 1119a54
under the terms of the Apache/MIT licenses. When property interpolation is configured,
newly plain values such as
${NAME}#fragmentcan interpolate; usequote_allto preserveliteral values.
!!mergekeys, including verbatim tags and%TAG-expandedhandles, everywhere implicit
<<merge keys are supported.!!valuetag while intentionally treating it as a no-op annotation.#-prefixed content lines.typetagtrait-object deserialization by consuming the closing mappingevent when a Serde map visitor returns after its final key/value pair, preventing a false
"multiple YAML documents" error.
identity handling, preventing lossy path collisions and policy bypasses on Unix.
while retaining the anchor-definition locations as secondary context.
Testing
we use YAML Test Suite v2022-01-17.
v1.1.0Compare Source
Added
Added granit-parser resource limits to
Budget(#172):max_buffered_comment_events(default: 32)simple_key_max_lookahead(default: 1,024 characters)flow_nesting_limit(default: 255)The limits are applied to parsers created for strings, readers, standalone budget checks, and
included YAML sources. When the
serde_derived_typesfeature is enabled, deserializing an olderBudgetrepresentation that omits these fields uses the documented defaults.Fixes
v1.0.1: maintenance releaseCompare Source
This release is fully API compatible with 1.0.0 and must be a drop-in replacement.
v1.0.0: - first real releaseCompare Source
From this release onward, we are adopting the 1.x.x semantic versioning (SemVer) scheme. This means that API changes will be clearly reflected in the version number: the major version indicates breaking changes, the minor version indicates backward-compatible additions, and the patch version indicates backward-compatible fixes. The current compatibility status is indicated by the accompanying badge.
This release adds some #[track_caller] and #[must_use] annotations where looks reasonable. There are not many other changes that is exactly the point: the crate seems serving community well enough.
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.
9f17d2a7c5toa782f14946a782f14946to810229ea93