SamuraiAku / SPDX.jl

Provides for the creation, reading and writing of SPDX files in multiple file formats. Written in pure Julia.
MIT License
5 stars 1 forks source link

Work on a consistent method for validation of fields with limited values #22

Open SamuraiAku opened 1 year ago

SamuraiAku commented 1 year ago

Things such as the Algorithm field in SpdxChecksumV2, are supposed to have a value from a limited set

( "SHA256", "SHA1", "SHA384", "MD2", "MD4", "SHA512", "MD6", "MD5", "SHA224" )

So how do we handle when reading a file that has a typo or otherwise unrecognized value? Currently SpdxChecksumV2 will error out which kills the entire file read, preventing correction except by editing of the text file which isn't great. So that implies a validation method being called later so that the user can more easily find and fix things. But should we error out when a user makes a mistake creating an object in Julia? That implies calling the validation within the constructor.

Much to think about.

SamuraiAku commented 1 year ago

That feeds into the question of how to validate other aspects of the SPDX document, such as whether all required fields are present. Should that even be a function of this package?