wking / fsf-api

FSF License Metadata API
MIT License
4 stars 7 forks source link

pull: Add {scheme}/{id}.json hardlinks #6

Closed wking closed 6 years ago

wking commented 6 years ago

Putting additional metadata in the licenses.json index is a slippery-slope. This commit strips it down to an array of IDs, and all per-license metadata must be fetched via a single-license endpoint.

The new per-scheme links allow folks to retrieve per-license metadata using their chosen scheme (assuming they trust the mapping maintained in this API) without having to iterate over licenses.json retrieving {FSF-id}.json until they find a match. The OSI API uses the same approach, although they currently have a fatter index.

os.link is implemented on Unix and Windows. The ** recursive glob pattern is new in Python 3.5; for older Pythons I'm falling back to two non-recursive glob calls.

This is the “thin index” alternative to #5; the index-fattness discussion is in #1.

And for what it's worth, this change moves licenses.json from 13kB down to 2.2kB, although the spdx/tools implementation in flight with spdx/tools#112 would no longer need to hit licenses.json at all.

wking commented 6 years ago

I've added licenses-full.json in parallel based on @goneall's suggestion. @goneall, how does this look to you now?

goneall commented 6 years ago

@wking Looks good - thanks