Importer configuration design #367
Replies: 2 comments
-
Expanding the original idea, I would even dare to suggest to also simplify the body structure of an importer. The current body follows this pattern: {
"name": "name",
"configuration": {
"sbom": {},
"csaf": {},
"osv": {},
"cve": {}
}
} But it could be simplified as: {
"name": "name",
"type": "sbom|csaf|osv|cve",
"configuration": {}
} I believe there are proper DTOs in place now, so the JSON response generated by the server should not necessarily be limited by how the Rust language defines enums |
Beta Was this translation helpful? Give feedback.
-
Because they are actually different. The CVE importer allows to filter by year, OSV doesn't. OSV can have paths. For CVE that doesn't make sense. There's also some expectation/logic on which files get uploaded and which get ignored, based on the importer. As we do have a JSON schema for this, I think we should just stick to that. And I understand that sometimes we need to double check the schema is generated correctly. But believe that's the best approach. When it comes to serializing the enum that's backing this, we currently use the default serde representation (externally tagged: https://serde.rs/enum-representations.html#externally-tagged). We could use the "internally tagged" alternative too if there's a benefit to this. However, this would simpley move the discriminator to a different level. If it's easier for JS to handle it that way, we can change it. |
Beta Was this translation helpful? Give feedback.
-
I'd like to make one point in regards of the current status of the Importers (REST API)
Could we consider joining the
osv
andcve
importers?We currently have different configurations
osv
,cve
based on the format of the file. But I think we should consider having the importer configurations based on the protocol/source-type rather than the format file. Let me expand on this:This is how we currently configure a
osv
and acve
importer:Why don't we just have an importer for Git (Github) repositories? so rather than having
configuration.osv
andconfiguration.cve
we replace it byconfiguration.git
?So the previous 2 importers could be defined as something like (I removed some fields to make the idea clearer):
What do you think about it guys?
Beta Was this translation helpful? Give feedback.
All reactions