From e056871d35102950e39b5b776e6d8d99cdab14b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sch=C3=A4fer?= Date: Mon, 15 Apr 2024 15:01:44 +0200 Subject: [PATCH] add yaml as supported data format for data --- pkg/security/types/data_format.go | 7 +++++-- pkg/security/types/data_format_test.go | 4 ++++ support/schema.json | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/security/types/data_format.go b/pkg/security/types/data_format.go index 12e08774..1e8742a6 100644 --- a/pkg/security/types/data_format.go +++ b/pkg/security/types/data_format.go @@ -19,6 +19,7 @@ const ( Serialization File CSV + YAML ) func DataFormatValues() []TypeEnum { @@ -28,6 +29,7 @@ func DataFormatValues() []TypeEnum { Serialization, File, CSV, + YAML, } } @@ -37,6 +39,7 @@ var DataFormatTypeDescription = [...]TypeDescription{ {"serialization", "Serialized program objects"}, {"file", "Specific file types for data"}, {"csv", "CSV"}, + {"yaml", "YAML"}, } func ParseDataFormat(value string) (dataFormat DataFormat, err error) { @@ -59,12 +62,12 @@ func (what DataFormat) Explain() string { } func (what DataFormat) Title() string { - return [...]string{"JSON", "XML", "Serialization", "File", "CSV"}[what] + return [...]string{"JSON", "XML", "Serialization", "File", "CSV", "YAML"}[what] } func (what DataFormat) Description() string { return [...]string{"JSON marshalled object data", "XML structured data", "Serialization-based object graphs", - "File input/uploads", "CSV tabular data"}[what] + "File input/uploads", "CSV tabular data", "YAML structured configuration format"}[what] } type ByDataFormatAcceptedSort []DataFormat diff --git a/pkg/security/types/data_format_test.go b/pkg/security/types/data_format_test.go index 49dcfb60..ace1eb80 100644 --- a/pkg/security/types/data_format_test.go +++ b/pkg/security/types/data_format_test.go @@ -39,6 +39,10 @@ func TestParseDataFormat(t *testing.T) { input: "csv", expected: CSV, }, + "yaml": { + input: "yaml", + expected: YAML, + }, "unknown": { input: "unknown", expectedError: fmt.Errorf("unable to parse into type: unknown"), diff --git a/support/schema.json b/support/schema.json index 1e9b188b..fa9f893c 100644 --- a/support/schema.json +++ b/support/schema.json @@ -570,7 +570,8 @@ "xml", "serialization", "file", - "csv" + "csv", + "yaml" ] } },