-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API to return licenses as a map in addition to list #237
Comments
Sounds like a useful API - if you'd like to create a PR, I can review merge. Otherwise, I'll take a look at this after implementing the SPDX 3.0 support. |
@dwalluck - Finished with the SPDX 3 upgrade - can you point me to the API that returns the list? |
@goneall Thanks for following up. As an aside, I quickly tried to test 2.0.0-RC1 and I got a fatal error loading the cached SPDX licenses:
I no longer see an API which returns a list. But, there's also currently no API which returns a map. I guess it comes down to a design choice here since However, the |
I wasn't able to duplicate the problem. The warning is expected if you're not connected to the internet. The hard error, on the other hand, is completely unexpected. I'll add some additional logging to see if we can find out what is wrong. The code just reads the license information from resource files included in the Jar file. |
@pmonks - any thoughts on the design approach? |
I'm very much in favour of a "map-based" representation of the license and exception lists held by the library and accessible (perhaps only as an unmodifiableMap, so callers can't modify that core data and mess things up?) via a public API; FWIW my code constructs exactly these maps itself so this would be a (welcome!) simplification of my code. One thought: there may be runtime performance benefits for the library to make more use of such maps itself e.g. in various methods in the |
I was definitely connected to the internet. Making the error message show the exception stack trace would be helpful. |
I also changed to use all 1.0.0-RC2-SNAPSHOT versions, but it didn't make a difference. Maybe the project can benefit from a BOM since the two models, the core, and the library all seem to be on different versions of the same dependencies.
|
@goneall I tracked it down to missing calls to |
Yes - these are now required with the redesign to support SPDX 3.0. I don't know if there is a better way to initialize the model registry so we don't have to call We probably could put back the default default model store initializations. At one point, we restricted the model store to only store one major version - in other words, you had to choose whether the default would store SPDX spec version 2.X exclusive or SPDX spec version 3.X. This is no longer true - you can now store both versions in the same model store - so the defaults can be added back. |
I added #284 to track adding back a default store. |
@dwalluck - We might need the |
Actually, I thought it had something to do with the split between the core and the library, since it used to be set to |
It could, but the question is where would it be set. If we keep the |
I see that the license list is actually using a map internally, but the API returns a list
Map::values()
. Is it possible to add an API which also returns aMap
with keyString licenseId
and valueSpdxListedLicense
? This would be more performant rather than having to recreate a map from the list.The text was updated successfully, but these errors were encountered: