Description
Summary
When an OpenAPI spec uses whole-file $refs (no URL fragment) to pull in external schemas, the bundler was naming them root, <Filename>_root, <Filename>_root_2, … instead of using the source filename. Downstream PascalCase turned these into Root, <Filename>Root, etc.
lastToken(entry.hash) returned the literal string "root" for empty hashes, and the bundling loop only consulted the filename-derived proposedBase as a collision suffix — so the bare name root always won. URL-fragment refs (./file.yml#/components/schemas/Foo) were unaffected.
Example
# root.yml
paths:
/agents:
get:
responses:
'200':
content:
application/json:
schema: { $ref: './AgentType.yml' } # whole-file ref
/users:
get:
responses:
'200':
content:
application/json:
schema: { $ref: './UserType.yml' } # whole-file ref
Before:
After:
Description
Summary
When an OpenAPI spec uses whole-file
$refs (no URL fragment) to pull in external schemas, the bundler was naming themroot,<Filename>_root,<Filename>_root_2, … instead of using the source filename. Downstream PascalCase turned these intoRoot,<Filename>Root, etc.lastToken(entry.hash)returned the literal string"root"for empty hashes, and the bundling loop only consulted the filename-derivedproposedBaseas a collision suffix — so the bare namerootalways won. URL-fragment refs (./file.yml#/components/schemas/Foo) were unaffected.Example
Before:
components: schemas: root: { ... } // AgentType UserType_root: { ... } // UserTypeAfter:
components: schemas: AgentType: { ... } UserType: { ... }