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

Function ValidatePRInfo

internal/schemavalidators/schemavalidators.go:391–412  ·  view source on GitHub ↗

ValidatePRInfo validates the PR/MR info schema.

(data interface{}, version PRInfoVersion)

Source from the content-addressed store, hash-verified

389
390// ValidatePRInfo validates the PR/MR info schema.
391func ValidatePRInfo(data interface{}, version PRInfoVersion) error {
392 prInfoOnce.Do(initPRInfoSchemas)
393
394 if version == "" {
395 version = PRInfoVersion1_3
396 }
397
398 schema, ok := compiledPRInfoSchemas[version]
399 if !ok {
400 return errors.New("invalid PR info schema version")
401 }
402
403 if err := schema.Validate(data); err != nil {
404 var invalidJSONTypeError jsonschema.InvalidJSONTypeError
405 if errors.As(err, &invalidJSONTypeError) {
406 return ErrInvalidJSONPayload
407 }
408 return err
409 }
410
411 return nil
412}
413
414// ValidateAIAgentConfig validates the AI agent config schema.
415func ValidateAIAgentConfig(data any, version AIAgentConfigVersion) error {

Callers 8

CraftMethod · 0.92
TestValidatePRInfoFunction · 0.92
TestValidatePRInfoV1_2Function · 0.92
TestValidatePRInfoV1_3Function · 0.92
TestValidatePRInfoFunction · 0.92

Calls 2

DoMethod · 0.80
ValidateMethod · 0.45