Get licenses from embedded schema, skip bad modules in deserialize #3526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problems
spec_version
, but the user can bypass this protection by updating the registry with a new client and then running an old client, and they have actually done this (see CKAN.BadMetadataKraken: The license MPL-2.0 is invalid #3331 and CKAN.BadMetadataKraken: The license MPL-2.0 is invalid #3410 and a reply on the forum thread).CKAN/Core/Types/License.cs
CKAN/CKAN.schema
NetKAN-Infra/netkan/netkan/mirrorer.py
Changes
CkanModule
in the available modules list throws an exception during deserialization, including but not limited to an unsupported license, we log a warning and omit that module from itsAvailableModule
collection. This allows the user to keep using the client, albeit without access to such modules.JsonConverter
that adds each version/module pair to aSortedDictionary
one at a time and returns it containing whatever values didn't throw.CKAN.schema
is an embedded resource in Core, andLicenses.cs
retrieves its license data from there.CKANSchema
class holds aschema
object generated by extracting the embedded resource and then parsing it withNJsonSchema
CKANSchema.schema
instead of its own embedded resource.definitions.redistributable_license
enum is added to the schema to document which licenses allow us to redistribute.