opensbom-generator / parsers

Language and ecosystem parsers
Apache License 2.0
6 stars 10 forks source link

error creating SBOM, err: writing serialized document: json: error calling MarshalJSON for type *common.Supplier #76

Open williamfzc opened 1 year ago

williamfzc commented 1 year ago
➜  lsif-node git:(main) ✗ ./sbomgen -o . -f JSON
INFO[2023-08-27T14:53:17+08:00] Starting to generate SPDX ...                
INFO[2023-08-27T14:53:18+08:00] Using npm, current Language Version 6.14.11  
INFO[2023-08-27T14:53:18+08:00] Global Setting File path                     
INFO[2023-08-27T14:53:18+08:00] Parsing . for packages                       
FATA[2023-08-27T14:53:29+08:00] error creating SBOM, err: writing serialized document: json: error calling MarshalJSON for type *common.Supplier: failed to marshal invalid Supplier: {Supplier: SupplierType:Organization} 

The process will break if either the SupplierType or Supplier field is empty. Maybe we need some default values (both name and type) for avoiding this, not only assign a name. Like: https://github.com/opensbom-generator/parsers/blob/dda5564a3a3968559349e5b2f2bfb84ffb259409/pnpm/handler.go#L115