Travis | Appveyor | NuGet |
---|---|---|
YamlDotNet is a .NET library for YAML. YamlDotNet provides low level parsing and emitting of YAML as well as a high level object model similar to XmlDocument. A serialization library is also included that allows to read and write objects from and to YAML streams.
Currently, YamlDotNet supports version 1.1 of the YAML specification.
YAML, which stands for "YAML Ain't Markup Language", is described as "a human friendly data serialization standard for all programming languages". Like XML, it allows to represent about any kind of data in a portable, platform-independent format. Unlike XML, it is "human friendly", which means that it is easy for a human to read or produce a valid YAML document.
The library has now been successfully used in multiple projects and is considered fairly stable.
More information can be found in the project's wiki.
Just install the YamlDotNet NuGet package:
PM> Install-Package YamlDotNet
If you need signed assemblies, install the YamlDotNet.Signed NuGet package instead:
PM> Install-Package YamlDotNet.Signed
If you do not want to use NuGet, you can download binaries here.
YamlDotNet is also available on the Unity Asset Store.
Please read CONTRIBUTING.md for guidelines.
New features:
IgnoreFields()
no the SerializerBuilder
or DeserializerBuilder
.New features:
New features:
Bug fixes:
Bug fixes:
Improvements:
Improvements:
Fixes:
/!\ This release fixes a security issue - CVE-2018-1000210. It is strongly recommended to upgrade, mainly if you are parsing documents from sources that you do not trust.
Many thanks to Kurt Boberg, from the DocuSign Application Security Team, who identified this issue and provided feedback on mitigation strategies.
Remove the legacy backwards-compatible syntax that enabled to create
Serializer
and Deserializer
directly then changing their configuration.
In most cases, the calls to the constructors should be replaced by
instantiations of SerializerBuilder
and DeserializerBuilder
.
These can be configured at will, then used to create instances of
(De)serializer.
It is still possible to use the default constructors, if no configuration is needed.
Drop support for specifying arbitrary type names in tags.
Support for automatically resolving a fully qualified type name
from a tag has been discontinued. That feature was poorly designed
and not standard.
During deserialization, each tag mapping must be explicitly registered.
During serialization, when using the EnsureRoundtrip
method, it is necessary to
register tag mappings for each type that will require a tag, that is, any type that
is used as the value of a property with a different declared type.
Fix bug where deserialized values were not being converted to the destination type.
var sut = new DeserializerBuilder()
.WithTagMapping("!dbl", typeof(DoublyConverted))
.Build();
// The scalar "hello" will first be converted to DoublyConverted
// then that value will be converted to int.
var result = sut.Deserialize<int>("!dbl hello");
Assert.Equal(5, result);
inline
Bug fixes:
Bug fixes:
Bug fixes:
netstandard1.3
).YamlDotNet now uses Cake to define the build script. Previously, custom powershell scripts were used.
Docker images are now available with everything that is required to build YamlDotNet, both locally, and on Travis. This is mostly useful for people wanting to develop on Linux, as it can be tricky to install the correct versions of the dependencies.
Code samples are now part of the solution
They are specified as tests, and the samples section of the wiki is generated from their source code and their output.
32bits Unicode code points in escape sequences and url-encoded tags are now properly handled.
Anchors can now be redefined in a document.
This is to conform to the 1.1 spec as well as the 1.2 spec:
3.2.2.2. Anchors and Aliases
When composing a representation graph from serialized events, an alias node refers to the most recent node in the serialization having the specified anchor. Therefore, anchors need not be unique within a serialization.
Added support for tag mappings on the serializer.
Use SerializerBuilder.WithTagMapping()
to register a new tag mapping on the serializer.
Allow to unregister components from the SerializerBuilder and DeserializerBuilder.
Use the Without...
methods on SerializerBuilder
and DeserializerBuilder
for that.
DateTimeKind.Utc
and Standard Date and Time Format Strings of "G" as its default parameters, if they are omitted.FormatException
. Please refer to my whole test cases.Improve the (de)serializer builders so that it is possible to wrap existing component registrations.
Added the ApplyNamingConventions
property to YamlMemberAttribute
.
When this property is true, naming conventions are not applied to the associated member. This solves issue 228.
This a major release that introduces a few breaking changes.
The constructors of Serializer
and Deserializer
are now obsolete
Except for the parameterless versions. The SerializerBuilder
and DeserializerBuilder
classes should now be used to configure and create instances of the (de)serializer.
Replaced the IYamlSerializable
interface with IYamlConvertible
The IYamlSerializable
is now obsolete, but will be kept until the next major release.
Removed EventReader
EventReader
was a wrapper over IParser
that offered some abstractions for parsing,
but also had some design flaws. It has been replaced by extension methods for IParser
.
The extension methods provide the same functionality,
and allow to always use the same type to represent the parser.
Dropped support for YamlAliasAttribute
This class has been obsolete for many releases, and it was time to let it go.
SerializerBuilder
and DeserializerBuilder
This is an important change that adds "builders" that can be used
to configure the Serializer and Deserializer through a fluent syntax.
The main objective of this is to allow more control over
the composition of services performed by these two classes.
This means that every aspect of the composition should be
extensible / overridable. Things like injecting a custom TypeInspector
or replacing the default ArrayNodeDeserializer with
an alternative implementation become possible and easy.
In order to avoid breaking existing code,
the constructors of Serializer and Deserializer have been kept
but marked as obsolete. In a future release they will be discarded.
Added the IYamlConvertible
interface
This new interface differs in that its methods receive a delegate that can be used
to reuse the current serializer or deserializer.
Improved the usability of YamlDocument
and other RepresentationModel classes:
YamlMappingNode
, YamlSequenceNode
and YamlScalarNode
now implement IYamlConvertible
,
which means that these types can appear in the middle of an object that is being serialized or
deserialized, and produce the expected result.Added support for alternative Boolean values
true
, y
, yes
, on
false
, n
, no
, off
.New features:
Bug fixes:
New features:
Fixes and improvements:
This is a minor update that simply adds an overload of YamlStream.Load to be able to specify the EventReader.
Bug fixes:
New features:
YamlStream.Save()
.YamlMember
attribute.Bug fixes:
Fix bug:
Changes and fixes on the Scanner to make it more usable:
This release adds a signed package and portable versions of the library.
This release adds merge key support: http://yaml.org/type/merge.html
Example from BackreferencesAreMergedWithMappings unit test:
var reader = new EventReader(new MergingParser(new Parser(stream)));
var result = Deserializer.Deserialize<Dictionary<string, Dictionary<string, string>>>(parser);
This is a bugfix release that fixes issue #90.
TODO
TODO
YamlSerializer has been replaced by the Deserializer class. It offer the same functionality of YamlSerializer but is easier to maintain and extend.
Bug fixes to the Serializer:
Adds a YAML editor add-in for Visual Studio 2012. Available on the Visual Studio Gallery.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。