Skip to content

Usage

The map method is the core of every LicenseLynx library. It takes a license name string and returns a LicenseObject containing the canonical id and its src (source).

For the full method signatures, parameters, and error handling, see the API Reference.

If no match is found, Python returns None, Java returns null, and TypeScript rejects the Promise. For quote normalization and lookup order, see Matching Behavior.

Python

from licenselynx.licenselynx import LicenseLynx

result = LicenseLynx.map("MIT")
print(result.id)   # "MIT"
print(result.src)  # "spdx"

Java

import org.licenselynx.LicenseLynx;
import org.licenselynx.LicenseObject;

LicenseObject result = LicenseLynx.map("MIT");
System.out.println(result.getId());   // "MIT"
System.out.println(result.getSrc());  // "spdx"

TypeScript

map returns a Promise.

import {map} from "@licenselynx/licenselynx";

const result = await map('MIT');
console.log(result.id);   // "MIT"
console.log(result.src);  // "spdx"

Risky Mappings

All languages support an optional risky parameter. When enabled, the lookup falls back to lower-confidence mappings if no match is found in the stable map. See Risky Mappings for details.

result = LicenseLynx.map("gpl3", risky=True)
LicenseObject result = LicenseLynx.map("gpl3", true);
const result = await map('gpl3', true);

Organization Mappings

All languages support an optional org parameter for looking up organization-specific licenses (e.g., inner-source licenses). See the API Reference for the full Organization enum.

from licenselynx.organization import Organization

result = LicenseLynx.map("SISL-1.4", org=Organization.SIEMENS)
import org.licenselynx.Organization;

LicenseObject result = LicenseLynx.map("SISL-1.4", Organization.Siemens);
import {map, Organization} from "@licenselynx/licenselynx";

const result = await map('SISL-1.4', false, Organization.Siemens);

Data Mapping

The full license mapping is also available as a JSON file at /json/latest/mapping.json. See the Data Specification for the format.