Skip to content

Commit 9a56eb5

Browse files
authored
Merge pull request #276 from invopop/release-uuid-fix
UUID: fix unmarshal - release 0.74.1
2 parents 426c327 + 0be8d4e commit 9a56eb5

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to GOBL will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). See also the [GOBL versions](https://docs.gobl.org/overview/versions) documentation site for more details.
66

7+
## [v0.74.1] - 2024-05-23
8+
9+
UUID Unmarshal fix.
10+
11+
### Fixed
12+
13+
- UUID: parsing empty strings from JSON no longer causes error.
14+
715
## [v0.74.0] - 2024-05-23
816

917
Refining UUID library and moving to using version 7 as the default in GOBL.

uuid/uuid.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,14 @@ func Normalize(u *UUID) {
242242
}
243243
}
244244

245-
// UnmarshalText will ensure the UUID is always a valid UUID when unmarshalling.
245+
// UnmarshalText will ensure the UUID is always a valid UUID when unmarshalling
246+
// and just return an empty value if incorrect.
246247
func (u *UUID) UnmarshalText(txt []byte) error {
247-
id, err := uuid.Parse(string(txt))
248+
id, err := Parse(string(txt))
248249
if err != nil {
249250
return err
250251
}
251-
*u = UUID(id.String())
252+
*u = id
252253
return nil
253254
}
254255

uuid/uuid_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func TestUUIDUnmarshalJSON(t *testing.T) {
132132
name: "empty string",
133133
data: `{"id":""}`,
134134
want: m{},
135-
err: "invalid UUID length: 0",
135+
err: "",
136136
},
137137
{
138138
name: "null",

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
type Version string
99

1010
// VERSION is the current version of the GOBL library.
11-
const VERSION Version = "v0.74.0"
11+
const VERSION Version = "v0.74.1"
1212

1313
// Semver parses and returns semver
1414
func (v Version) Semver() *semver.Version {

0 commit comments

Comments
 (0)