mirror of
https://github.com/status-im/NimYAML.git
synced 2025-01-11 20:14:19 +00:00
Final changes for NimYAML 2.0.0
* updated nimble to require Nim 2.0 * updated some docs * wrote changelog * improved Flake
This commit is contained in:
parent
fe4449aaec
commit
9ed6fd60f0
1
.github/workflows/action.yml
vendored
1
.github/workflows/action.yml
vendored
@ -12,6 +12,7 @@ jobs:
|
||||
- windows-latest
|
||||
- macOS-latest
|
||||
nim-version:
|
||||
- '2.0.x'
|
||||
- stable
|
||||
- devel
|
||||
steps:
|
||||
|
46
CHANGELOG.md
46
CHANGELOG.md
@ -1,3 +1,47 @@
|
||||
## 2.0.0
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
* Requires Nim 2.x
|
||||
* ``yaml/serialization`` has been split into
|
||||
``yaml/native`` (low-level API to load a ``YamlStream`` into Nim vars),
|
||||
``yaml/loading`` (high-level loading API) and
|
||||
``yaml/dumping`` (high-level dumping API).
|
||||
* Dumping API now has a ``Dumper`` object.
|
||||
All dumping procs require an instance of this object.
|
||||
Previous parameters ``tagStyle``, ``handles`` and ``options`` have been
|
||||
moved into this object.
|
||||
* Constants with default values have been removed in favor of default values
|
||||
for object fields.
|
||||
* Low-level native API for loading and dumping has undergone changes to
|
||||
parameter order. Serialization and deserialization context is now first
|
||||
parameter, to be able to use prefix notation.
|
||||
* Removed ``PresentationStyle``; instead ``Dumper`` can be initialized with
|
||||
presets mirroring the former values of ``PresentationStyle``.
|
||||
* Removed deprecated ``YamlDocument`` type from DOM API.
|
||||
Use ``YamlNode`` instead.
|
||||
|
||||
Features:
|
||||
|
||||
* Can now load and dump fields of the parent type(s) of used types (#131)
|
||||
* Updated type guessing to use regexes from YAML 1.2 instead of old YAML 1.1.
|
||||
Type guessing is used primarily for heterogeneous items
|
||||
(implicit variant objects).
|
||||
* Presenter no longer outputs trailing spaces
|
||||
* More presentation options
|
||||
* Simplified default presentation style: Don't output ``%YAML 1.2``,
|
||||
``%TAG !n! ...`` or ``---`` by default.
|
||||
Output compact notation for collections.
|
||||
* Loading now works at compile time (#70, #91).
|
||||
Dumping doesn't work at compile time currently.
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Don't crash on invalid input, instead raise a catchable
|
||||
``YamlParserError`` (#129)
|
||||
* Fixed some parser errors in exotic edge cases
|
||||
* Several fixes to make the library work with Nim 2.x
|
||||
|
||||
## 1.1.0
|
||||
|
||||
Features:
|
||||
@ -8,7 +52,7 @@ Features:
|
||||
* Added ``loadFlattened`` to resolve aliases while loading,
|
||||
instead of deserializing them into pointers. (#117)
|
||||
|
||||
Bugfixes
|
||||
Bugfixes:
|
||||
|
||||
* Fixed problems with ARC/ORC (#120)
|
||||
* Fixes some edge cases around whitespace while parsing
|
||||
|
57
README.md
57
README.md
@ -14,50 +14,66 @@ available as tags in this repository and can be fetched via nimble:
|
||||
## Status
|
||||
|
||||
This library is stable.
|
||||
I only maintain it and will not add any features due to lack of time and interest.
|
||||
NimYAML passes all tests of the current YAML 1.2 test suite.
|
||||
See [the official YAML test matrix][4] for details.
|
||||
NimYAML passes all tests of the current [YAML 1.2 test suite][4].
|
||||
This project follows [SemVer][5].
|
||||
|
||||
PRs for bugs are welcome. If you want to add a feature, you are free to; but be aware that I will not maintain it and am unlikely to review it in depth, so if I accept it, you will be co-maintainer.
|
||||
I am committed to maintaining the library, but will seldom introduce new features.
|
||||
PRs are welcome.
|
||||
|
||||
## Features that have been planned, but will not be implemented by myself
|
||||
## Dependencies
|
||||
|
||||
* Serialization:
|
||||
- Support for more standard library types
|
||||
- Support for polymorphism
|
||||
- Support for generic objects
|
||||
NimYAML requires Nim 2.0.0 or later.
|
||||
The last version supporting Nim 1.6.x is `v1.1.0`.
|
||||
Use this in your `.nimble` file if you haven't migrated to Nim 2.x yet:
|
||||
|
||||
```nim
|
||||
requires "yaml ^= 1.1.0"
|
||||
```
|
||||
|
||||
## Missing Features
|
||||
|
||||
Be aware that serialization currently doesn't support the following features in types that are used for loading and dumping:
|
||||
|
||||
* Polymorphism: If a field has a type `ref Parent`, you cannot load a `ref Child` into it.
|
||||
* Generic objects: The code auto-generating loading and dumping functions currently cannot process instances of generic objects anywhere in the type you want to load/dump.
|
||||
* Default values: NimYAML uses its own `{.defaultVal: "foo".}` pragma.
|
||||
It currently cannot process default values introduced in Nim 2.0.
|
||||
|
||||
## Developers
|
||||
|
||||
Nix users can `nix develop` to get a devshell with the required Nim version. You'll need to have Flakes enabled.
|
||||
|
||||
```bash
|
||||
nim test # runs all tests
|
||||
nim lexerTests # run lexer tests
|
||||
nim parserTests # run parser tests (git-clones yaml-dev-kit)
|
||||
nim nativeTests # runs native value tests
|
||||
nim quickstartTests # run tests for quickstart snippets from documentation
|
||||
nim bench # runs benchmarks, requires libyaml
|
||||
nim clean # guess
|
||||
nim build # build a library
|
||||
```
|
||||
|
||||
NimYAML supports Nim 1.4.0 and later.
|
||||
Previous versions are untested.
|
||||
|
||||
When debugging crashes in this library, use the `d:debug` compile flag to enable printing of the internal stack traces for calls to `internalError` and `yAssert`.
|
||||
|
||||
### Web Documentation
|
||||
|
||||
The online documentation on [nimyaml.org](https://nimyaml.org), including the
|
||||
testing ground, is generated via [Nix Flake][3] and easily deployable on NixOS.
|
||||
Just include the NixOS module in the flake and do
|
||||
testing ground, is generated via [Nix Flake][3].
|
||||
|
||||
You can build & run the docs server at via
|
||||
|
||||
```bash
|
||||
nix run .#webdocs
|
||||
```
|
||||
|
||||
It can be deployed to NixOS by importing the Flake's NixOS module and then doing
|
||||
|
||||
```nix
|
||||
services.nimyaml-webdocs.enable = true;
|
||||
```
|
||||
|
||||
This will run the documentation server locally at `127.0.0.1:5000`. You can
|
||||
change the `address` setting to make it public, but I suggest proxying via nginx
|
||||
to get HTTPS.
|
||||
This will run the documentation server locally at `127.0.0.1:5000`.
|
||||
Since there isn't much of a use-case for third parties to host this documentation, there is no support for running the server without Nix.
|
||||
|
||||
## License
|
||||
|
||||
@ -65,9 +81,10 @@ to get HTTPS.
|
||||
|
||||
## Support this Project
|
||||
|
||||
If you like this project and want to give something back, you can check out GitHub's Sponsor button to the right. This is just an option I provide, not something I request you to do, and I will never nag about it.
|
||||
If you want to support this project financially, there's a GitHub Sponsor button to the right.
|
||||
|
||||
[1]: http://flyx.github.io/NimYAML/
|
||||
[2]: copying.txt
|
||||
[3]: https://nixos.wiki/wiki/Flakes
|
||||
[4]: https://matrix.yaml.info/
|
||||
[4]: https://github.com/yaml/yaml-test-suite
|
||||
[5]: https://semver.org
|
||||
|
@ -44,7 +44,7 @@
|
||||
'';
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
pname = "nimyaml-server-deamon";
|
||||
pname = "nimyaml-docs-server";
|
||||
inherit version;
|
||||
src = filter {
|
||||
root = ./.;
|
||||
@ -84,7 +84,7 @@
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,share}
|
||||
cp server/server $out/bin
|
||||
cp server/server $out/bin/nimyaml-docs-server
|
||||
cp -rt $out/share docout/*
|
||||
'';
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "1.1.0"
|
||||
version = "2.0.0"
|
||||
author = "Felix Krause"
|
||||
description = "YAML 1.2 implementation for Nim"
|
||||
license = "MIT"
|
||||
@ -8,4 +8,4 @@ skipDirs = @["bench", "doc", "server", "test", "tools"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 1.4.0"
|
||||
requires "nim >= 2.0.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user