Skip to content

Commit

Permalink
Only log pkg.Load after checking whether the operation is tagged (#655)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
mgyucht authored Oct 13, 2023
1 parent 35237f3 commit 16be5e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openapi/code/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 16be5e2

Please sign in to comment.