xref: /aosp_15_r20/external/spdx-tools/spdx/v2_2/file.go (revision ba677afa8f67bb56cbc794f4d0e378e0da058e16)
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package v2_2
4
5import "github.com/spdx/tools-golang/spdx/common"
6
7// File is a File section of an SPDX Document for version 2.2 of the spec.
8type File struct {
9	// 8.1: File Name
10	// Cardinality: mandatory, one
11	FileName string `json:"fileName"`
12
13	// 8.2: File SPDX Identifier: "SPDXRef-[idstring]"
14	// Cardinality: mandatory, one
15	FileSPDXIdentifier common.ElementID `json:"SPDXID"`
16
17	// 8.3: File Types
18	// Cardinality: optional, multiple
19	FileTypes []string `json:"fileTypes,omitempty"`
20
21	// 8.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	// 8.5: Concluded License: SPDX License Expression, "NONE" or "NOASSERTION"
26	// Cardinality: mandatory, one
27	LicenseConcluded string `json:"licenseConcluded"`
28
29	// 8.6: License Information in File: SPDX License Expression, "NONE" or "NOASSERTION"
30	// Cardinality: mandatory, one or many
31	LicenseInfoInFiles []string `json:"licenseInfoInFiles"`
32
33	// 8.7: Comments on License
34	// Cardinality: optional, one
35	LicenseComments string `json:"licenseComments,omitempty"`
36
37	// 8.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	// 8.9-8.11: Artifact of Project variables (defined below)
43	// Cardinality: optional, one or many
44	ArtifactOfProjects []*ArtifactOfProject `json:"-"`
45
46	// 8.12: File Comment
47	// Cardinality: optional, one
48	FileComment string `json:"comment,omitempty"`
49
50	// 8.13: File Notice
51	// Cardinality: optional, one
52	FileNotice string `json:"noticeText,omitempty"`
53
54	// 8.14: File Contributor
55	// Cardinality: optional, one or many
56	FileContributors []string `json:"fileContributors,omitempty"`
57
58	// 8.15: File Attribution Text
59	// Cardinality: optional, one or many
60	FileAttributionTexts []string `json:"attributionTexts,omitempty"`
61
62	// DEPRECATED in version 2.0 of spec
63	// 8.16: File Dependencies
64	// Cardinality: optional, one or many
65	FileDependencies []string `json:"-"`
66
67	// Snippets contained in this File
68	// Note that Snippets could be defined in a different Document! However,
69	// the only ones that _THIS_ document can contain are this ones that are
70	// defined here -- so this should just be an ElementID.
71	Snippets map[common.ElementID]*Snippet `json:"-"`
72
73	Annotations []Annotation `json:"annotations,omitempty"`
74}
75
76// ArtifactOfProject is a DEPRECATED collection of data regarding
77// a Package, as defined in sections 8.9-8.11 in version 2.2 of the spec.
78type ArtifactOfProject struct {
79
80	// DEPRECATED in version 2.1 of spec
81	// 8.9: Artifact of Project Name
82	// Cardinality: conditional, required if present, one per AOP
83	Name string
84
85	// DEPRECATED in version 2.1 of spec
86	// 8.10: Artifact of Project Homepage: URL or "UNKNOWN"
87	// Cardinality: optional, one per AOP
88	HomePage string
89
90	// DEPRECATED in version 2.1 of spec
91	// 8.11: Artifact of Project Uniform Resource Identifier
92	// Cardinality: optional, one per AOP
93	URI string
94}
95