Repository navigation
Conversation
…(round 41) schema_type! refuses a private item at the call site with the spanned "is private to" error instead of letting rustc report E0603 in the DTO: the source container's serde default fn, a related model's serde paths in an inline relation type (HasMany picked and circular), and a one-name type reached through an import, a glob or a private module of its source. A serde(transparent) source no longer refuses a multipart DTO, which never carries the attribute. An empty schema name is a spanned compile error (schema_type! and #[schema(name = "")]). A call site under a custom test/example/bench root whose named root is absent is rooted at the compiler's root, so crate:: resolves from that root and not from src/. The stale-variant check reads a schema_type! invocation from its own inline module, not the whole file. get_type_default moves to type_utils/type_default.rs (re-exported) to keep type_utils.rs under the 1000-line cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Round-41 schema_macro fixes (findings from the round-41 audit of
crates/vespera_macro/src/schema_macro/**andschema_impl*).Fixed
crate_layout::layout_for: a call site undertests//examples//benches/whose target directory has no named root (custom[[test]] name = "integration" path = "tests/main.rs", helpertests/common/mod.rs) fell through to the library layout, socrate::resolved againstsrc/and the helper's module path wascrate. It now falls through to the compiler's root like a custom target does. Test:custom_test_root_helper_module.#[serde(default = "fn")]was carried into the DTO's default helper without the serde-path readability check, so a privatefnof the source module was E0603 in the emitted DTO. Checked when the helper is emitted (buildable DTOs). Tests:private_container_default_fn_is_refused_from_another_module,..._is_ignored_when_the_dto_is_not_built.HasManypicked, circularHasOne/BelongsTo) kept re-rooted serde function paths with no readability check. The inline type now records the first unreadable path and the caller refuses it with the same spanned error. Tests:private_serde_default_of_a_picked_has_many_item_is_refused,private_serde_default_of_a_circular_inline_type_is_refused.serde(transparent)was refused for a multipart DTO that never carries it. Test: a newmultipart_carries_no_transparentcase plustransparent_source_is_not_refused_for_a_multipart_dto.useimport or a glob were emitted ascrate::paths withoutpath_readable_from, so apub(super)enum reached throughuse super::memo::MemoStatus;was E0603 instead of the spanned error. Tests:pub_super_enum_reached_through_an_import_is_refused,..._through_a_glob_is_refused.pubenum in a privatemod user;); an import of an item of a private module was also unchecked. Both now use thepath()rule (refuse_unreadable). Tests:pub_enum_of_a_private_module_reached_through_an_import_is_refused,pub_local_of_a_private_module_is_refused.schema_type!(.., name = ""),#[schema(name = "")]) was accepted and registered as the""key. Both paths now refuse it with a spanned error. Tests:empty_schema_type_name_is_refused,empty_schema_name_is_compile_error.schema_impl/stale.rsscanned the whole file for a variant (Scope::Module), so a same-namedschema_type!in a siblingmodon the same line kept a deleted variant alive. The invocation lines are now read from the variant's own module (module_own_items), and the record pruning uses the same scope. Test:sibling_module_invocation_on_the_same_line_does_not_keep_a_variant.type_utils.rs(985 lines before) movedget_type_defaultand its ecosystem-name table intotype_utils/type_default.rs(re-exported, so no caller changes) to stay under the 1000-line cap.Refuted
schema_type!DTO garde derive names::garde): not changed. The DTO's#[derive(::garde::Validate)]exists only for source fields with a#[garde(..)]attribute. Thegardehelper attribute is declared only by agarde::Validatederive, so the source struct already has to name the user'sgardecrate, and garde_derive 0.23 emits absolute::garde::...paths (garde_derive-0.23.0/src/emit.rs:35,42,146,407,428). A::vespera::__validation::gardederive would still emit::gardeinside its output, so the DTO is no more dependent on the user's garde than the source already is. Rules coming from#[schema(..)]constraints go throughgarde_emitand never touch the DTO's derive. No test added for this.Notes
openapi.jsonofexamples/axum-exampleis not affected: no fix changes the output of a valid input (all changes refuse or prune invalid or unreadable cases)..changepacks/changepack_log_schema_round41.jsonlists all seven packages at Patch.🤖 Generated with Claude Code