Skip to content

Commit 565c903

Browse files
committed
add UI types
1 parent 625c0f8 commit 565c903

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

web-app/src/app/services/feeds/types.ts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ export interface paths {
118118
};
119119
};
120120
};
121+
'/v1/licenses:match': {
122+
/** @description Get the list of matching licenses based on the provided license URL */
123+
post: operations['getMatchingLicenses'];
124+
};
121125
}
122126

123127
export type webhooks = Record<string, never>;
@@ -849,6 +853,97 @@ export interface components {
849853
license_rules?: Array<components['schemas']['LicenseRule']>;
850854
};
851855
Licenses: Array<components['schemas']['LicenseBase']>;
856+
/**
857+
* @description Matching a license
858+
* @example {
859+
* "license_id": "CC-BY-4.0",
860+
* "license_url": "https://creativecommons.org/licenses/by/4.0/deed.nl",
861+
* "normalized_url": "creativecommons.org/licenses/by/4.0",
862+
* "match_type": "heuristic",
863+
* "confidence": 0.99,
864+
* "spdx_id": "CC-BY-4.0",
865+
* "matched_name": "Creative Commons Attribution 4.0 International",
866+
* "matched_catalog_url": "https://creativecommons.org/licenses/by/4.0/legalcode",
867+
* "matched_source": "cc-resolver",
868+
* "notes": "Detected locale/jurisdiction port 'nl'. SPDX does not list ported CC licenses; using canonical ID.",
869+
* "regional_id": "CC-BY-4.0-nl"
870+
* }
871+
*/
872+
MatchingLicense: {
873+
/**
874+
* @description Unique identifier for the license (typically SPDX ID)
875+
* @example CC-BY-4.0
876+
*/
877+
license_id?: string;
878+
/**
879+
* @description Original license URL provided for resolution
880+
* @example https://creativecommons.org/licenses/by/4.0/
881+
*/
882+
license_url?: string;
883+
/**
884+
* @description URL after normalization (lowercased, trimmed, protocol removed)
885+
* @example creativecommons.org/licenses/by/4.0
886+
*/
887+
normalized_url?: string;
888+
/**
889+
* @description Type of match performed. One of:
890+
* - 'exact': Direct match found in database
891+
* - 'heuristic': Matched via pattern-based rules (CC resolver, common patterns)
892+
* - 'fuzzy': Similarity-based match against same-host licenses
893+
* - 'none': No match found
894+
*
895+
* @example heuristic
896+
*/
897+
match_type?: string;
898+
/**
899+
* @description Match confidence score (0.0-1.0), examples:
900+
* - 1.0: Exact match
901+
* - 0.99: Creative Commons resolved
902+
* - 0.95: Pattern heuristic match
903+
* - 0.0-1.0: Fuzzy match score based on string similarity
904+
*
905+
* @example 0.99
906+
*/
907+
confidence?: number;
908+
/**
909+
* @description SPDX License Identifier if matched (e.g., 'CC-BY-4.0', 'MIT')
910+
* @example CC-BY-4.0
911+
*/
912+
spdx_id?: string;
913+
/**
914+
* @description Human-readable name of the matched license
915+
* @example Creative Commons Attribution 4.0 International
916+
*/
917+
matched_name?: string;
918+
/**
919+
* @description Canonical URL from the license catalog/database
920+
* @example https://creativecommons.org/licenses/by/4.0/legalcode
921+
*/
922+
matched_catalog_url?: string;
923+
/**
924+
* @description Source of the match. Examples:
925+
* - 'db.license': Exact match from database
926+
* - 'cc-resolver': Creative Commons license resolver
927+
* - 'pattern-heuristics': Generic pattern matching
928+
*
929+
* @example cc-resolver
930+
*/
931+
matched_source?: string;
932+
/**
933+
* @description Additional context about the match (e.g., version normalization, locale detection)
934+
* @example Detected locale/jurisdiction port 'nl'. SPDX does not list ported CC licenses; using canonical ID.
935+
*/
936+
notes?: string;
937+
/**
938+
* @description Regional/jurisdictional variant identifier for ported licenses
939+
* (e.g., 'CC-BY-2.1-jp' for Japan-ported Creative Commons)
940+
*
941+
* @example CC-BY-4.0-nl
942+
*/
943+
regional_id?: string;
944+
};
945+
/** @description List of MatchingLicense */
946+
MatchingLicenses: Array<components['schemas']['MatchingLicense']>;
852947
};
853948
responses: never;
854949
parameters: {
@@ -1266,4 +1361,28 @@ export interface operations {
12661361
};
12671362
};
12681363
};
1364+
/** @description Get the list of matching licenses based on the provided license URL */
1365+
getMatchingLicenses: {
1366+
/** @description Payload containing the license URL to match against the database. */
1367+
requestBody: {
1368+
content: {
1369+
'application/json': {
1370+
/**
1371+
* Format: url
1372+
* @description The license URL to resolve and match against the database.
1373+
* @example https://creativecommons.org/licenses/by/4.0/deed.nl
1374+
*/
1375+
license_url: string;
1376+
};
1377+
};
1378+
};
1379+
responses: {
1380+
/** @description The list of matching licenses if any. */
1381+
200: {
1382+
content: {
1383+
'application/json': components['schemas']['MatchingLicenses'];
1384+
};
1385+
};
1386+
};
1387+
};
12691388
}

0 commit comments

Comments
 (0)