Fail merged apps with conflicting schema names - #139
Merged
Conversation
Changepacksvespera@0.3.1 - Cargo.tomlMaybe you forgot to write the following files to the latest version vespera@0.3.1 → 0.3.2 - crates/vespera/Cargo.tomlPatch
vespera_macro@0.3.1 → 0.4.0 - crates/vespera_macro/Cargo.tomlMinor
|
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
CollectedMetadata::check_duplicate_schema_names()so identical definitions retain the existing silent deduplication behaviormerge = [...]Verified pre-change behavior
The pre-change behavior was silent first-wins, not last-wins.
OpenApi::mergepreserves the schema already present inself; compile-time app assembly starts with the parent spec and folds merged apps in declaration order. Therefore the parent wins over children, and among children the earlier entry wins over a later collision.I verified this against the existing
vespera_coremerge contract before changing the macro. In the reported reproduction, Plugin A was merged before Plugin B, so both/api/example/items/and/memo/collision-proberemained inpaths, butcomponents.schemas.ExampleItemretained only Plugin A's{ id, name, description, createdAt }shape. Plugin B's runtime response{ collisionMarker, count }was silently documented with Plugin A's incompatible schema.The merge boundary only has each exported app's OpenAPI sidecar and the
syn::Pathentries supplied tovespera!(merge = [...]); original struct spans from child crates are no longer available. The diagnostic therefore points at the conflicting incoming app path and names both best-available origins (for example,plugin_a::PluginAandplugin_b::PluginB).Tests
cargo test --workspacebun run lintThe changepack records this as a minor
vespera_macrochange because previously silent collisions can now fail existing builds.