xref: /aosp_15_r20/external/spdx-tools/spdx/v2_1/snippet.go (revision ba677afa8f67bb56cbc794f4d0e378e0da058e16)
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package v2_1
4
5import "github.com/spdx/tools-golang/spdx/common"
6
7// Snippet is a Snippet section of an SPDX Document for version 2.1 of the spec.
8type Snippet struct {
9
10	// 5.1: Snippet SPDX Identifier: "SPDXRef-[idstring]"
11	// Cardinality: mandatory, one
12	SnippetSPDXIdentifier common.ElementID `json:"SPDXID"`
13
14	// 5.2: Snippet from File SPDX Identifier
15	// Cardinality: mandatory, one
16	SnippetFromFileSPDXIdentifier common.ElementID `json:"snippetFromFile"`
17
18	// Ranges denotes the start/end byte offsets or line numbers that the snippet is relevant to
19	Ranges []common.SnippetRange `json:"ranges"`
20
21	// 5.5: Snippet Concluded License: SPDX License Expression, "NONE" or "NOASSERTION"
22	// Cardinality: mandatory, one
23	SnippetLicenseConcluded string `json:"licenseConcluded"`
24
25	// 5.6: License Information in Snippet: SPDX License Expression, "NONE" or "NOASSERTION"
26	// Cardinality: optional, one or many
27	LicenseInfoInSnippet []string `json:"licenseInfoInSnippets,omitempty"`
28
29	// 5.7: Snippet Comments on License
30	// Cardinality: optional, one
31	SnippetLicenseComments string `json:"licenseComments,omitempty"`
32
33	// 5.8: Snippet Copyright Text: copyright notice(s) text, "NONE" or "NOASSERTION"
34	// Cardinality: mandatory, one
35	SnippetCopyrightText string `json:"copyrightText"`
36
37	// 5.9: Snippet Comment
38	// Cardinality: optional, one
39	SnippetComment string `json:"comment,omitempty"`
40
41	// 5.10: Snippet Name
42	// Cardinality: optional, one
43	SnippetName string `json:"name,omitempty"`
44}
45