Repository navigation
fix(macro): round-6 schema_type / multipart / route / export findings - #299
Merged
Merged
Conversation
- Multipart: container #[serde(default)] / default = "fn" fills missing fields from the container value; field default fns apply to Option / Vec; a field-named default fn is not shadowed by the field local - schema_type!(..., multipart) carries the source's serde default / skip keys, container default (generated helper) and #[try_from_multipart] - serde default fns resolve from the struct's inline module, self:: / super:: / child paths and crate:: paths (schema_type re-rooted ones) - route claims: param vs catch-all at one position and segments after a catch-all are compile errors (axum panics on them) - export: chained namespace renames keep every schema; prefixes must be static; unsupported-method message lists every method - #[route] generic responses types are a compile error - route errors are statements ahead of the router chain - garde integer bounds are exact (i64 / u128 extremes, > 2^53) - schema! / schema_type! look sources up by Rust ident and through inline modules; ignore+name metadata keeps docs and multipart container attrs - get_type_default covers usize / isize / i128 / u128, collections, Date; DateTimeLocal NOW() documents no fixed default - scripts: measure-stress clears the vespera target; sync-landing-versions replaces each capture at its own position - orchestrator tests assert their outcomes; dead is_file_field_type removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Changepacksvespera@0.8.0 - Cargo.tomlMaybe you forgot to write the following files to the latest version vespera@0.8.0 → 0.8.1 - crates/vespera/Cargo.tomlPatch
vespera_core@0.8.0 → 0.8.1 - crates/vespera_core/Cargo.tomlPatch
vespera_inprocess@0.8.0 → 0.8.1 - crates/vespera_inprocess/Cargo.tomlPatch
vespera_jni@0.8.0 → 0.8.1 - crates/vespera_jni/Cargo.tomlPatch
vespera_macro@0.8.0 → 0.8.1 - crates/vespera_macro/Cargo.tomlPatch
vespera-bridge@0.8.0 → 0.8.1 - libs/vespera-bridge/build.gradle.ktsPatch
vespera-bridge-gradle-plugin@0.8.0 → 0.8.1 - libs/vespera-bridge-gradle-plugin/build.gradle.ktsPatch
|
… for coverage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # crates/vespera_macro/src/garde_emit.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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-6 audit fixes for the macro crate. This PR covers the schema-macro findings (M1-M3, L1-L4) and the rest of the macro findings (M1-M3, L1-L11). L12 was skipped on purpose. Every fix has a test that failed first: rstest/insta cases, and a trybuild UI case for the new compile error.
Multipart and serde defaults
#[derive(Multipart)]now follows serde's rules for missing fields.#[serde(default)]ordefault = "fn"fills each missing field from the container value. It used to fall back to the field type'sDefault.default = "fn"now also applies toOptionandVecfields.#[serde(default)]now needs the struct to implementDefault, as serde already requires. Theaxum-exampletest fixture gained#[derive(Default)].schema_type!(..., multipart)now keeps these source attributes:default/default = "fn"(re-rooted),skipandskip_deserializing;#[try_from_multipart(..)];addor relations are used.#[serde(default = "fn")]function is looked up from the struct's own inlinemod, throughself::/super::/ child paths, and throughcrate::paths (the pathsschema_type!re-roots to). Before, a schema_type DTO of a source with a default fn was rejected.get_type_defaultnow coversusize,isize,i128,u128,Vec,VecDeque,HashSet,BTreeSet,HashMap,BTreeMapand SeaORM'sDate. A bare#[serde(default)]on these types no longer fails the derive.DateTimeLocal/DateTime<Local>NOW()default no longer documents a fixed+00:00value.schema! / schema_type! source lookup
modnow resolves its field types through that module. This used to fail withE0412/E0425.ignore, name = ".."now keeps the struct docs. In multipart mode it uses the multipart container attributes instead of the serde-mode ones.Routes / export
responsestype in#[route]is now a compile error, because the type arguments would be silently dropped.Other
garde_emitonly; the OpenAPI number is still an f64.is_file_field_type.measure-stress.ps1clears the vespera target.sync-landing-versionsreplaces each capture at its own position.The
#[schema(default = "light")]workaround inexamples/axum-example/src/models/profile.rsis removed, andopenapi.jsonis unchanged.No files under
parser/**,vespera_core,vespera_inprocessorvespera_jniwere edited.🤖 Generated with Claude Code