MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Save

Method Save

internal/prinfo/generator.go:57–69  ·  view source on GitHub ↗

Save writes the schema to a file

(schema *jsonschema.Schema, outputDir, version string)

Source from the content-addressed store, hash-verified

55
56// Save writes the schema to a file
57func (g *Generator) Save(schema *jsonschema.Schema, outputDir, version string) error {
58 schemaJSON, err := json.MarshalIndent(schema, "", " ")
59 if err != nil {
60 return fmt.Errorf("failed to marshal schema to JSON: %w", err)
61 }
62
63 outputFile := fmt.Sprintf("%s/pr-info-%s.schema.json", outputDir, version)
64 if err := os.WriteFile(outputFile, schemaJSON, 0600); err != nil {
65 return fmt.Errorf("failed to write schema to file: %w", err)
66 }
67
68 return nil
69}

Callers 1

mainFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected