- deps: bump minimatch from 3.0.4 to 3.1.2 (#203) (108de56)
- JsonSerializer: deserialize and serialize dictionary (map) having array as value (#208) (1c41836)
Check the new README to understand how to use typescript-json-serializer
now.
JsonObject
: empty object{}
is no longer passed to the constructor on deserialize. This list of default params must be pass to theJsonObject
thanks to the newconstructorParams
property of theJsonObjectOptions
if the class contains a constructor with params used in the constructor body.
- deps: bump json5 from 2.2.0 to 2.2.3 (#196) (63d941d)
- JsonObject:
JsonObjectOptions
has been added to manage default constructor params values (#200) (8f9eba8) - JsonSerializer: take in account the default value of properties when it checks if the value is
required
(#201) (136ed86)
- JsonObjectOptions:
additionalPropertiesPolicy
option has been added to define what is the policy when the algorithm meet an additional property, the 3 choices areallow
,disallow
andremove
(#186) (07284ef)
Check the new README to understand how to use typescript-json-serializer
now.
JsonProperty
:isDictionary
argument has been removed, now you can use thedataStructure
argument
- JsonProperty:
dataStructure
argument has been added to managearray
,dictionary
,map
andset
(#185) (ace015f)
(special thanks to @THUzxj)
- deps: bump minimist from 1.2.5 to 1.2.6 (345349c)
- deps: bump ansi-regex from 4.1.0 to 4.1.1 (d8c5310)
- deserialize: support to deserialize using instance of type (#170) (f4d33f9)
- deserializeObject: support to deserialize using instance of type (#170) (f4d33f9)
- deserializeObjectArray: support to deserialize using instance of type (#170) (f4d33f9)
(special thanks to @dhkatz)
- JsonSerializer: apply properly
NullishPolicy
validation (#167) (8faa6ae) - deps: bump
trim-off-newlines
from 1.0.1 to 1.0.3 (8786244)
New major version comes with lot of breaking changes detailed below.
The purpose was to reorganize the entire project, write more tests and above all improve the usage of the library.
Check the new README to understand how to use typescript-json-serializer
now.
Serializable
:- the decorator was renamed to
JsonObject
to be more consistent formatPropertyNames
option has been moved to the newJsonSerializerOptions
class.
- the decorator was renamed to
JsonProperty
:predicate
argument has been removed, now you can use thetype
argumentnames
argument has been removed, now you can use thename
argument
serialize
function has been moved to the newJsonSerializer
classdeserialize
function has been moved to the newJsonSerializer
class
- replace
tsc
byrollup
for types generation (ca9f08) - bump
tmpl
from version 1.0.4 to 1.0.5
- JsonSerializer: new class was added to handle all the logic about serialization and deserialization (bcc49e)
- JsonSerializerOptions: new class was added to handle all the
JsonSerializer
options as (bcc49e)- errorCallback: callback you can define to handle the errors, by default the library comes with 2 predefined callback
logError
andthrowError
but you can define your own - nullishPolicy: object to define what is the policy when the algorithm meet a
null
or anundefined
value, the 3 choices areallow
,disallow
andremove
- formatPropertyName: this option has been moved from
Serializable
decorator and keep the same behavior
- errorCallback: callback you can define to handle the errors, by default the library comes with 2 predefined callback
- serializeObject: new method added to
JsonSerializer
to serialize object only (bcc49e) - serializeObjectArray: new method added to
JsonSerializer
to serialize object object array only (bcc49e) - deserializeObject: new method added to
JsonSerializer
to deserialize object only (bcc49e) - deserializeObjectArray: new method added to
JsonSerializer
to deserialize object object array only (bcc49e)
- deserialize: accept object as constructor param for type (#161) (4ab2170)
- deps: bump tmpl from 1.0.4 to 1.0.5 (05e0fc2)
- deps: move
tslib
fromdevDependencies
todependencies
to avoid the following error:"export '__spreadArray' (imported as 'e') was not found in 'tslib'
(#148) (5895ccf)
- getPropertyNames: remove complexity by removing two loops (6dd896a)
- getPropertyNames: improve regex to take in account Angular and React builds (#132) (#135) (8470679)
- docs: add a section to explain how to use the library with CRA (create-react-app) (#132) (2c0ddbc)
- remove sourcemaps (b26db94)
- onSerialize renamed by afterSerialize
- onDeserialize renamed by beforeDeserialize
- postDeserialize renamed by afterDeserialize
- castSimpleData: handle null type (93bc7b7)
- security: update lodash (87a5037)
- remove tslib (36a3bc6)
- add tslib (importHelpers) and remove comments from js files (f739250)
- deserialize: add possibility to predicate an union type composed by custom classes and primitive types (#80) (57d7f22)
- create specific tsconfig build file (acbf02c)
- only build the src folder (768cfa2)
- getParamNames: improve constructor parameter pattern (#55) (a9e2a74) (special thanks to @jiripudil)
- convertPropertyToData: test if a date is undefined or null before using toISOString method (#50) (8d5d9cf)
- deserialize: set first parameter type to object to avoid runtime error (1ae3531)
- security: update set-value (7d07007)
- deserialize: add generic type (a0689eb)
- getParamNames: retrieve constructor param names from minified code (#36) (14f2140) (special thanks to @civilizeddev)
- getParamNames: exclude comments from constructor parsing (#33) (77a80c3) (7231455) (special thanks to @civilizeddev)
- getParamNames: exclude simple comments from constructor parsing (#33) (ad85984) (special thanks to @civilizeddev)
- getParamNames: get constructor properties (e4ba74f)