Skip to content

Commit

Permalink
add model artifact to catalog model version
Browse files Browse the repository at this point in the history
Signed-off-by: Dhiraj Bokde <[email protected]>
  • Loading branch information
dhirajsb committed Jan 22, 2025
1 parent c282096 commit f09990a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 133 deletions.
18 changes: 16 additions & 2 deletions api/openapi/model-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,23 @@ components:
- $ref: "#/components/schemas/RegisteredModelCreate"
CatalogModelVersion:
description: Represents a CatalogModelVersion belonging to a CatalogModel.
required:
- name
- artifact
allOf:
- $ref: "#/components/schemas/ModelVersionCreate"
- $ref: "#/components/schemas/BaseResource"
- $ref: "#/components/schemas/BaseResourceCreate"
- $ref: "#/components/schemas/ModelVersionUpdate"
- type: object
properties:
name:
description: |-
The client provided name of the model's version. It must be unique among all the ModelVersions of the same
type within a Model Registry instance and cannot be changed once set.
type: string
artifact:
description: |-
The catalog model artifact.
$ref: "#/components/schemas/ModelArtifact"
ArtifactState:
description: |2-
- PENDING: A state indicating that the artifact may exist.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m ModelCatalogServiceAPIService) GetCatalogSource(ctx context.Context, id
return Response(http.StatusOK, response), nil
}

func (m ModelCatalogServiceAPIService) GetCatalogSources(ctx context.Context, name string, pageSize string, orderBy string, sortOrder string, offset string) (ImplResponse, error) {
func (m ModelCatalogServiceAPIService) GetCatalogSources(ctx context.Context, name string, pageSize string, orderBy openapi.OrderByField, sortOrder openapi.SortOrder, offset string) (ImplResponse, error) {
response := openapi.CatalogSourceList{
Items: make([]openapi.CatalogSource, 0),
}
Expand Down
7 changes: 5 additions & 2 deletions internal/server/openapi/type_asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,18 @@ func AssertCatalogModelVersionListRequired(obj model.CatalogModelVersionList) er
// AssertCatalogModelVersionRequired checks if the required fields are not zero-ed
func AssertCatalogModelVersionRequired(obj model.CatalogModelVersion) error {
elements := map[string]interface{}{
"name": obj.Name,
"registeredModelId": obj.RegisteredModelId,
"name": obj.Name,
"artifact": obj.Artifact,
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}

if err := AssertModelArtifactRequired(obj.Artifact); err != nil {
return err
}
return nil
}

Expand Down
144 changes: 16 additions & 128 deletions pkg/openapi/model_catalog_model_version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f09990a

Please sign in to comment.