Repository navigation
Refuse names that collide as generated file names - #318
Merged
Merged
Conversation
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
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
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before: a schema with a class
Playerand an enumplayervalidated cleanly. Its two generated files then overwrote each other on Windows or macOS. A class namedreflectorreflection, 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.Validationnow 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.CppCodeGeneratorreservesreflectandreflectionwhenReflectionis on. A test checks that every reserved name really is a file the generator writes.Closes #258
Generated by Claude Code