From 00376711a33cf2fcbe509afac2505011dfb66840 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 17 Dec 2024 15:04:19 +0100 Subject: [PATCH] fix: More explicit names and descriptions for `annotationHandler.sync` method --- bundle/internal/schema/annotations.go | 4 ++-- bundle/internal/schema/main.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bundle/internal/schema/annotations.go b/bundle/internal/schema/annotations.go index 37572716b..aec5e68b0 100644 --- a/bundle/internal/schema/annotations.go +++ b/bundle/internal/schema/annotations.go @@ -109,8 +109,8 @@ func (d *annotationHandler) addAnnotations(typ reflect.Type, s jsonschema.Schema return s } -// Adds empty annotations with placeholders to the annotation file -func (d *annotationHandler) sync(outputPath string) error { +// Writes missing annotations with placeholder values back to the annotation file +func (d *annotationHandler) syncWithMissingAnnotations(outputPath string) error { existingFile, err := os.ReadFile(outputPath) if err != nil { return err diff --git a/bundle/internal/schema/main.go b/bundle/internal/schema/main.go index d6c7049a7..17730290f 100644 --- a/bundle/internal/schema/main.go +++ b/bundle/internal/schema/main.go @@ -163,7 +163,8 @@ func generateSchema(workdir, outputFile string) { log.Fatal(err) } - err = a.sync(annotationsPath) + // Overwrite the input annotation file, adding missing annotations + err = a.syncWithMissingAnnotations(annotationsPath) if err != nil { log.Fatal(err) }