diff --git a/fields.go b/fields.go index 564df5e6..ff20d27b 100644 --- a/fields.go +++ b/fields.go @@ -138,6 +138,13 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error } } + if publiccodev0.It != nil && publiccodev0.It.Conforme != nil { + vr = append(vr, ValidationWarning{ + "it.conforme", + "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 0, 0, + }) + } + if len(vr) == 0 { return nil } diff --git a/parser_test.go b/parser_test.go index 7a66f582..7939dc69 100644 --- a/parser_test.go +++ b/parser_test.go @@ -684,6 +684,9 @@ func TestValidWithWarningsTestcasesV0(t *testing.T) { ValidationWarning{"inputTypes", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 48, 1}, ValidationWarning{"outputTypes", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 50, 1}, }, + "valid_with_it_conforme.yml": ValidationResults{ + ValidationWarning{"it.conforme", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 120, 3}, + }, } dir := "testdata/v0/valid_with_warnings/" diff --git a/testdata/v0/invalid/landingURL_invalid.yml b/testdata/v0/invalid/landingURL_invalid.yml index f1a774ee..4e5df90a 100644 --- a/testdata/v0/invalid/landingURL_invalid.yml +++ b/testdata/v0/invalid/landingURL_invalid.yml @@ -40,34 +40,34 @@ description: localisedName: Medusa shortDescription: "A really interesting software." 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. + 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. documentation: "https://docs.italia.it" apiDocumentation: "https://developers.italia.it/it/api" features: - - Very important feature - - Will run without a problem - - Has zero bugs - - Solves all the problems of the world - videos: # Demo videos of the software - - https://www.youtube.com/watch?v=RaHmGbBOP84 + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world + videos: # Demo videos of the software + - https://www.youtube.com/watch?v=RaHmGbBOP84 awards: - - 1st Price Software of the year + - 1st Price Software of the year legal: - license: AGPL-3.0-or-later # SPDX expression of license + license: AGPL-3.0-or-later # SPDX expression of license mainCopyrightOwner: City of Chicago repoOwner: City of Chicago @@ -119,12 +119,6 @@ dependsOn: optional: true it: - conforme: - lineeGuidaDesign: true - modelloInteroperabilita: true - misureMinimeSicurezza: true - gdpr: true - riuso: codiceIPA: c_h501 diff --git a/testdata/v0/invalid/landingURL_wrong_type.yml b/testdata/v0/invalid/landingURL_wrong_type.yml index ba2fda2e..e6b2527b 100644 --- a/testdata/v0/invalid/landingURL_wrong_type.yml +++ b/testdata/v0/invalid/landingURL_wrong_type.yml @@ -40,30 +40,30 @@ description: localisedName: Medusa shortDescription: "A really interesting software." 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. + 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. documentation: "https://docs.italia.it" apiDocumentation: "https://developers.italia.it/it/api" features: - - Very important feature - - Will run without a problem - - Has zero bugs - - Solves all the problems of the world + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world legal: - license: AGPL-3.0-or-later # SPDX expression of license + license: AGPL-3.0-or-later # SPDX expression of license mainCopyrightOwner: City of Chicago repoOwner: City of Chicago @@ -115,12 +115,6 @@ dependsOn: optional: true it: - conforme: - lineeGuidaDesign: true - modelloInteroperabilita: true - misureMinimeSicurezza: true - gdpr: true - riuso: codiceIPA: c_h501 diff --git a/testdata/v0/invalid/no-network/landingURL_invalid.yml b/testdata/v0/invalid/no-network/landingURL_invalid.yml index f1a774ee..4e5df90a 100644 --- a/testdata/v0/invalid/no-network/landingURL_invalid.yml +++ b/testdata/v0/invalid/no-network/landingURL_invalid.yml @@ -40,34 +40,34 @@ description: localisedName: Medusa shortDescription: "A really interesting software." 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. + 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. documentation: "https://docs.italia.it" apiDocumentation: "https://developers.italia.it/it/api" features: - - Very important feature - - Will run without a problem - - Has zero bugs - - Solves all the problems of the world - videos: # Demo videos of the software - - https://www.youtube.com/watch?v=RaHmGbBOP84 + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world + videos: # Demo videos of the software + - https://www.youtube.com/watch?v=RaHmGbBOP84 awards: - - 1st Price Software of the year + - 1st Price Software of the year legal: - license: AGPL-3.0-or-later # SPDX expression of license + license: AGPL-3.0-or-later # SPDX expression of license mainCopyrightOwner: City of Chicago repoOwner: City of Chicago @@ -119,12 +119,6 @@ dependsOn: optional: true it: - conforme: - lineeGuidaDesign: true - modelloInteroperabilita: true - misureMinimeSicurezza: true - gdpr: true - riuso: codiceIPA: c_h501 diff --git a/testdata/v0/valid/countryExtensionVersion_1.0.yml b/testdata/v0/valid/countryExtensionVersion_1.0.yml index b64e0c94..bd959367 100644 --- a/testdata/v0/valid/countryExtensionVersion_1.0.yml +++ b/testdata/v0/valid/countryExtensionVersion_1.0.yml @@ -38,31 +38,31 @@ description: localisedName: Medusa shortDescription: "A really interesting software." 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. + 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. documentation: "https://docs.italia.it" apiDocumentation: "https://developers.italia.it/it/api" features: - - Very important feature - - Will run without a problem - - Has zero bugs - - Solves all the problems of the world + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world videos: - - https://www.youtube.com/watch?v=RaHmGbBOP84 + - https://www.youtube.com/watch?v=RaHmGbBOP84 awards: - - 1st Price Software of the year + - 1st Price Software of the year legal: license: AGPL-3.0-or-later @@ -74,7 +74,7 @@ maintenance: contacts: - email: mrossi@cittametropolitana.it name: Mario Rossi - phone: '+390412501953' + phone: "+390412501953" localisation: localisationReady: true @@ -106,11 +106,6 @@ dependsOn: it: countryExtensionVersion: "1.0" - conforme: - lineeGuidaDesign: false - modelloInteroperabilita: false - misureMinimeSicurezza: false - gdpr: false riuso: codiceIPA: c_h501 diff --git a/testdata/v0/valid/dependsOn.yml b/testdata/v0/valid/dependsOn.yml index cb6b9687..b08422d8 100644 --- a/testdata/v0/valid/dependsOn.yml +++ b/testdata/v0/valid/dependsOn.yml @@ -2,15 +2,15 @@ publiccodeYmlVersion: "0.4" name: Medusa applicationSuite: MegaProductivitySuite -url: "https://github.com/italia/developers.italia.it.git" # URL of this repository +url: "https://github.com/italia/developers.italia.it.git" # URL of this repository landingURL: "https://developers.italia.it" -isBasedOn: "https://github.com/italia/developers.italia.it.git" # The original repository, "Otello" -softwareVersion: "1.0" # Last stable version -releaseDate: 2017-04-15 # Date of last stable software release +isBasedOn: "https://github.com/italia/developers.italia.it.git" # The original repository, "Otello" +softwareVersion: "1.0" # Last stable version +releaseDate: 2017-04-15 # Date of last stable software release # monochromeLogo: assets/icons/dt-logo.svg -platforms: # or Windows, Mac, Linux, etc. +platforms: # or Windows, Mac, Linux, etc. - android - ios @@ -31,7 +31,7 @@ intendedAudience: countries: - it - de - unsupportedCountries: # Explicitly unsupported countries + unsupportedCountries: # Explicitly unsupported countries - us description: @@ -39,34 +39,34 @@ description: localisedName: Medusa shortDescription: "A really interesting software." 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. + 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. documentation: "https://docs.italia.it" apiDocumentation: "https://developers.italia.it/it/api" features: - - Very important feature - - Will run without a problem - - Has zero bugs - - Solves all the problems of the world - videos: # Demo videos of the software - - https://www.youtube.com/watch?v=RaHmGbBOP84 + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world + videos: # Demo videos of the software + - https://www.youtube.com/watch?v=RaHmGbBOP84 awards: - - 1st Price Software of the year + - 1st Price Software of the year legal: - license: AGPL-3.0-or-later # SPDX expression of license + license: AGPL-3.0-or-later # SPDX expression of license mainCopyrightOwner: City of Chicago repoOwner: City of Chicago @@ -75,7 +75,7 @@ maintenance: contacts: - email: mrossi@cittametropolitana.it name: Mario Rossi - phone: '+390412501953' + phone: "+390412501953" localisation: # Does the software support, at least by design, multiple languages? @@ -87,8 +87,8 @@ localisation: - fra - deu -dependsOn: # List of dependencies. The only mandatory list is the proprietary one - open: # List of open dependencies. Optional +dependsOn: # List of dependencies. The only mandatory list is the proprietary one + open: # List of open dependencies. Optional - name: MySQL versionMin: "1.1" versionMax: "1.3" @@ -100,7 +100,7 @@ dependsOn: # List of dependencies. The only mandatory list is the pr proprietary: - name: Oracle versionMin: "11.4" - hardware: # List of special hardware required. Optional. + hardware: # List of special hardware required. Optional. - name: NFC Reader optional: true - name: NFC Reader1 @@ -108,14 +108,8 @@ dependsOn: # List of dependencies. The only mandatory list is the pr - name: NFC Reader2 optional: true -# IT: Italian extension. it: countryExtensionVersion: "0.2" - conforme: - lineeGuidaDesign: false - modelloInteroperabilita: false - misureMinimeSicurezza: false - gdpr: false riuso: # Codice IPA della PA che ha pubblicato questo repo (repo-owner) diff --git a/testdata/v0/valid/no-network/valid.yml b/testdata/v0/valid/no-network/valid.yml index 5f5104af..5ac05295 100644 --- a/testdata/v0/valid/no-network/valid.yml +++ b/testdata/v0/valid/no-network/valid.yml @@ -227,12 +227,6 @@ dependsOn: optional: true it: - conforme: - lineeGuidaDesign: true - modelloInteroperabilita: true - misureMinimeSicurezza: true - gdpr: true - riuso: codiceIPA: c_h501 diff --git a/testdata/v0/valid/valid.yml b/testdata/v0/valid/valid.yml index d06dc8ae..739a097c 100644 --- a/testdata/v0/valid/valid.yml +++ b/testdata/v0/valid/valid.yml @@ -226,12 +226,6 @@ dependsOn: optional: true it: - conforme: - lineeGuidaDesign: true - modelloInteroperabilita: true - misureMinimeSicurezza: true - gdpr: true - riuso: codiceIPA: c_h501 diff --git a/testdata/v0/valid/valid_no_it_conforme.yml b/testdata/v0/valid/valid_no_it_conforme.yml new file mode 100644 index 00000000..086ce5dc --- /dev/null +++ b/testdata/v0/valid/valid_no_it_conforme.yml @@ -0,0 +1,125 @@ +publiccodeYmlVersion: "0.4" + +name: Medusa +applicationSuite: MegaProductivitySuite +url: "https://github.com/italia/developers.italia.it.git" +landingURL: "https://developers.italia.it" + +isBasedOn: "https://github.com/italia/developers.italia.it.git" +softwareVersion: "1.0" +releaseDate: 2017-04-15 + +platforms: + - android + - ios + +categories: + - cloud-management + +usedBy: + - Comune di Firenze + - Comune di Roma + +roadmap: "https://designers.italia.it/roadmap/" + +developmentStatus: development + +softwareType: "standalone/other" + +intendedAudience: + countries: + - it + - de + unsupportedCountries: + - us + +description: + en: + localisedName: Medusa + shortDescription: "A really interesting software." + 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. + + documentation: "https://docs.italia.it" + apiDocumentation: "https://developers.italia.it/it/api" + + features: + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world + videos: + - https://www.youtube.com/watch?v=RaHmGbBOP84 + awards: + - 1st Price Software of the year + +legal: + license: AGPL-3.0-or-later + mainCopyrightOwner: City of Chicago + repoOwner: City of Chicago + +maintenance: + type: "community" + contacts: + - email: mrossi@cittametropolitana.it + name: Mario Rossi + phone: "+390412501953" + +localisation: + localisationReady: true + availableLanguages: + - en + - ita + - fra + - deu + +dependsOn: + open: + - name: MySQL + versionMin: "1.1" + versionMax: "1.3" + optional: true + - name: PostgreSQL + version: "3.2" + optional: true + proprietary: + - name: Oracle + versionMin: "11.4" + hardware: + - name: NFC Reader + optional: true + - name: NFC Reader1 + optional: true + - name: NFC Reader2 + optional: true + +it: + countryExtensionVersion: "1.0" + + # No `conforme`: should be still valid and its fields set to null + # conforme: + # lineeGuidaDesign: false + # modelloInteroperabilita: false + # misureMinimeSicurezza: false + # gdpr: false + + riuso: + codiceIPA: c_h501 + + piattaforme: + spid: false + pagopa: false + # No `cie`: should still be valid and be set to null + # cie: + anpr: false diff --git a/testdata/v0/valid_with_warnings/no-network/authorsFile.yml b/testdata/v0/valid_with_warnings/no-network/authorsFile.yml index 214ba20c..7bf1181e 100644 --- a/testdata/v0/valid_with_warnings/no-network/authorsFile.yml +++ b/testdata/v0/valid_with_warnings/no-network/authorsFile.yml @@ -109,14 +109,8 @@ dependsOn: # List of dependencies. The only mandatory list is the proprietary on - name: NFC Reader2 optional: true -# IT: Italian extension. it: countryExtensionVersion: "0.2" - conforme: - lineeGuidaDesign: false - modelloInteroperabilita: false - misureMinimeSicurezza: false - gdpr: false riuso: # Codice IPA della PA che ha pubblicato questo repo (repo-owner) diff --git a/testdata/v0/valid_with_warnings/valid_with_it_conforme.yml b/testdata/v0/valid_with_warnings/valid_with_it_conforme.yml new file mode 100644 index 00000000..43bef6f2 --- /dev/null +++ b/testdata/v0/valid_with_warnings/valid_with_it_conforme.yml @@ -0,0 +1,134 @@ +publiccodeYmlVersion: "0.4" + +name: Medusa +applicationSuite: MegaProductivitySuite +url: "https://github.com/italia/developers.italia.it.git" + +isBasedOn: "https://github.com/italia/developers.italia.it.git" +softwareVersion: "1.0" +releaseDate: 2017-04-15 + +platforms: + - android + - ios + +categories: + - cloud-management + +usedBy: + - Comune di Firenze + - Comune di Roma + +roadmap: "https://designers.italia.it/roadmap/" + +developmentStatus: development + +softwareType: "standalone/other" + +intendedAudience: + countries: + - it + - de + unsupportedCountries: + - us + +description: + en: + localisedName: Medusa + shortDescription: "A really interesting software." + 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. + + documentation: "https://docs.italia.it" + apiDocumentation: "https://developers.italia.it/it/api" + + features: + - Very important feature + - Will run without a problem + - Has zero bugs + - Solves all the problems of the world + videos: # Demo videos of the software + - https://www.youtube.com/watch?v=RaHmGbBOP84 + awards: + - 1st Price Software of the year + +legal: + license: AGPL-3.0-or-later # SPDX expression of license + mainCopyrightOwner: City of Chicago + repoOwner: City of Chicago + +maintenance: + type: "contract" + + contractors: + - name: "Fornitore Privato SPA" # if maintainance is a contract + website: "https://developers.italia.it" + until: "2019-01-01" + + contacts: + - name: Francesco Rossi + email: "francesco.rossi@comune.reggioemilia.it" + affiliation: Comune di Reggio Emilia + phone: +39 231 13215112 + - name: Dario Bianchi + email: "dario.bianchi@fornitore.it" + affiliation: Fornitore Privato S.P.A. + phone: +39 16 24231322 + - name: Giancarlo Verdi + email: "dario.bianchi@fornitore.it" + affiliation: Fornitore Privato S.P.A. + phone: +39 16 24231322 + +localisation: + localisationReady: true + availableLanguages: + - en + - ita + - fra + - deu + +dependsOn: + open: + - name: MySQL + versionMin: "1.1" + versionMax: "1.3" + optional: true + - name: PostgreSQL + version: "3.2" + optional: true + proprietary: + - name: Oracle + versionMin: "11.4" + - name: IBM SoftLayer + hardware: + - name: NFC Reader + optional: true + +it: + # Should have warnings for it.conforme, because it is deprecated + conforme: + lineeGuidaDesign: true + modelloInteroperabilita: true + misureMinimeSicurezza: true + # Fields can also be nil + # gdpr: + + riuso: + codiceIPA: c_h501 + + piattaforme: + spid: true + pagopa: true + cie: true + anpr: true diff --git a/v0.go b/v0.go index 2628c44d..d19f46cd 100644 --- a/v0.go +++ b/v0.go @@ -78,7 +78,7 @@ type PublicCodeV0 struct { Hardware *[]DependencyV0 `json:"hardware,omitempty" validate:"omitempty,dive" yaml:"hardware,omitempty"` } `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"` - It ITSectionV0 `json:"it" yaml:"it"` + It *ITSectionV0 `json:"it,omitempty" yaml:"it,omitempty"` } // DescV0 is a general description of the software. @@ -129,12 +129,12 @@ type DependencyV0 struct { type ITSectionV0 struct { CountryExtensionVersion *string `json:"countryExtensionVersion" validate:"omitnil,oneof=0.2 1.0" yaml:"countryExtensionVersion"` - Conforme struct { - LineeGuidaDesign bool `json:"lineeGuidaDesign,omitempty" yaml:"lineeGuidaDesign,omitempty"` - ModelloInteroperabilita bool `json:"modelloInteroperabilita" yaml:"modelloInteroperabilita"` - MisureMinimeSicurezza bool `json:"misureMinimeSicurezza" yaml:"misureMinimeSicurezza"` - GDPR bool `json:"gdpr" yaml:"gdpr"` - } `yaml:"conforme" json:"conforme"` + Conforme *struct { + LineeGuidaDesign *bool `json:"lineeGuidaDesign,omitempty" yaml:"lineeGuidaDesign,omitempty"` + ModelloInteroperabilita *bool `json:"modelloInteroperabilita,omitempty" yaml:"modelloInteroperabilita,omitempty"` + MisureMinimeSicurezza *bool `json:"misureMinimeSicurezza,omitempty" yaml:"misureMinimeSicurezza,omitempty"` + GDPR *bool `json:"gdpr,omitempty" yaml:"gdpr,omitempty"` + } `json:"conforme,omitempty" yaml:"conforme,omitempty"` Riuso struct { CodiceIPA string `json:"codiceIPA,omitempty" validate:"omitempty,is_italian_ipa_code" yaml:"codiceIPA,omitempty"`