Skip to content

Refuse names that collide as generated file names - #318

Merged
matt-edmondson merged 3 commits into
mainfrom
claude/project-thread-kk9on7-258
Oct 22, 2026
Merged

matt-edmondson merged 3 commits into
mainfrom
claude/project-thread-kk9on7-258

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: a schema with a class Player and an enum player validated cleanly. Its two generated files then overwrote each other on Windows or macOS. A class named reflect or reflection, generated with C++ reflection on, silently replaced the reflection header on every platform.

After: both cases are validation errors that name the elements involved, so generation is refused before any file is lost.

How: Schema.Validation now reports class, enum, interface and semantic-type names that differ only in case. Exact duplicates across kinds are left to #229 / #306. For each code generator in the schema, validation also asks the registered generator for the names it writes for itself. That comes from a new default member, ISchemaCodeGenerator.ReservedNames, and reports any element that takes one of those names. CppCodeGenerator reserves reflect and reflection when Reflection is on. A test checks that every reserved name really is a file the generator writes.

Closes #258


Generated by Claude Code

Two elements whose names differ only in case generate files that overwrite
each other on a case-insensitive file system, and an element named after a
file a generator writes for itself (the C++ reflection headers) overwrites it
everywhere. Validation now reports both as errors, so generation is refused
instead of silently losing a file. Generators declare their own files through
the new ISchemaCodeGenerator.ReservedNames default member.

Closes #258

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017diBTKdccitjf28kU2Syfq
@matt-edmondson matt-edmondson self-assigned this Oct 20, 2026
Keeps both name checks: main's report of a name shared across kinds, and this branch's report of
names differing only in case plus names reserved by a generator. Both data source and reserved-name
checks run per code generator.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9FBXHS37WoAF87LDY2ZVV
The unknown-option check refused every option on validate, so
`validate --no-data` failed once both changes reached main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017diBTKdccitjf28kU2Syfq
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit c0878b6 into main Oct 22, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-kk9on7-258 branch October 22, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Element names that differ only in case pass validation, then overwrite each other's generated files on Windows and macOS

2 participants