1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Add category field to ROLIE feed model.

This commit is contained in:
Sascha L. Teichmann 2025-11-19 12:12:43 +01:00
parent 8dd4cb4fa8
commit 5a1c2a0873

View file

@ -9,8 +9,10 @@
package csaf package csaf
import ( import (
"bytes"
"encoding/json" "encoding/json"
"io" "io"
"os"
"sort" "sort"
"time" "time"
@ -169,14 +171,15 @@ type Format struct {
// Entry for ROLIE. // Entry for ROLIE.
type Entry struct { type Entry struct {
ID string `json:"id"` ID string `json:"id"`
Titel string `json:"title"` Titel string `json:"title"`
Link []Link `json:"link"` Link []Link `json:"link"`
Published TimeStamp `json:"published"` Published TimeStamp `json:"published"`
Updated TimeStamp `json:"updated"` Updated TimeStamp `json:"updated"`
Summary *Summary `json:"summary,omitempty"` Summary *Summary `json:"summary,omitempty"`
Content Content `json:"content"` Content Content `json:"content"`
Format Format `json:"format"` Format Format `json:"format"`
Category []ROLIECategory `json:"category,omitempty"`
} }
// FeedData is the content of the ROLIE feed. // FeedData is the content of the ROLIE feed.
@ -196,6 +199,14 @@ type ROLIEFeed struct {
// LoadROLIEFeed loads a ROLIE feed from a reader. // LoadROLIEFeed loads a ROLIE feed from a reader.
func LoadROLIEFeed(r io.Reader) (*ROLIEFeed, error) { func LoadROLIEFeed(r io.Reader) (*ROLIEFeed, error) {
all, err := io.ReadAll(r)
if err != nil {
return nil, err
}
if err := os.WriteFile("rolie.json", all, 060); err != nil {
return nil, err
}
r = bytes.NewReader(all)
var rf ROLIEFeed var rf ROLIEFeed
if err := misc.StrictJSONParse(r, &rf); err != nil { if err := misc.StrictJSONParse(r, &rf); err != nil {
return nil, err return nil, err