Bump NimYAML module and related changes (#2474)

This commit is contained in:
Kim De Mey 2024-07-12 09:30:50 +02:00 committed by GitHub
parent 25af347dfd
commit 70682cd4a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 17 deletions

View File

@ -41,30 +41,25 @@ proc loadFromYaml*(T: type, file: string): Result[T, string] =
ok(res) ok(res)
proc dumpToYaml*[T](value: T, file: string): Result[void, string] = proc dumpToYaml*[T](value: T, file: string): Result[void, string] =
# These are the default options aside from outputVersion which is set to none.
const options = PresentationOptions(
containers: cMixed,
indentationStep: 2,
newlines: nlOSDefault,
outputVersion: ovNone,
maxLineLength: some(80),
directivesEnd: deIfNecessary,
suppressAttrs: false,
quoting: sqUnset,
condenseFlow: true,
explicitKeys: false,
)
let s = newFileStream(file, fmWrite) let s = newFileStream(file, fmWrite)
defer: defer:
try: try:
close(s) close(s)
except Exception as e: except Exception as e:
raiseAssert(e.msg) raiseAssert(e.msg)
# To dump to yaml, avoiding TAGS and YAML version directives, no max line
# length.
var dumper = minimalDumper()
dumper.setDefaultStyle()
dumper.serialization.handles = @[]
dumper.serialization.tagStyle = tsNone
dumper.presentation.outputVersion = ovNone
dumper.presentation.maxLineLength = none(int)
try: try:
{.gcsafe.}: {.gcsafe.}:
# Dump to yaml, avoiding TAGS and YAML version directives. dumper.dump(value, s)
dump(value, s, tagStyle = tsNone, options = options, handles = @[])
except YamlPresenterJsonError as e: except YamlPresenterJsonError as e:
return err(e.msg) return err(e.msg)
except YamlSerializationError as e: except YamlSerializationError as e:

2
vendor/NimYAML vendored

@ -1 +1 @@
Subproject commit 189844a72b90ba7ade864f997280809efcb21d0a Subproject commit 25f600ebcd8f03492e6531f5642c3c2f1b83b3e3