Skip to content

licenseid #

Query the SPDX license list and licenses information

licenseid module embeds the SPDX license list data file taken from https://spdx.org/licenses/licenses.json and allows you to obtain basic information about the license from this file, as well as request the license texts and additional data from the network.

fn query #

fn query(license_id string) !License

query returns license object from embedded SPDX license list data file.

struct License #

struct License {
pub:
	license_id               string @[json: licenseId]
	name                     string
	reference                string
	reference_number         int      @[json: referenceNumber]
	details_url              string   @[json: detailsUrl]
	is_osi_approved          bool     @[json: isOsiApproved]
	is_deprecated_license_id bool     @[json: isDeprecatedLicenseId]
	see_also                 []string @[json: seeAlso]
}

fn (License) details #

fn (l License) details() !LicenseDetails

details fetches the license details object from SPDX data file using the details_url. Requires access to public network.

struct LicenseDetails #

struct LicenseDetails {
pub:
	license_id               string @[json: licenseId]
	name                     string
	license_text             string      @[json: licenseText]
	license_text_html        string      @[json: licenseTextHtml]
	license_template         string      @[json: standardLicenseTemplate]
	is_osi_approved          bool        @[json: isOsiApproved]
	is_deprecated_license_id bool        @[json: isDeprecatedLicenseId]
	cross_ref                []Reference @[json: crossRef]
	see_also                 []string    @[json: seeAlso]
}

struct Reference #

struct Reference {
pub:
	match           string
	url             string
	is_valid        bool @[json: isValid]
	is_live         bool @[json: isLive]
	is_way_backlink bool @[json: isWayBackLink]
	timestamp       string
	order           int
}