From 1b9eb2eddf322560c37efa2ef2eb63d5ab661be8 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 2 Feb 2022 01:54:19 -0500 Subject: internal/feed: add Vector#MarshalJSON and tests --- internal/feed/vector.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/feed/vector.go') diff --git a/internal/feed/vector.go b/internal/feed/vector.go index a326c85..9e75de7 100644 --- a/internal/feed/vector.go +++ b/internal/feed/vector.go @@ -12,7 +12,7 @@ type Vector struct { Vector cvss.Vector } -// Unmarshal CVSS score from JSON. +// Unmarshal CVSS vector from JSON. func (me *Vector) UnmarshalJSON(b []byte) error { // decode string, check for error var s string @@ -32,3 +32,8 @@ func (me *Vector) UnmarshalJSON(b []byte) error { // return success return nil } + +// Marshal CVSS vector to JSON. +func (me Vector) MarshalJSON() ([]byte, error) { + return json.Marshal(me.Vector.String()) +} -- cgit v1.2.3