Skip to content

compilers/openapi: the webhooks group is named as if the source declared it #184

Description

@OmarAlJarrah

Summary

lowerWebhooks names its group ir.Naming{Source: "webhooks"} (compilers/openapi/operations.go:155). Two things are wrong with that value, and they are separable.

  1. The name is invented, not declared. No OpenAPI document contains a group called "webhooks"; the compiler synthesizes the group to hold webhook operations. Naming.Source is the spelling the source used, so recording an invented name there tells an emitter the API author chose it. The sibling case gets this right: operations with no tags land in a group named ir.Naming{Hint: "default"} (operations.go:173), a hint precisely because the compiler chose it.

  2. Canonical is empty beside a non-empty Source. An emitter reading this Naming finds no word sequence and has to segment "webhooks" itself, which is the casing decision invariant 4 exists to keep out of emitters. irverify allows an empty canonical because a Naming may legitimately carry only a Hint, so nothing reports it.

Evidence

testdata/conformance/openapi/webhooks.golden.json:17 shows the group shipping with a source name and no canonical:

"name": {
  "source": "webhooks"
}

The architecture sweep added in #183 does not catch this: it asserts that a Canonical is filled by the framework, not that a Source comes with one.

Expected

Decide which of the two the group is — a hint, like the default group, or a name with the canonical words beside it — and apply it. Either way the webhooks golden moves, so it wants its own change rather than riding along with an unrelated one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions