Skip to content

Releases: weberr13/go-decode

Added setting default values using a new API

05 Nov 17:29
344b8c7
Compare
Choose a tag to compare

This release adds the ability to set default values to decoded fields.
Defaults are assigned for fields of basic types (int/float/string) that have the correct struct tag (default:"value")

Default behavior is not to assign defaults. To assign default, users call new API UnmarshalJSONIntoWithDefaults
of DecodeIntoWithDefaults

Allow null for non-required fields

25 Oct 16:50
7c4498b
Compare
Choose a tag to compare
Merge pull request #13 from weberr13/ignore-unrequired-nil

Ignore nil value for unrequired fields

Fix nil value check for json null's

24 Oct 17:08
a04b5c0
Compare
Choose a tag to compare
Merge pull request #12 from weberr13/fix-panic-on-null

Add check and return error for nil value

Support Arrays of pointers and Unmarshaler interface

23 Oct 16:26
edd46d1
Compare
Choose a tag to compare
Merge pull request #10 from weberr13/set-field-with-unmarshaler

Add method to parse underlying type into object

Handle invalid field in decodeIntoArray

09 Oct 21:20
05a9710
Compare
Choose a tag to compare

Problem: Passing an invalid field (an empty array where there should be a struct) as a part of a request to DecodeInto was causing a panic in decodeIntoArray.

Solution: As a part of the block that checks the field.Kind() type, if none of the three types is discovered, an error string is returned so that it gets handled, rather than panicking on a nil value later on.

Testing (optional if not described in Solution section): A unit test mimicking this issue has been added to decode_test.go

Support required (non-pointer) fields in DecodeInto

27 Sep 18:22
52d2ef0
Compare
Choose a tag to compare

Add support for what are required fields in oapi-codegen, E.G. Non-pointers in the structs.

Introduced DecodeInto using SchemaPathFactory and related

13 Sep 19:12
da3e85a
Compare
Choose a tag to compare

Added support for per type factory reachable using a single path factory.
Path defined as SchemaName.propertyName

No more Decodable interface

19 Aug 22:13
6b91aba
Compare
Choose a tag to compare

Go type assertions must be bidirectional so I cannot use Decodable the way I would like.

Kind -> Discriminator

14 Aug 20:06
Compare
Choose a tag to compare
v0.0.2

Kind is way to generic for the interface.  Discriminator is less like…

Initial

13 Aug 20:31
Compare
Choose a tag to compare
v0.0.1

Support for []interface{} which is *actually* []map[string]interface{}