diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-07-24 18:13:33 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-07-24 18:13:35 -0700 |
commit | b2e4e4242c9d8d4fbdc026a80dfefa86697a5649 (patch) | |
tree | 7b73de62345b121451a3ea5423f9f0e1103b04dc /skate | |
parent | f5575f41f799be9bdfd9d0406710aeebe20d6350 (diff) | |
download | refcat-b2e4e4242c9d8d4fbdc026a80dfefa86697a5649.tar.gz refcat-b2e4e4242c9d8d4fbdc026a80dfefa86697a5649.zip |
schema: have issued+accessed (CSLDate) actually omitempty
Similar to TargetCSL, these should be pointer types so they don't get
encoded as empty objects when not set.
Diffstat (limited to 'skate')
-rw-r--r-- | skate/reduce.go | 2 | ||||
-rw-r--r-- | skate/reduce_test.go | 4 | ||||
-rw-r--r-- | skate/schema.go | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/skate/reduce.go b/skate/reduce.go index e2fa130..356ed25 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -598,7 +598,7 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [ Title: r.Biblio.Title, URL: r.Biblio.Url, Volume: r.Biblio.Volume, - Issued: CSLDate{ + Issued: &CSLDate{ Raw: year, }, } diff --git a/skate/reduce_test.go b/skate/reduce_test.go index 9c134f8..7cde68f 100644 --- a/skate/reduce_test.go +++ b/skate/reduce_test.go @@ -199,7 +199,7 @@ func TestMatchedRefsExtend(t *testing.T) { MatchReason: ReasonUnknown.Short(), SourceYear: "0", TargetCSL: &CSL{ - Accessed: CSLDate{}, + Accessed: nil, Author: nil, CollectionTitle: "", ContainerTitle: "", @@ -209,7 +209,7 @@ func TestMatchedRefsExtend(t *testing.T) { ISBN: "", ISSN: "", Issue: "", - Issued: CSLDate{}, + Issued: &CSLDate{}, JournalAbbreviation: "", Language: "", NumberOfPages: "", diff --git a/skate/schema.go b/skate/schema.go index 93c9680..50f52d6 100644 --- a/skate/schema.go +++ b/skate/schema.go @@ -431,7 +431,7 @@ type BiblioRef struct { // https://github.com/citation-style-language/schema, // https://navneethg.github.io/jsonschemaviewer/. This is a subset only. type CSL struct { - Accessed CSLDate `json:"accessed,omitempty"` + Accessed *CSLDate `json:"accessed,omitempty"` Author []CSLAuthor `json:"author,omitempty"` CollectionTitle string `json:"collection-title,omitempty"` ContainerTitle string `json:"container-title,omitempty"` @@ -441,7 +441,7 @@ type CSL struct { ISBN string `json:"ISBN,omitempty"` ISSN string `json:"ISSN,omitempty"` Issue string `json:"issue,omitempty"` - Issued CSLDate `json:"issued,omitempty"` + Issued *CSLDate `json:"issued,omitempty"` JournalAbbreviation string `json:"journalAbbreviation,omitempty"` Language string `json:"language,omitempty"` NumberOfPages string `json:"number-of-pages,omitempty"` |