feat: API endpoint for fetching an SBOM's AI models#2255
Draft
jcrossley3 wants to merge 1 commit intoguacsec:mainfrom
Draft
feat: API endpoint for fetching an SBOM's AI models#2255jcrossley3 wants to merge 1 commit intoguacsec:mainfrom
jcrossley3 wants to merge 1 commit intoguacsec:mainfrom
Conversation
Contributor
Reviewer's GuideAdds a new HTTP GET endpoint to list AI models associated with an SBOM and wires it through the SBOM service layer with a placeholder implementation and corresponding SbomModel data type. Sequence diagram for the new SBOM AI models listing endpointsequenceDiagram
actor ApiClient
participant ActixRouter
participant SbomEndpoints as SbomEndpointsModule
participant SbomService
participant Database
ApiClient->>ActixRouter: GET /v2/sbom/{id}/models
ActixRouter->>SbomEndpoints: models(fetch, db, id, search, paginated)
SbomEndpoints->>Database: begin_read()
Database-->>SbomEndpoints: tx
SbomEndpoints->>SbomService: fetch_sbom_models(sbom_id, search, paginated, tx)
SbomService-->>SbomEndpoints: PaginatedResults<SbomPackage>
SbomEndpoints-->>ApiClient: 200 OK JSON PaginatedResults<SbomModel>
Class diagram for SbomModel and updated SbomService methodclassDiagram
class SbomModel {
<<struct>>
+Default()
+Serialize
+Deserialize
+ToSchema
// TODO fields
}
class SbomPackage {
<<struct>>
// Existing fields not shown
}
class Paginated {
<<struct>>
// Existing pagination parameters
}
class Query {
<<struct>>
// Existing search parameters
}
class PaginatedResults~T~ {
<<struct>>
+Vec~T~ items
+u64 total
}
class SbomService {
+fetch_sbom_models(sbom_id Uuid, search Query, paginated Paginated, connection ConnectionTrait) Result~PaginatedResults~SbomPackage~~
}
class ConnectionTrait {
<<trait>>
}
SbomService --> ConnectionTrait : uses
SbomService --> PaginatedResults : returns
PaginatedResults --> SbomPackage : T = SbomPackage
SbomService --> Query : param
SbomService --> Paginated : param
class ModelsEndpoint {
<<actix_handler>>
+models(fetch SbomService, db Database, id Uuid, search Query, paginated Paginated, Require_ReadSbom) HttpResponse~PaginatedResults~SbomModel~~
}
class Database {
+begin_read() Transaction
}
class Transaction {
<<struct>>
}
ModelsEndpoint --> SbomService : calls fetch_sbom_models
ModelsEndpoint --> Database : uses begin_read
Database --> Transaction : returns
ModelsEndpoint --> Transaction : passes_to_service
ModelsEndpoint --> PaginatedResults : responds_with
PaginatedResults --> SbomModel : T = SbomModel
class Require_ReadSbom {
<<guard>>
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2255 +/- ##
==========================================
- Coverage 70.41% 70.37% -0.05%
==========================================
Files 413 413
Lines 23874 23896 +22
Branches 23874 23896 +22
==========================================
+ Hits 16812 16816 +4
- Misses 6152 6163 +11
- Partials 910 917 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2254
Summary by Sourcery
Add a new SBOM API surface for listing AI models associated with an SBOM, including service and model scaffolding.
New Features:
Enhancements: