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:
parent
8dd4cb4fa8
commit
5a1c2a0873
1 changed files with 19 additions and 8 deletions
|
|
@ -9,8 +9,10 @@
|
||||||
package csaf
|
package csaf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -177,6 +179,7 @@ type Entry struct {
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue