Skip to content

Commit

Permalink
Add copyright year to source file
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Dec 25, 2023
1 parent 9b5fbf8 commit 34dc825
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 5 deletions.
9 changes: 9 additions & 0 deletions config.nims
Original file line number Diff line number Diff line change
@@ -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)
when fileExists("nimble.paths"):
include "nimble.paths"
Expand Down
9 changes: 9 additions & 0 deletions json_serialization.nim
Original file line number Diff line number Diff line change
@@ -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
serialization, json_serialization/[format, reader, writer]

Expand Down
9 changes: 9 additions & 0 deletions json_serialization/format.nim
Original file line number Diff line number Diff line change
@@ -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
serialization/formats

Expand Down
9 changes: 8 additions & 1 deletion json_serialization/lexer.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{.push raises: [].}

This comment has been minimized.

Copy link
@zah

zah Dec 28, 2023

Contributor

Perhaps you removed this unintentionally?

This comment has been minimized.

Copy link
@jangko

jangko Dec 29, 2023

Author Contributor

oops, I will restore it.

# 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/[json, unicode],
Expand Down
11 changes: 10 additions & 1 deletion json_serialization/reader.nim
Original file line number Diff line number Diff line change
@@ -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".}

import
Expand Down Expand Up @@ -773,4 +782,4 @@ template configureJsonDeserialization*(
static: doAssert not allowNumericRepr or enumStyle(T) == EnumStyle.Numeric
r.parseEnum(value, allowNumericRepr, stringNormalizer)

{.pop.}
{.pop.}
9 changes: 9 additions & 0 deletions json_serialization/std/net.nim
Original file line number Diff line number Diff line change
@@ -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/strutils, stew/shims/net,
../../json_serialization, chronos/transports/common
Expand Down
9 changes: 9 additions & 0 deletions json_serialization/std/options.nim
Original file line number Diff line number Diff line change
@@ -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]
export options

Expand Down
9 changes: 9 additions & 0 deletions json_serialization/std/sets.nim
Original file line number Diff line number Diff line change
@@ -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]
export sets

Expand Down
9 changes: 9 additions & 0 deletions json_serialization/std/tables.nim
Original file line number Diff line number Diff line change
@@ -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]
export tables

Expand Down
9 changes: 9 additions & 0 deletions json_serialization/stew/results.nim
Original file line number Diff line number Diff line change
@@ -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/results, ../../json_serialization/[reader, writer, lexer]

Expand Down
9 changes: 9 additions & 0 deletions json_serialization/types.nim
Original file line number Diff line number Diff line change
@@ -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
serialization/errors

Expand Down
12 changes: 12 additions & 0 deletions json_serialization/writer.nim
Original file line number Diff line number Diff line change
@@ -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/[json, typetraits],
faststreams/[outputs, textio], serialization,
Expand Down Expand Up @@ -152,6 +161,9 @@ template writeObjectField*[FieldType, RecordType](w: var JsonWriter,
field: FieldType): bool =
mixin writeFieldIMPL, writeValue

type
R {.used.} = type record

w.writeFieldName(fieldName)
when RecordType is tuple:
w.writeValue(field)
Expand Down
9 changes: 9 additions & 0 deletions tests/nim.cfg
Original file line number Diff line number Diff line change
@@ -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

11 changes: 11 additions & 0 deletions tests/test_all.nim
Original file line number Diff line number Diff line change
@@ -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
test_lexer,
test_serialization
9 changes: 9 additions & 0 deletions tests/test_json_flavor.nim
Original file line number Diff line number Diff line change
@@ -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
strutils,
serialization,
Expand Down
9 changes: 8 additions & 1 deletion tests/test_lexer.nim
Original file line number Diff line number Diff line change
@@ -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
unittest,
Expand Down
11 changes: 10 additions & 1 deletion tests/test_serialization.nim
Original file line number Diff line number Diff line change
@@ -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
strutils, unittest2, json,
Expand Down Expand Up @@ -746,6 +753,7 @@ suite "toJson tests":
expect SerializationError:
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
HoldsOption, requireAllFields = true)
discard h4

test "Nested option types":
let
Expand Down Expand Up @@ -824,6 +832,7 @@ suite "toJson tests":
expect SerializationError:
let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""",
HoldsResultOpt, requireAllFields = true)
discard h4

test "Custom field serialization":
let obj = WithCustomFieldRule(str: "test", intVal: 10)
Expand Down
12 changes: 11 additions & 1 deletion tests/utils.nim
Original file line number Diff line number Diff line change
@@ -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
func test_dedent*(s: string): string =
Expand Down

0 comments on commit 34dc825

Please sign in to comment.