Repository navigation
fix: code mode no longer hardcodes Rust's std-namespace convention - #52
Merged
Merged
Conversation
'generate.rs' is language-agnostic - it shouldn't know that 'std' is special or that Rust's external_std drops its own file. It had duplicated comline-rust's is_std_namespace() check just to make an otherwise-unconditional 'every schema needs a file' invariant skip std. Write whatever files the generator actually returned instead, deriving each file's namespace from its own path rather than cross-checking against the schema list. A generator choosing not to emit a file for a schema (for any reason, std-related or not) is no longer a CLI-level error. This also fixes a latent bug: a TypeScript target with external_std set (a field it ignores) would have silently dropped std's file from disk even though the TypeScript generator still inlined it.
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.
Summary
commands/generate.rs'sMode::Codebranch had its ownis_std_namespace(), duplicating comline-rust's generator-internal std convention just to make an "every schema needs a file" invariant skip std whenexternal_stdis on. The CLI should be generator-agnostic — it shouldn't know Rust's std convention exists at all.external_stdset (a field TypeScript ignores) used to silently dropstd's file from disk even though the TypeScript generator still inlined it.Test plan
cargo test --workspace(74/74 pass, includingexternal_std_flag_qualifies_the_reference_and_omits_stds_own_file)cargo fmt --check/cargo clippy --all-targetsclean