Skip to content

Commit

Permalink
OAS: fix discriminator field for Artifact
Browse files Browse the repository at this point in the history
Signed-off-by: Isabella Basso do Amaral <[email protected]>
  • Loading branch information
isinyaaa committed Feb 26, 2024
1 parent 3496eff commit 22c4b45
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 74 deletions.
10 changes: 4 additions & 6 deletions api/openapi/model-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,8 @@ components:
ModelArtifact:
description: An ML model artifact.
type: object
required:
- artifactType
allOf:
- $ref: "#/components/schemas/BaseArtifact"
- $ref: "#/components/schemas/ModelArtifactCreate"
Expand All @@ -982,6 +984,8 @@ components:
DocArtifact:
description: A document.
type: object
required:
- artifactType
allOf:
- $ref: "#/components/schemas/BaseArtifact"
- type: object
Expand Down Expand Up @@ -1345,12 +1349,6 @@ components:
allOf:
- $ref: "#/components/schemas/BaseArtifactCreate"
- $ref: "#/components/schemas/BaseResource"
- required:
- artifactType
type: object
properties:
artifactType:
type: string
ServingEnvironmentList:
description: List of ServingEnvironments.
type: object
Expand Down
10 changes: 5 additions & 5 deletions internal/converter/generated/mlmd_openapi_converter.gen.go

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

9 changes: 0 additions & 9 deletions internal/server/openapi/type_asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ func AssertBaseArtifactCreateConstraints(obj model.BaseArtifactCreate) error {

// AssertBaseArtifactRequired checks if the required fields are not zero-ed
func AssertBaseArtifactRequired(obj model.BaseArtifact) error {
elements := map[string]interface{}{
"artifactType": obj.ArtifactType,
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}

return nil
}

Expand Down
29 changes: 1 addition & 28 deletions pkg/openapi/model_base_artifact.go

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

52 changes: 26 additions & 26 deletions pkg/openapi/model_model_artifact.go

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

0 comments on commit 22c4b45

Please sign in to comment.