Skip to content

pass: report names that collide once canonicalized #647

Closed

Description

@OmarAlJarrah

Problem

Names are neutral words in the IR (invariant 4), so two source names that canonicalize to the same words collide in every target:

paths:
  /users:
    get: {operationId: getUser, tags: [users], responses: {"200": {description: ok}}}
    post: {operationId: get_user, tags: [users], responses: {"200": {description: ok}}}
    put: {operationId: GetUser, tags: [users], responses: {"200": {description: ok}}}
components:
  schemas:
    Sep: {type: string, enum: [a-b, a_b, "A B", aB]}
    Sign: {type: integer, enum: [-1, 1, 0]}
    Ops: {type: string, enum: ["<", "<=", "+", "-"]}
  • All three operations get canonical name get_user in one group.
  • All four members of Sep canonicalize to a_b.
  • -1 and 1 both canonicalize to 1.
  • The members of Ops get no canonical words and no hint at all.

Nothing is reported. Emitters resolve collisions by ID (docs/emitters/refine/naming.md), and that stays the mechanism; but the document author would want to know, and one check on neutral words gives the answer for every target at once.

Proposal

A pass that warns, per scope, on equal canonical names: operations within a group, parameters within an operation, properties within a model, groups within a service, members within an enum, and component types. The message names every party. Enum members that canonicalize to no words at all get their own diagnostic. Related: #255 (enum members have no key for resolution).

Activity

  1. fuad-daoud commented on Oct 10, 2026

    @fuad-daoud
    Collaborator

    Another case for this check: a synthesized operation group can share its name with a declared tag. A document with tags: [{name: default}], one tagged and one untagged operation, gives g/tags/default named {source: default} and g/default named {hint: default}. The webhook group's webhooks hint collides with a declared webhooks tag in the same way. #801 keeps these names deliberately, since emitters resolve collisions by ID, so the compiler should report the collision, not rename it (#810, closed).

  2. OmarAlJarrah commented on Oct 19, 2026

    @OmarAlJarrah
    MemberAuthor

    Two counts for the scopes this issue names, on the golden spec (the Cloudflare API schema, cloudflare/api-schemas openapi.json at 911ad78) compiled at c387e25c:

    • 101 enums (1.22%) have members whose names collide once canonicalized, along with 2 models with colliding properties, 12 colliding type names and 1 operation.
    • 70 enum members have no canonical words at all (>=, <, ==, …), and 1,171 more across 154 compiled corpus specs. A diagnostic tells the author, but an emitter still has nothing to name them from. docs/emitter-design: give an enum member whose value has no letters or digits a naming rule #956 asks the emitter design for that rule.
  3. self-assigned this
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority:P1Core first-emitter feature on mainstream specstype:featureNew capability or enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions