diff --git a/testdata/v0/invalid/description_en_features_missing.yml b/testdata/v0/invalid/description_en_features_missing.yml deleted file mode 100644 index 7350a1e..0000000 --- a/testdata/v0/invalid/description_en_features_missing.yml +++ /dev/null @@ -1,52 +0,0 @@ -publiccodeYmlVersion: "0" - -name: Medusa -url: "https://github.com/italia/developers.italia.it.git" -softwareVersion: "dev" -releaseDate: "2017-04-15" - -platforms: - - web - -categories: - - cloud-management - -developmentStatus: development - -softwareType: "standalone/other" - -description: - en: - # Should NOT validate: features is missing - # features: [] - localisedName: Medusa - shortDescription: > - A rather short description which - is probably useless - longDescription: > - Very long description of this software, also split - on multiple rows. You should note what the software - is and why one should need it. This is 158 characters. - Very long description of this software, also split - on multiple rows. You should note what the software - is and why one should need it. This is 316 characters. - Very long description of this software, also split - on multiple rows. You should note what the software - is and why one should need it. This is 474 characters. - Very long description of this software, also split - on multiple rows. You should note what the software - is and why one should need it. This is 632 characters. - -legal: - license: AGPL-3.0-or-later - -maintenance: - type: "community" - - contacts: - - name: Francesco Rossi - -localisation: - localisationReady: true - availableLanguages: - - en diff --git a/testdata/v0/valid/no-network/standard_minimal_example.yml b/testdata/v0/valid/no-network/standard_minimal_example.yml new file mode 100644 index 0000000..bba0dd8 --- /dev/null +++ b/testdata/v0/valid/no-network/standard_minimal_example.yml @@ -0,0 +1,36 @@ +publiccodeYmlVersion: "0" + +name: Medusa +url: "https://example.com/italia/medusa.git" +platforms: + - web + +developmentStatus: development + +softwareType: "standalone/desktop" + +description: + en: + shortDescription: > + A rather short description which + is probably useless + + longDescription: > + Very long description of this software, also split + on multiple rows. You should note what the software + is and why one should need it. We can potentially + have many pages of text here. + +legal: + license: AGPL-3.0-or-later + +maintenance: + type: "community" + + contacts: + - name: Francesco Rossi + +localisation: + localisationReady: true + availableLanguages: + - en diff --git a/v0.go b/v0.go index 07d9203..7faa958 100644 --- a/v0.go +++ b/v0.go @@ -90,7 +90,7 @@ type DescV0 struct { LongDescription string `json:"longDescription,omitempty" validate:"required,umin=150,umax=10000" yaml:"longDescription,omitempty"` Documentation *URL `json:"documentation,omitempty" validate:"omitnil,url_http_url" yaml:"documentation,omitempty"` APIDocumentation *URL `json:"apiDocumentation,omitempty" validate:"omitnil,url_http_url" yaml:"apiDocumentation,omitempty"` - Features *[]string `json:"features,omitempty" validate:"gt=0,dive" yaml:"features,omitempty"` + Features *[]string `json:"features,omitempty" validate:"omitnil,gt=0,dive" yaml:"features,omitempty"` Screenshots []string `json:"screenshots,omitempty" yaml:"screenshots,omitempty"` Videos []*URL `json:"videos,omitempty" validate:"dive,required,url_http_url" yaml:"videos,omitempty"` Awards []string `json:"awards,omitempty" yaml:"awards,omitempty"` diff --git a/v0_test.go b/v0_test.go index 76b0689..076c05e 100644 --- a/v0_test.go +++ b/v0_test.go @@ -385,9 +385,6 @@ func TestInvalidTestcasesV0(t *testing.T) { "description_invalid_language.yml": ValidationResults{ ValidationError{"", "description", "description must be a valid BCP 47 language", 18, 1}, }, - "description_en_features_missing.yml": ValidationResults{ - ValidationError{"", "description.en.features", "features must contain more than 0 items", 22, 5}, - }, "description_en_features_empty.yml": ValidationResults{ ValidationError{"", "description.en.features", "features must contain more than 0 items", 39, 5}, }, @@ -622,7 +619,6 @@ func TestInvalidTestcasesV0(t *testing.T) { ValidationError{"", "softwareType", "softwareType is a required field", 1, 1}, ValidationError{"", "description[en-US].shortDescription", "shortDescription is a required field", 3, 10}, ValidationError{"", "description[en-US].longDescription", "longDescription is a required field", 3, 10}, - ValidationError{"", "description[en-US].features", "features must contain more than 0 items", 3, 10}, ValidationError{"", "legal.license", "license is a required field", 5, 8}, ValidationError{"", "maintenance.type", "type is a required field", 6, 14}, ValidationError{"", "localisation.localisationReady", "localisationReady is a required field", 4, 15},