Commit Graph

162 Commits

Author SHA1 Message Date
Jacek Sieka 6eadb6e939
check length before converting to range type (#102)
The index type of an array is a `range` meaning that converting an
out-of-bounds value to it will raise a `Defect`.

This PR fixes the defect but does nothing for arrays which are not
"full" - probably, this should become an error.

* bump version
2024-10-19 11:28:17 +02:00
andri lim 96fcb658b4
Fix import stew/results to pkg/results (#101) 2024-10-15 18:24:47 +07:00
andri lim 5127b26ee5
v0.2.8 (#100)
* v0.2.8

* Replace apt-fast with apt-get
2024-10-15 16:47:31 +07:00
metagn 9110cc8d7a
fix stylecheck for BiggestUInt (#99)
* fix reader_desc.nim

* fix test_serialization.nim

* workaround segfault on C++ related to unittest2

* link to nim issue as comment
2024-10-10 12:26:09 +00:00
Jacek Sieka ab1a061756
avoid threadvar for field table (#98)
* avoid threadvar for field table

* bump
2024-09-30 15:21:02 +02:00
Jacek Sieka b83739b430
allow serializing distinct arrays (#97)
A complement to
https://github.com/status-im/nim-json-serialization/pull/93
2024-09-26 16:19:22 +02:00
Miran 8b51cd8bc9
update ci.yml to test Nim 2.2; also test gcc-14 (#96) 2024-09-23 09:09:24 +00:00
andri lim 8a4ed98bbd
Add compile time switch to alter encoder enum representation (#95)
* Add compile time switch to alter encoder enum representation

* Fix test

* Add enum section in README.md

Add more tests and encoder features of enums

* Add enums section to README.md
2024-07-27 07:27:11 +07:00
Etan Kissling 6ff807654f
Update `nimbus-eth2` reference (#94)
`nim-beacon-chain` was renamed to `nimbus-eth2`, update references.
2024-07-24 13:34:36 +00:00
Etan Kissling 89f7be1783
extend automatic serialization support for `distinct` in Nim 2 (#93)
In Nim 2, `distinct` values no longer match `value is object` but need
to be checked separately with `value is distinct`. The underlying type
can be unwrapped with `distinctBase` to inspect whether this is a value
of type `distinct object` or `distinct` something-else.
2024-07-03 16:11:05 +02:00
Miran 9cf79c034c
update ci.yml and be more explicit in .nimble (#92) 2024-07-01 18:07:57 +02:00
andri lim 4d0b0662ed
Workaround Nim regression #23611 related to dirty template (#90) 2024-05-20 22:12:03 +07:00
andri lim 1ac1d69f95
Add JsonValueRef compare operation (#89) 2024-03-20 21:32:43 +07:00
jangko 7516a92eb8
Fix JsonValueRef.Object comparison 2024-02-29 13:58:51 +07:00
Etan Kissling 56c788bb25
avoid `XDeclaredButNotUsed` when no field `isnot JsonVoid` (#87)
Move the type definitions for `Writer` and `Flavor` closer to their
usage to avoid verbose hints when they are never used in an invocation.
2024-02-28 22:01:21 +00:00
Jacek Sieka c869dae884
include flavor in missing `readValue` error (#86) 2024-02-20 20:19:02 +01:00
tersec da49e0e0c5
test refc in CI in Nim 2.0 and later (#85) 2024-02-14 02:07:14 +00:00
jangko a6bdf41e9c
v0.2.6 2024-02-04 14:55:13 +07:00
jangko 0bb1e48872
Fix Flavor section in README.md 2024-02-04 14:54:49 +07:00
jangko 224fd6efc9
Fix missing std/strutils import for parseEnum 2024-01-27 16:32:14 +07:00
andri lim eeb7a04422
GitHub actions v4 (#81)
* Fix CI status badge URL

* Upgrade github actions to v4
2024-01-27 15:38:48 +07:00
tersec 6b3c9b5e43
rm deprecated ValidIpAddress support (#80) 2024-01-27 15:38:33 +07:00
jangko c9705eee64
Add test for nim compiler regression 23233 2024-01-23 09:15:31 +07:00
andri lim d9394dc728
Resilience against null fields (#78)
* Resilience against fields with null value

* writeField helper also handle optional fields correctly

* Use uint4 for test_parser's parseValue

* Add parseObjectWithoutSkip and parseObjectSkipNullFields
2024-01-17 13:39:29 +07:00
andri lim b14f5b58e9
Deconvolute optional fields writer (#77) 2024-01-17 07:48:42 +07:00
tersec 42253591b9
add lexer test cases (#76) 2024-01-15 07:02:08 +00:00
jangko 0db6307eb3
Add flavor feature: reader will skip null fields 2024-01-15 10:31:19 +07:00
jangko 9c74b885ea
Writer produce correct top-level or in-array optional elem when custom flavor omit optional fields 2024-01-11 16:51:00 +07:00
jangko 164a8bcbd5
v0.2.4 2024-01-08 09:22:37 +07:00
jangko 3f1ce24ee1
Increase stack size on Windows when running CI 2024-01-01 20:07:49 +07:00
jangko ebaec13e77
Switch to mingw-llvm for faster Windows CI 2024-01-01 18:58:08 +07:00
jangko 6f639dd6c1
Restore accidentally deleted raises pragma 2023-12-29 12:36:09 +07:00
jangko 6417b7656b
Reduce declared but not used warning 2023-12-29 12:34:39 +07:00
jangko 547604004d
Fix JsonValueRef nil comparison 2023-12-29 12:33:58 +07:00
jangko ce214b000d
Improve nested structure depth limit check 2023-12-29 12:31:56 +07:00
jangko c35151b035
v0.2.2 2023-12-27 12:14:02 +07:00
jangko ff62eb1f87
Add JsonWriter helper procs to README.md 2023-12-27 12:12:14 +07:00
jangko 61a03e20d3
Add JsonVoid, JsonNumber, and JsonValueRef to JsonWriter 2023-12-27 11:58:02 +07:00
jangko 9720b33f99
Add features documentation 2023-12-26 16:54:19 +07:00
jangko 1996de769b
Add fuzz test 2023-12-26 16:03:47 +07:00
jangko 61bae43e01
Improve lexer flexibility 2023-12-26 16:03:46 +07:00
jangko d57a9d86c5
Add test vectors 2023-12-25 22:55:11 +07:00
jangko 34dc825066
Add copyright year to source file 2023-12-25 22:55:07 +07:00
jangko 9b5fbf8a0c
v0.2.0 2023-12-22 08:45:45 +07:00
zah 1693db7a57
Restore the reader.skipSingleJsValue API (#67) 2023-12-19 14:34:50 +02:00
zah f42567c00c
Basic support for Json flavours without default object serialization (#66)
Other changes:

* Migrate many procs accepting JsonReader to JsonLexer in order to
  reduce the number of generic instantiations and the resulting code
  bloat
2023-12-19 12:00:24 +02:00
gabrielmer 230e226da0
fix: amend incorrect int bound check (#65) 2023-11-24 17:18:23 +01:00
Etan Kissling 85b7ea093c
add `{.raises.}` annotation to `writeValue` (#64)
Tag `writeValue` overrides with `{.raises: [IOError].}`.

The override in `writer.nim` also needs `gcsafe` to support recursion
in Nim 2.0.
2023-08-19 13:47:32 +02:00
Etan Kissling d93fc19d4a
add `readValue` implementations for case objects (#63)
Case objects require custom `readValue` implementations to prevent
problems when keys are in an unexpected order. Define them for tests.
2023-08-19 12:28:06 +02:00
Jacek Sieka bb53d49caf
missing raises (#61) 2023-07-06 09:13:29 +02:00