Clean up MVP output handling
This commit is contained in:
@@ -49,10 +49,6 @@ type RunOutput struct {
|
||||
Rejected []artifacts.RejectedArtifact `json:"rejected,omitempty"`
|
||||
Warnings []contracts.Warning `json:"warnings,omitempty"`
|
||||
OutputFiles []contracts.OutputFile `json:"-"`
|
||||
// EncodedOutput is the legacy single-output payload. New callers should use OutputFiles.
|
||||
EncodedOutput []byte `json:"-"`
|
||||
// ContentType is the legacy single-output content type. New callers should use OutputFiles.
|
||||
ContentType string `json:"content_type,omitempty"`
|
||||
}
|
||||
|
||||
func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
@@ -143,10 +139,6 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
return failOutput(output), fmt.Errorf("validate output files from encoder %q: %w", encoder.Key(), err)
|
||||
}
|
||||
output.OutputFiles = files
|
||||
if len(encoded.Files) == 0 {
|
||||
output.EncodedOutput = append([]byte(nil), encoded.Bytes...)
|
||||
output.ContentType = encoded.ContentType
|
||||
}
|
||||
|
||||
return output, nil
|
||||
}
|
||||
@@ -425,19 +417,8 @@ func manifestMetadataKey(module any) string {
|
||||
}
|
||||
|
||||
func outputFilesFromResult(result contracts.OutputResult) ([]contracts.OutputFile, error) {
|
||||
files := result.Files
|
||||
if len(files) == 0 && len(result.Bytes) > 0 {
|
||||
files = []contracts.OutputFile{
|
||||
{
|
||||
Name: "output",
|
||||
ContentType: result.ContentType,
|
||||
Bytes: result.Bytes,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
out := make([]contracts.OutputFile, 0, len(files))
|
||||
for _, file := range files {
|
||||
out := make([]contracts.OutputFile, 0, len(result.Files))
|
||||
for _, file := range result.Files {
|
||||
if err := validateOutputFileName(file.Name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user