Documentation
¶
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Amministrazione
- type Contact
- type Contractor
- type Dependency
- type Desc
- type Domain
- type ExtensionIT
- type ParseError
- type Parser
- type PublicCode
- type URL
- type UrlOrUrlArray
- type ValidationError
- type ValidationErrors
Constants ¶
const Version = "0.2"
Version of the latest PublicCode specs. Source https://github.com/publiccodenet/publiccode.yml
Variables ¶
var ExtensionITSupportedVersions = []string{"0.2"}
ExtensionITSupportedVersions declares the versions of the 'it' extension supported by this parser. We also support legacy publiccode.yml files which did not contain the it/countryExtensionVersion key.
var ExtensionITVersion = "0.2"
ExtensionITVersion declares the latest supported version of the 'it' extension
var SupportedVersions = []string{"0.2", "0.2.2"}
SupportedVersions lists the publiccode.yml versions this parser supports.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Amministrazione ¶
type Amministrazione struct {
CodAmm string
DesAmm string
Comune string
NomeResp string
CognResp string
Cap string
Provincia string
Regione string
SitoIstituzionale string
Indirizzo string
TitoloResp string
TipologiaIstat string
TipologiaAmm string
Acronimo string
CFValidato string
CF string
Mail1 string
TipoMail1 string
Mail2 string
TipoMail2 string
Mail3 string
TipoMail3 string
Mail4 string
TipoMail4 string
Mail5 string
TipoMail5 string
URLFacebook string
URLTwitter string
URLGoogleplus string
URLYoutube string
LivAccessibili string
}
Amministrazione is an row from https://www.indicepa.gov.it/public-services/opendata-read-service.php?dstype=FS&filename=amministrazioni.txt
type Contact ¶
type Contact struct {
Name string `yaml:"name" validate:"required"`
Email *string `yaml:"email,omitempty" validate:"omitempty,email"`
Affiliation *string `yaml:"affiliation,omitempty"`
Phone *string `yaml:"phone,omitempty" validate:"omitempty"`
}
Contact is a contact info maintaining the software. Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#contact
type Contractor ¶
type Contractor struct {
Name string `yaml:"name" validate:"required"`
Email *string `yaml:"email,omitempty" validate:"omitempty,email"`
Website *URL `yaml:"website,omitempty"`
Until string `yaml:"until" validate:"required,date"`
}
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 Dependency ¶
type Dependency struct {
Name string `yaml:"name" validate:"required,gt=0"`
VersionMin *string `yaml:"versionMin,omitempty"`
VersionMax *string `yaml:"versionMax,omitempty"`
Optional *bool `yaml:"optional,omitempty"`
Version *string `yaml:"version,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 Desc ¶
type Desc struct {
LocalisedName *string `yaml:"localisedName,omitempty"`
GenericName string `yaml:"genericName" validate:"required,umax=35"`
ShortDescription string `yaml:"shortDescription" validate:"required,umax=150"`
LongDescription string `yaml:"longDescription,omitempty" validate:"required,umin=500,umax=10000"`
Documentation *URL `yaml:"documentation,omitempty"`
APIDocumentation *URL `yaml:"apiDocumentation,omitempty"`
Features *[]string `yaml:"features,omitempty" validate:"gt=0,dive,umax=100"`
Screenshots []string `yaml:"screenshots,omitempty"`
Videos []*URL `yaml:"videos,omitempty"`
Awards []string `yaml:"awards,omitempty"`
}
Desc is a general description of the software. Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.md#section-description
type Domain ¶
type Domain struct {
// Domains.yml data
Host string `yaml:"host"`
UseTokenFor []string `yaml:"use-token-for"`
BasicAuth []string `yaml:"basic-auth"`
}
Domain is a single code hosting service.
type ExtensionIT ¶
type ExtensionIT struct {
CountryExtensionVersion string `yaml:"countryExtensionVersion"`
Conforme struct {
LineeGuidaDesign bool `yaml:"lineeGuidaDesign,omitempty"`
ModelloInteroperabilita bool `yaml:"modelloInteroperabilita"`
MisureMinimeSicurezza bool `yaml:"misureMinimeSicurezza"`
GDPR bool `yaml:"gdpr"`
} `yaml:"conforme"`
Riuso struct {
CodiceIPA string `yaml:"codiceIPA,omitempty"`
} `yaml:"riuso,omitempty"`
Piattaforme struct {
Spid bool `yaml:"spid"`
Pagopa bool `yaml:"pagopa"`
Cie bool `yaml:"cie"`
Anpr bool `yaml:"anpr"`
} `yaml:"piattaforme"`
}
ExtensionIT is the country-specific extension for Italy. Reference: https://github.com/publiccodenet/publiccode.yml/blob/develop/schema.it.md
type ParseError ¶
type ParseError struct {
Reason string
}
A generic parse error.
func (ParseError) Error ¶
func (e ParseError) Error() string
type Parser ¶
type Parser struct {
PublicCode PublicCode
// DisableNetwork disables all network tests (URL existence and Oembed). This
// results in much faster parsing.
DisableNetwork bool
// Domain will have domain specific settings, including basic auth if provided
// this will avoid strong quota limit imposed by code hosting platform
Domain Domain
// The name of the branch used to check for existence of the files referenced
// in the publiccode.yml
Branch string
// contains filtered or unexported fields
}
Parser is a helper class for parsing publiccode.yml files.
func NewParserWithPath ¶
TODO doc empty string disables it and enables remote
func (*Parser) ParseBytes ¶
ParseBytes loads the yaml bytes and tries to parse it. Return an error if fails.
func (*Parser) ParseInDomain ¶
ParseInDomain wrapper func to be in domain env
type PublicCode ¶
type PublicCode struct {
PubliccodeYamlVersion string `yaml:"publiccodeYmlVersion" validate:"required,oneof=0.2 0.2.2"`
Name string `yaml:"name" validate:"required"`
ApplicationSuite string `yaml:"applicationSuite,omitempty"`
URL *URL `yaml:"url" validate:"required"`
LandingURL *URL `yaml:"landingURL,omitempty"`
IsBasedOn UrlOrUrlArray `yaml:"isBasedOn,omitempty"`
SoftwareVersion string `yaml:"softwareVersion,omitempty"`
ReleaseDate string `yaml:"releaseDate" validate:"required,date"`
Logo string `yaml:"logo,omitempty"`
MonochromeLogo string `yaml:"monochromeLogo,omitempty"`
InputTypes []string `yaml:"inputTypes,omitempty"`
OutputTypes []string `yaml:"outputTypes,omitempty"`
Platforms []string `yaml:"platforms" validate:"gt=0"`
Categories []string `yaml:"categories" validate:"required,gt=0,dive,is_category_v0_2"`
UsedBy *[]string `yaml:"usedBy,omitempty"`
Roadmap *URL `yaml:"roadmap,omitempty"`
DevelopmentStatus string `yaml:"developmentStatus" validate:"required,oneof=concept development beta stable obsolete"`
SoftwareType string `` /* 181-byte string literal not displayed */
IntendedAudience *struct {
Scope *[]string `yaml:"scope,omitempty" validate:"omitempty,dive,is_scope_v0_2"`
Countries *[]string `yaml:"countries,omitempty" validate:"omitempty,dive,iso3166_1_alpha2_lowercase"`
UnsupportedCountries *[]string `yaml:"unsupportedCountries,omitempty" validate:"omitempty,dive,iso3166_1_alpha2_lowercase"`
} `yaml:"intendedAudience,omitempty"`
Description map[string]Desc `yaml:"description" validate:"gt=0,dive,keys,bcp47,endkeys,dive"`
Legal struct {
License string `yaml:"license" validate:"required"`
MainCopyrightOwner *string `yaml:"mainCopyrightOwner,omitempty"`
RepoOwner *string `yaml:"repoOwner,omitempty"`
AuthorsFile *string `yaml:"authorsFile,omitempty"`
} `yaml:"legal" validate:"required"`
Maintenance struct {
Type string `yaml:"type" validate:"required,oneof=internal contract community none"`
Contractors []Contractor `yaml:"contractors,omitempty" validate:"required_if=Type contract,dive"`
Contacts []Contact `yaml:"contacts,omitempty" validate:"required_if=Type community,required_if=Type internal,dive"`
} `yaml:"maintenance"`
Localisation struct {
LocalisationReady *bool `yaml:"localisationReady" validate:"required"`
AvailableLanguages []string `yaml:"availableLanguages" validate:"required,gt=0,dive,bcp47"`
} `yaml:"localisation" validate:"required"`
DependsOn *struct {
Open *[]Dependency `yaml:"open,omitempty" validate:"omitempty,dive"`
Proprietary *[]Dependency `yaml:"proprietary,omitempty" validate:"omitempty,dive"`
Hardware *[]Dependency `yaml:"hardware,omitempty" validate:"omitempty,dive"`
} `yaml:"dependsOn,omitempty"`
It ExtensionIT `yaml:"it"`
}
PublicCode is a publiccode.yml file definition. Reference: https://github.com/publiccodenet/publiccode.yml
type URL ¶
func (*URL) MarshalYAML ¶
func (*URL) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.
type UrlOrUrlArray ¶
type UrlOrUrlArray []*URL
func (*UrlOrUrlArray) UnmarshalYAML ¶
func (a *UrlOrUrlArray) UnmarshalYAML(unmarshal func(interface{}) error) error
type ValidationError ¶
type ValidationError struct {
Key string `json:"key"`
Description string `json:"description"`
Line int `json:"line"`
Column int `json:"column"`
}
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []ValidationError
func (ValidationErrors) Error ¶
func (ve ValidationErrors) Error() string