Skip to content

cloudflightio/spdx-catalog

Repository files navigation

SPDX Catalog

License Maven Central

Bundles the latest version of the SPDX Licence List in a JSON format as provided here.

Additionaly, it comes with a small Kotlin library powered by Kotlin Serialization which provides a convenient and typed access to that catalog.

So for example, for the Apache-2.0 license you have access to the following data:

SpdxLicense(
    reference=https://spdx.org/licenses/Apache-2.0.html, 
    isDeprecatedLicenseId=false, 
    detailsUrl=https://spdx.org/licenses/Apache-2.0.json, 
    referenceNumber=382, 
    name=Apache License 2.0, 
    licenseId=Apache-2.0, 
    seeAlso=[https://www.apache.org/licenses/LICENSE-2.0, https://opensource.org/licenses/Apache-2.0], 
    isOsiApproved=true, 
    isFsfLibre=true
)

How to install

This library is being pushed to Maven Central, so you can grab it i.e. with Gradle:

repositories {
    mavenCentral()
}

dependencies {
    implementation('io.cloudflight.license.spdx:spdx-catalog:3.16.6')
}

How to use

Your entry class is the singleton io.cloudflight.license.spdx.SpdxLicenses.

For example:

import io.cloudflight.license.spdx.SpdxLicenses

println(SpdxLicenses.findById("0BSD"))

val license = SpdxLicenses.findByDescription("The Apache Software License, Version 2.0")
println(license?.licenseId)

will print BSD Zero Clause License

and

import io.cloudflight.license.spdx.SpdxLicenses

val license = SpdxLicenses.findByDescription("The Apache Software License, Version 2.0")
println(license?.licenseId)

will print Apache-2.0.

The library also normalizes different variants of license description names, therefore also the following code works:

import io.cloudflight.license.spdx.SpdxLicenses

val license = SpdxLicenses.findByDescription("Apache License v2.0")
println(license?.licenseId)

This will print Apache-2.0 as well.

How to contribute

Always keep the version of that SPDX list in sync with the version of this module.

About

Wraps the SPDX license list into an archive and includes a Kotlin wrapper for typesafe access

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages