Add copyright year to source file
This commit is contained in:
parent
9b5fbf8a0c
commit
34dc825066
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
# begin Nimble config (version 1)
|
# begin Nimble config (version 1)
|
||||||
when fileExists("nimble.paths"):
|
when fileExists("nimble.paths"):
|
||||||
include "nimble.paths"
|
include "nimble.paths"
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
serialization, json_serialization/[format, reader, writer]
|
serialization, json_serialization/[format, reader, writer]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
serialization/formats
|
serialization/formats
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
{.push raises: [].}
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[json, unicode],
|
std/[json, unicode],
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
{.experimental: "notnil".}
|
{.experimental: "notnil".}
|
||||||
|
|
||||||
import
|
import
|
||||||
|
@ -773,4 +782,4 @@ template configureJsonDeserialization*(
|
||||||
static: doAssert not allowNumericRepr or enumStyle(T) == EnumStyle.Numeric
|
static: doAssert not allowNumericRepr or enumStyle(T) == EnumStyle.Numeric
|
||||||
r.parseEnum(value, allowNumericRepr, stringNormalizer)
|
r.parseEnum(value, allowNumericRepr, stringNormalizer)
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/strutils, stew/shims/net,
|
std/strutils, stew/shims/net,
|
||||||
../../json_serialization, chronos/transports/common
|
../../json_serialization, chronos/transports/common
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import std/options, ../../json_serialization/[reader, writer, lexer]
|
import std/options, ../../json_serialization/[reader, writer, lexer]
|
||||||
export options
|
export options
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import stew/shims/sets, ../../json_serialization/[reader, writer, lexer]
|
import stew/shims/sets, ../../json_serialization/[reader, writer, lexer]
|
||||||
export sets
|
export sets
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import stew/shims/tables, ../../json_serialization/[reader, writer, lexer]
|
import stew/shims/tables, ../../json_serialization/[reader, writer, lexer]
|
||||||
export tables
|
export tables
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
stew/results, ../../json_serialization/[reader, writer, lexer]
|
stew/results, ../../json_serialization/[reader, writer, lexer]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
serialization/errors
|
serialization/errors
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[json, typetraits],
|
std/[json, typetraits],
|
||||||
faststreams/[outputs, textio], serialization,
|
faststreams/[outputs, textio], serialization,
|
||||||
|
@ -152,6 +161,9 @@ template writeObjectField*[FieldType, RecordType](w: var JsonWriter,
|
||||||
field: FieldType): bool =
|
field: FieldType): bool =
|
||||||
mixin writeFieldIMPL, writeValue
|
mixin writeFieldIMPL, writeValue
|
||||||
|
|
||||||
|
type
|
||||||
|
R {.used.} = type record
|
||||||
|
|
||||||
w.writeFieldName(fieldName)
|
w.writeFieldName(fieldName)
|
||||||
when RecordType is tuple:
|
when RecordType is tuple:
|
||||||
w.writeValue(field)
|
w.writeValue(field)
|
||||||
|
|
|
@ -1,2 +1,11 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
--threads:on
|
--threads:on
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
|
{. warning[UnusedImport]:off .}
|
||||||
|
|
||||||
import
|
import
|
||||||
test_lexer,
|
test_lexer,
|
||||||
test_serialization
|
test_serialization
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
strutils,
|
strutils,
|
||||||
serialization,
|
serialization,
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
{.used.}
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
unittest,
|
unittest,
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
{.used.}
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
strutils, unittest2, json,
|
strutils, unittest2, json,
|
||||||
|
@ -746,6 +753,7 @@ suite "toJson tests":
|
||||||
expect SerializationError:
|
expect SerializationError:
|
||||||
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
|
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
|
||||||
HoldsOption, requireAllFields = true)
|
HoldsOption, requireAllFields = true)
|
||||||
|
discard h4
|
||||||
|
|
||||||
test "Nested option types":
|
test "Nested option types":
|
||||||
let
|
let
|
||||||
|
@ -824,6 +832,7 @@ suite "toJson tests":
|
||||||
expect SerializationError:
|
expect SerializationError:
|
||||||
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
|
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
|
||||||
HoldsResultOpt, requireAllFields = true)
|
HoldsResultOpt, requireAllFields = true)
|
||||||
|
discard h4
|
||||||
|
|
||||||
test "Custom field serialization":
|
test "Custom field serialization":
|
||||||
let obj = WithCustomFieldRule(str: "test", intVal: 10)
|
let obj = WithCustomFieldRule(str: "test", intVal: 10)
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
import strutils
|
# json-serialization
|
||||||
|
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
# at your option.
|
||||||
|
# This file may not be copied, modified, or distributed except according to
|
||||||
|
# those terms.
|
||||||
|
|
||||||
|
import
|
||||||
|
strutils
|
||||||
|
|
||||||
# `dedent` exists in newer Nim version and doesn't behave the same
|
# `dedent` exists in newer Nim version and doesn't behave the same
|
||||||
func test_dedent*(s: string): string =
|
func test_dedent*(s: string): string =
|
||||||
|
|
Loading…
Reference in New Issue