forked from italia/publiccode-parser-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpubliccode.go
More file actions
170 lines (143 loc) · 6.12 KB
/
Copy pathpubliccode.go
File metadata and controls
170 lines (143 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package publiccode
import (
"net/url"
"time"
)
var mandatoryKeys = []string{
"publiccodeYmlVersion",
"name",
"url",
"developmentStatus",
"releaseDate",
"platforms",
"categories",
"softwareType",
"legal/license",
"maintenance/type",
"localisation/localisationReady",
"localisation/availableLanguages",
}
// list of keys that were renamed in the publiccode.yml spec
var renamedKeys = map[string]string{
"publiccode-yaml-version": "publiccodeYmlVersion",
"it/conforme/accessibile": "it/conforme/lineeGuidaDesign",
"it/conforme/interoperabile": "it/conforme/modelloInteroperabilita",
"it/conforme/sicuro": "it/conforme/misureMinimeSicurezza",
"it/conforme/privacy": "it/conforme/gdpr",
"it/spid": "it/piattaforme/spid",
"it/pagopa": "it/piattaforme/pagopa",
"it/cie": "it/piattaforme/cie",
"it/anpr": "it/piattaforme/anpr",
}
// list of keys that were removed from the publiccode.yml spec
var removedKeys = []string{
"tags", // deprecated in it:0.2
"intendedAudience/onlyFor", // deprecated in it:0.2
"it/designKit/seo", // deprecated in it:0.2
"it/designKit/ui", // deprecated in it:0.2
"it/designKit/web", // deprecated in it:0.2
"it/designKit/content", // deprecated in it:0.2
"it/ecosistemi", // deprecated in it:0.2
}
// Version of the latest PublicCode specs.
// Source https://github.com/publiccodenet/publiccode.yml
const Version = "0.2"
// SupportedVersions lists the publiccode.yml versions this parser supports.
var SupportedVersions = []string{"0.1", "0.2"}
// PublicCode is a publiccode.yml file definition.
// Reference: https://github.com/publiccodenet/publiccode.yml
type PublicCode struct {
PubliccodeYamlVersion string `yaml:"publiccodeYmlVersion"`
Name string `yaml:"name"`
ApplicationSuite string `yaml:"applicationSuite,omitempty"`
URL *url.URL `yaml:"-"`
URLString string `yaml:"url"`
LandingURL *url.URL `yaml:"-"`
LandingURLString string `yaml:"landingURL,omitempty"`
IsBasedOn []string `yaml:"isBasedOn,omitempty"`
SoftwareVersion string `yaml:"softwareVersion,omitempty"`
ReleaseDate time.Time `yaml:"-"`
ReleaseDateString string `yaml:"releaseDate"`
Logo string `yaml:"logo,omitempty"`
MonochromeLogo string `yaml:"monochromeLogo,omitempty"`
InputTypes []string `yaml:"inputTypes,omitempty"`
OutputTypes []string `yaml:"outputTypes,omitempty"`
Platforms []string `yaml:"platforms"`
Categories []string `yaml:"categories"`
UsedBy []string `yaml:"usedBy,omitempty"`
Roadmap *url.URL `yaml:"-"`
RoadmapString string `yaml:"roadmap,omitempty"`
DevelopmentStatus string `yaml:"developmentStatus"`
SoftwareType string `yaml:"softwareType"`
IntendedAudience struct {
Scope []string `yaml:"scope,omitempty"`
Countries []string `yaml:"countries,omitempty"`
UnsupportedCountries []string `yaml:"unsupportedCountries,omitempty"`
} `yaml:"intendedAudience"`
Description map[string]Desc `yaml:"description"`
Legal struct {
License string `yaml:"license"`
MainCopyrightOwner string `yaml:"mainCopyrightOwner,omitempty"`
RepoOwner string `yaml:"repoOwner,omitempty"`
AuthorsFile string `yaml:"authorsFile,omitempty"`
} `yaml:"legal"`
Maintenance struct {
Type string `yaml:"type"`
Contractors []Contractor `yaml:"contractors,omitempty"`
Contacts []Contact `yaml:"contacts,omitempty"`
} `yaml:"maintenance"`
Localisation struct {
LocalisationReady bool `yaml:"localisationReady"`
AvailableLanguages []string `yaml:"availableLanguages"`
} `yaml:"localisation"`
DependsOn struct {
Open []Dependency `yaml:"open,omitempty"`
Proprietary []Dependency `yaml:"proprietary,omitempty"`
Hardware []Dependency `yaml:"hardware,omitempty"`
} `yaml:"dependsOn,omitempty"`
It ExtensionIT `yaml:"it"`
}
// Desc is a general description of the software.
// Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#section-description
type Desc struct {
LocalisedName string `yaml:"localisedName,omitempty"`
GenericName string `yaml:"genericName"`
ShortDescription string `yaml:"shortDescription"`
LongDescription string `yaml:"longDescription,omitempty"`
Documentation *url.URL `yaml:"-"`
DocumentationString string `yaml:"documentation,omitempty"`
APIDocumentation *url.URL `yaml:"-"`
APIDocumentationString string `yaml:"apiDocumentation,omitempty"`
Features []string `yaml:"features,omitempty"`
Screenshots []string `yaml:"screenshots,omitempty"`
Videos []*url.URL `yaml:"-"`
VideosStrings []string `yaml:"videos,omitempty"`
Awards []string `yaml:"awards,omitempty"`
}
// Contractor is an entity or entities, if any, that are currently contracted for maintaining the software.
// Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#contractor
type Contractor struct {
Name string `yaml:"name"`
Email string `yaml:"email,omitempty"`
Website *url.URL `yaml:"-"`
WebsiteString string `yaml:"website,omitempty"`
Until time.Time `yaml:"-"`
UntilString string `yaml:"until,omitempty"`
}
// Contact is a contact info maintaining the software.
// Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#contact
type Contact struct {
Name string `yaml:"name"`
Email string `yaml:"email,omitempty"`
Affiliation string `yaml:"affiliation,omitempty"`
Phone string `yaml:"phone,omitempty"`
}
// Dependency describe system-level dependencies required to install and use this software.
// Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#section-dependencies
type Dependency struct {
Name string `yaml:"name"`
VersionMin string `yaml:"versionMin"`
VersionMax string `yaml:"versionMax"`
Optional bool `yaml:"optional"`
Version string `yaml:"version"`
}