Commit Graph

15 Commits

Author SHA1 Message Date
Alexander Hultnér eab9d05473 fix #2293: Properly encode Decimals without any decimal places. (#2294)
* fix #2293: Properly encode Decimals without any decimal places.

* doc: Added changelog entry.

* refactor: Move ConstrainedDecimal test from separate file into test_json

* docs: Remove prefix from changelog.

* test: Changed test_con_decimal_encode to @samuelcolvins recommendations
2021-02-24 11:50:23 +00:00
Arthur Pastel 33c5a4dc34 Add merged json_encoders inheritance (#2064)
* Implement merged json_encoders inheritance

* json_encoders inheritance documentation
2021-02-13 15:56:34 +00:00
Eric Jolibois 4020ebc412 feat: add default encoder for Pattern type (#2056)
closes #2045
2020-11-29 17:20:43 +00:00
Stephen Brown II cab6313798 Allow subclasses of known types to be encoded with superclass encoder (#1291)
* Add (failing) test for Subclass JSON encoding

* Allow subclasses of known types to be encoded with superclass encoder

* Add change file

* Add documentation, fix custom json_encoders and add unit test

Blacken doc
Fix test that worked on my machine
datetime.timestamp() is flakey?
Single quotes only

* Reduce lookups

- Remove last element in `__mro__` as it will always be `object`
- Use .get for compactness

* Regarding the loop

* Move Path and Enum into ENCODERS_BY_TYPE

Sort ENCODERS_BY_TYPE

* improve JSON docs

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-04-18 17:11:00 +01:00
Samuel Colvin 973de05a01 custom json (de)serialisation (#823)
* custom json (d)encoders, fix #714

* add docs
2019-09-30 14:34:30 +01:00
dmontagu 65d838aa88 Serialize only __root__ value (#752)
* Serialize only __root__ value, fix #730

* Add changes and fix docs

* Clean up root model docs

* Update docs/index.rst

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update docs/index.rst

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Rename variable

* fix rst in change description
2019-08-17 18:58:32 +01:00
Samuel Colvin 9ffa311f8f dataclasses to json (#575)
* dataclasses to json

* update history
2019-06-04 17:06:08 +01:00
Samuel Colvin 66ce99e4f0 Azure Pipelines - tests for windows (#538)
* add azure-pipelines.yml

* fix install command

* skip some tests on windows
2019-05-23 10:30:32 +01:00
Samuel Colvin 22f134475d Colors (#516)
* Color validator MVP

* Color Validator refactored

* Small optimizations applied

* Code coverage improved

* hex processing improved, json encoder and repr added

* Add documentation, update HISTORY (#504)

* Increase test coverage (#504)

* hex helpers refactored (#504)

* Fixes after code review (#509)

* Color Type section in docs reduced

* Check for valid but unnamed colors

* Minor fixes: typo in docs, default value for float comparison function

* rewrite Color

* fix color tests

* tweaks and improve docs

* tweaks and change Color.__str__

* add as_hsla and as_hsl

* support more rgb(a) formats

* add hsl parsing

* parsing hex with alpha channel

* fix hsl parsing

* simpler failure/fallback rules for color display

* storage as floats internally

* tweak docs

* fix type hints
2019-05-22 13:14:35 +01:00
Mike Goodspeed 0cfce77bb3 fix json for Path, FilePath, and DirectoryPath objects (#485)
* fix json for Path, FilePath, and DirectoryPath objects, fix #473

* convert to single spaces

* assert result to a string

* Update test_json.py

* encode entire Path hierarchy the same way
2019-04-23 15:09:09 +01:00
Atheuz 449661b8cc fix: serialize secrets to json. (#465)
* fix: serialize secrets to json, fix #462

* feat: adjust documentation for secretstr.

* feat: undo unnecessary changes. keep tests.

* fix: tests were broken, now they're fixed again.

* feat: add display fn to SecretStr and SecretBytes, to be used for json output.

* fix: minor typo.

* fix: last few comments.
2019-04-11 19:32:28 +01:00
Vitaly R. Samigullin 28191d594c Fix JSON serialization for ipaddress types (#457) 2019-04-04 10:03:51 +01:00
Samuel Colvin 15850a43c5 moving to black (#287)
* moving to black

* put back flake8

* remove isort option

* putting back isort

* uprev pycodestyle

* remove black from docs/examples

* tweak parse.py
2018-11-15 11:30:07 +00:00
Samuel Colvin f46dc0c56f timedelta json encoding (#247)
* timedelta json encoding, altnative to #220

* history and tests

* fix comments and tests

* docs for json_encoders

* tests plain timedelta object parsing

* uprev

* tweak docs
2018-08-25 17:06:32 +01:00
Samuel Colvin 37364a05b9 implement JSON serialisation (#210)
* implement JSON serialisation, fix #133

* documenting JSON serialisation

* fix coverage
2018-06-28 18:21:45 +01:00