MCPcopy Create free account
hub / github.com/bufbuild/buf / validateProtoImage

Function validateProtoImage

private/bufpkg/bufimage/validate.go:25–38  ·  view source on GitHub ↗

we validate the actual fields of the FileDescriptorProtos as part of newImageFile

(protoImage *imagev1.Image)

Source from the content-addressed store, hash-verified

23
24// we validate the actual fields of the FileDescriptorProtos as part of newImageFile
25func validateProtoImage(protoImage *imagev1.Image) error {
26 if protoImage == nil {
27 return errors.New("nil Image")
28 }
29 if len(protoImage.GetFile()) == 0 {
30 return errors.New("image contains no files")
31 }
32 for _, protoImageFile := range protoImage.GetFile() {
33 if err := validateProtoImageFile(protoImageFile); err != nil {
34 return err
35 }
36 }
37 return nil
38}
39
40func validateProtoImageFile(protoImageFile *imagev1.ImageFile) error {
41 if protoImageFileExtension := protoImageFile.GetBufExtension(); protoImageFileExtension != nil {

Callers 1

NewImageForProtoFunction · 0.85

Calls 2

validateProtoImageFileFunction · 0.85
GetFileMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…