From 16be5e21cd69b08a976af39401148af2f0e9e1be Mon Sep 17 00:00:00 2001 From: Miles Yucht Date: Fri, 13 Oct 2023 13:59:56 +0200 Subject: [PATCH] Only log pkg.Load after checking whether the operation is tagged (#655) ## Changes Small bugfix for the OpenAPI generator logging. The generator calls the `Load` method once per tag. That method iterates through all endpoints, skipping over the endpoints that are not tagged with the provided tag. Logging was done before checking this though, producing many extraneous logs. ## Tests Ran the generator against the CLI, producing far less noisy output. --- openapi/code/package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/code/package.go b/openapi/code/package.go index 80c2ee7c5..e1e6bc0cf 100644 --- a/openapi/code/package.go +++ b/openapi/code/package.go @@ -329,10 +329,10 @@ func (pkg *Package) Load(ctx context.Context, spec *openapi.Specification, tag o } for prefix, path := range spec.Paths { for verb, op := range path.Verbs() { - logger.Infof(ctx, "pkg.Load %s %s", verb, prefix) if !op.HasTag(tag.Name) { continue } + logger.Infof(ctx, "pkg.Load %s %s", verb, prefix) svc, ok := pkg.services[tag.Service] if !ok { svc = &Service{