Skip to content

Commit 170c942

Browse files
committed
feat: make categories optional and add other
See publiccodeyml/publiccode.yml#241
1 parent 2f2e90e commit 170c942

File tree

10 files changed

+212
-167
lines changed

10 files changed

+212
-167
lines changed

parser_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,6 @@ func TestInvalidTestcasesV0(t *testing.T) {
326326
},
327327

328328
// categories
329-
"categories_missing.yml": ValidationResults{
330-
ValidationError{"categories", "categories is a required field", 1, 1},
331-
},
332-
"categories_nil.yml": ValidationResults{
333-
ValidationError{"categories", "categories is a required field", 12, 1},
334-
},
335-
"categories_empty.yml": ValidationResults{
336-
ValidationError{"categories", "categories must contain more than 0 items", 12, 1},
337-
},
338329
"categories_invalid.yml": ValidationResults{ValidationError{"categories[0]", "categories[0] must be a valid category (see https://github.com/publiccodeyml/publiccode.yml/blob/main/docs/standard/categories-list.rst)", 1, 1}},
339330

340331
// usedBy
@@ -620,7 +611,6 @@ func TestInvalidTestcasesV0(t *testing.T) {
620611
ValidationError{"name", "name is a required field", 1, 1},
621612
ValidationError{"url", "url is a required field", 1, 1},
622613
ValidationError{"platforms", "platforms must contain more than 0 items", 1, 1},
623-
ValidationError{"categories", "categories is a required field", 1, 1},
624614
ValidationError{"developmentStatus", "developmentStatus is a required field", 1, 1},
625615
ValidationError{"softwareType", "softwareType is a required field", 1, 1},
626616
ValidationError{"description[en-US].shortDescription", "shortDescription is a required field", 0, 0},

testdata/v0/invalid/categories_empty.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

testdata/v0/invalid/categories_missing.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

testdata/v0/invalid/categories_nil.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
publiccodeYmlVersion: "0.4"
2+
3+
name: Medusa
4+
url: "https://github.com/italia/developers.italia.it.git"
5+
softwareVersion: "dev"
6+
releaseDate: "2017-04-15"
7+
8+
platforms:
9+
- web
10+
11+
# Should validate even if categories is empty
12+
categories: []
13+
14+
developmentStatus: development
15+
16+
softwareType: "standalone/other"
17+
18+
description:
19+
en:
20+
localisedName: Medusa
21+
shortDescription: >
22+
A rather short description which
23+
is probably useless
24+
longDescription: >
25+
Very long description of this software, also split
26+
on multiple rows. You should note what the software
27+
is and why one should need it. This is 158 characters.
28+
Very long description of this software, also split
29+
on multiple rows. You should note what the software
30+
is and why one should need it. This is 316 characters.
31+
Very long description of this software, also split
32+
on multiple rows. You should note what the software
33+
is and why one should need it. This is 474 characters.
34+
Very long description of this software, also split
35+
on multiple rows. You should note what the software
36+
is and why one should need it. This is 632 characters.
37+
features:
38+
- Just one feature
39+
40+
legal:
41+
license: AGPL-3.0-or-later
42+
43+
maintenance:
44+
type: "community"
45+
46+
contacts:
47+
- name: Francesco Rossi
48+
49+
localisation:
50+
localisationReady: true
51+
availableLanguages:
52+
- en
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
publiccodeYmlVersion: "0.4"
2+
3+
name: Medusa
4+
url: "https://github.com/italia/developers.italia.it.git"
5+
softwareVersion: "dev"
6+
releaseDate: "2017-04-15"
7+
8+
platforms:
9+
- web
10+
11+
# Should validate even if categories is missing
12+
# categories:
13+
14+
developmentStatus: development
15+
16+
softwareType: "standalone/other"
17+
18+
description:
19+
en:
20+
localisedName: Medusa
21+
shortDescription: >
22+
A rather short description which
23+
is probably useless
24+
longDescription: >
25+
Very long description of this software, also split
26+
on multiple rows. You should note what the software
27+
is and why one should need it. This is 158 characters.
28+
Very long description of this software, also split
29+
on multiple rows. You should note what the software
30+
is and why one should need it. This is 316 characters.
31+
Very long description of this software, also split
32+
on multiple rows. You should note what the software
33+
is and why one should need it. This is 474 characters.
34+
Very long description of this software, also split
35+
on multiple rows. You should note what the software
36+
is and why one should need it. This is 632 characters.
37+
features:
38+
- Just one feature
39+
40+
legal:
41+
license: AGPL-3.0-or-later
42+
43+
maintenance:
44+
type: "community"
45+
46+
contacts:
47+
- name: Francesco Rossi
48+
49+
localisation:
50+
localisationReady: true
51+
availableLanguages:
52+
- en
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
publiccodeYmlVersion: "0.4"
2+
3+
name: Medusa
4+
url: "https://github.com/italia/developers.italia.it.git"
5+
softwareVersion: "dev"
6+
releaseDate: "2017-04-15"
7+
8+
platforms:
9+
- web
10+
11+
# Should validate even if categories is nil
12+
categories:
13+
14+
developmentStatus: development
15+
16+
softwareType: "standalone/other"
17+
18+
description:
19+
en:
20+
localisedName: Medusa
21+
shortDescription: >
22+
A rather short description which
23+
is probably useless
24+
longDescription: >
25+
Very long description of this software, also split
26+
on multiple rows. You should note what the software
27+
is and why one should need it. This is 158 characters.
28+
Very long description of this software, also split
29+
on multiple rows. You should note what the software
30+
is and why one should need it. This is 316 characters.
31+
Very long description of this software, also split
32+
on multiple rows. You should note what the software
33+
is and why one should need it. This is 474 characters.
34+
Very long description of this software, also split
35+
on multiple rows. You should note what the software
36+
is and why one should need it. This is 632 characters.
37+
features:
38+
- Just one feature
39+
40+
legal:
41+
license: AGPL-3.0-or-later
42+
43+
maintenance:
44+
type: "community"
45+
46+
contacts:
47+
- name: Francesco Rossi
48+
49+
localisation:
50+
localisationReady: true
51+
availableLanguages:
52+
- en
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
publiccodeYmlVersion: "0.4"
2+
3+
name: Medusa
4+
url: "https://github.com/italia/developers.italia.it.git"
5+
softwareVersion: "dev"
6+
releaseDate: "2017-04-15"
7+
8+
platforms:
9+
- web
10+
11+
# Should validate with "other" category
12+
categories:
13+
- other
14+
15+
developmentStatus: development
16+
17+
softwareType: "standalone/other"
18+
19+
description:
20+
en:
21+
localisedName: Medusa
22+
shortDescription: >
23+
A rather short description which
24+
is probably useless
25+
longDescription: >
26+
Very long description of this software, also split
27+
on multiple rows. You should note what the software
28+
is and why one should need it. This is 158 characters.
29+
Very long description of this software, also split
30+
on multiple rows. You should note what the software
31+
is and why one should need it. This is 316 characters.
32+
Very long description of this software, also split
33+
on multiple rows. You should note what the software
34+
is and why one should need it. This is 474 characters.
35+
Very long description of this software, also split
36+
on multiple rows. You should note what the software
37+
is and why one should need it. This is 632 characters.
38+
features:
39+
- Just one feature
40+
41+
legal:
42+
license: AGPL-3.0-or-later
43+
44+
maintenance:
45+
type: "community"
46+
47+
contacts:
48+
- name: Francesco Rossi
49+
50+
localisation:
51+
localisationReady: true
52+
availableLanguages:
53+
- en

0 commit comments

Comments
 (0)