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

Method GeneratePRInfoSchema

internal/prinfo/generator.go:36–54  ·  view source on GitHub ↗

GeneratePRInfoSchema generates a JSON schema for the PR/MR info data.

(version string)

Source from the content-addressed store, hash-verified

34
35// GeneratePRInfoSchema generates a JSON schema for the PR/MR info data.
36func (g *Generator) GeneratePRInfoSchema(version string) *jsonschema.Schema {
37 r := &jsonschema.Reflector{
38 DoNotReference: true,
39 ExpandedStruct: true,
40 RequiredFromJSONSchemaTags: true,
41 // Set to false to allow additional properties by default
42 AllowAdditionalProperties: false,
43 }
44
45 schema := r.Reflect(&Data{})
46
47 schema.ID = jsonschema.ID(fmt.Sprintf("https://schemas.chainloop.dev/prinfo/%s/pr-info.schema.json", version))
48 schema.Title = "Pull Request / Merge Request Information"
49 schema.Description = "Schema for Pull Request or Merge Request metadata collected during attestation"
50 // we want to have a specific version of the schema to avoid compatibility issues
51 schema.Version = "http://json-schema.org/draft-07/schema#"
52
53 return schema
54}
55
56// Save writes the schema to a file
57func (g *Generator) Save(schema *jsonschema.Schema, outputDir, version string) error {

Callers 1

mainFunction · 0.95

Calls 1

IDMethod · 0.65

Tested by

no test coverage detected