xref: /aosp_15_r20/external/spdx-tools/spdx/v2_1/file.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// File is a File section of an SPDX Document for version 2.1 of the spec.
8type File struct {
9	// 4.1: File Name
10	// Cardinality: mandatory, one
11	FileName string `json:"fileName"`
12
13	// 4.2: File SPDX Identifier: "SPDXRef-[idstring]"
14	// Cardinality: mandatory, one
15	FileSPDXIdentifier common.ElementID `json:"SPDXID"`
16
17	// 4.3: File Types
18	// Cardinality: optional, multiple
19	FileTypes []string `json:"fileTypes,omitempty"`
20
21	// 4.4: File Checksum: may have keys for SHA1, SHA256 and/or MD5
22	// Cardinality: mandatory, one SHA1, others may be optionally provided
23	Checksums []common.Checksum `json:"checksums"`
24
25	// 4.5: Concluded License: SPDX License Expression, "NONE" or "NOASSERTION"
26	// Cardinality: mandatory, one
27	LicenseConcluded string `json:"licenseConcluded"`
28
29	// 4.6: License Information in File: SPDX License Expression, "NONE" or "NOASSERTION"
30	// Cardinality: mandatory, one or many
31	LicenseInfoInFiles []string `json:"licenseInfoInFiles"`
32
33	// 4.7: Comments on License
34	// Cardinality: optional, one
35	LicenseComments string `json:"licenseComments,omitempty"`
36
37	// 4.8: Copyright Text: copyright notice(s) text, "NONE" or "NOASSERTION"
38	// Cardinality: mandatory, one
39	FileCopyrightText string `json:"copyrightText"`
40
41	// DEPRECATED in version 2.1 of spec
42	// 4.9-4.11: Artifact of Project variables (defined below)
43	// Cardinality: optional, one or many
44	ArtifactOfProjects []*ArtifactOfProject `json:"-"`
45
46	// 4.12: File Comment
47	// Cardinality: optional, one
48	FileComment string `json:"comment,omitempty"`
49
50	// 4.13: File Notice
51	// Cardinality: optional, one
52	FileNotice string `json:"noticeText,omitempty"`
53
54	// 4.14: File Contributor
55	// Cardinality: optional, one or many
56	FileContributors []string `json:"fileContributors,omitempty"`
57
58	// DEPRECATED in version 2.0 of spec
59	// 4.15: File Dependencies
60	// Cardinality: optional, one or many
61	FileDependencies []string `json:"-"`
62
63	// Snippets contained in this File
64	// Note that Snippets could be defined in a different Document! However,
65	// the only ones that _THIS_ document can contain are the ones that are
66	// defined here -- so this should just be an ElementID.
67	Snippets map[common.ElementID]*Snippet `json:"-"`
68
69	Annotations []Annotation `json:"annotations,omitempty"`
70}
71
72// ArtifactOfProject is a DEPRECATED collection of data regarding
73// a Package, as defined in sections 4.9-4.11 in version 2.1 of the spec.
74type ArtifactOfProject struct {
75
76	// DEPRECATED in version 2.1 of spec
77	// 4.9: Artifact of Project Name
78	// Cardinality: conditional, required if present, one per AOP
79	Name string
80
81	// DEPRECATED in version 2.1 of spec
82	// 4.10: Artifact of Project Homepage: URL or "UNKNOWN"
83	// Cardinality: optional, one per AOP
84	HomePage string
85
86	// DEPRECATED in version 2.1 of spec
87	// 4.11: Artifact of Project Uniform Resource Identifier
88	// Cardinality: optional, one per AOP
89	URI string
90}
91