This repository was archived by the owner on May 13, 2026. It is now read-only.
feat(schema): derive utoipa::ToSchema on Field/Schema family + alias FieldBase<M> - #681
Merged
Merged
Conversation
…FieldBase<M> Phase 3 slice 3 of cross-repo API typegen unification (parent: gbrain projects/api-typegen-unification, recipe: gbrain projects/register-schema-field-bodies). Adds upstream ToSchema for: - FieldType (schema/types/field/common.rs) - FieldAccessPolicy + AccessTier (access/types.rs) - CapabilityKind + CapabilityConstraint (access/capability.rs) - DataClassification (schema/types/data_classification.rs) - FieldValueType (schema/types/field_value_type.rs) Adds #[aliases(...)] on FieldBase<M> for the four molecule variants: FieldBaseSingle/Hash/Range/HashRange = FieldBase<Molecule|MoleculeHash|MoleculeRange|MoleculeHashRange>. Resolves the DeclarativeSchemaType-as-SchemaType alias quirk in declarative_schemas.rs (same class as #679's super::KeyMetadata fix): removes the file-level alias import and replaces SchemaType usages with the canonical name in main code, struct field, constructor param, match arms, and tests. The unrelated utoipa-internal SchemaType reference at line 92 is preserved. FieldMapper skipped — already has a hand-written ToSchema impl that emits `type: string` per its serde(into = "String") contract. This unblocks fold_db_node's Phase 4d' (register the full Schema/Field family in src/server/openapi.rs). Punch list of $refs that go from unresolved to resolved after this lands + the bump cascade: - DeclarativeSchemaDefinition.{schema_type, source, field_*} - FieldCommon.{access_policy, field_mappers, transform} - {Single,Hash,Range,HashRange}Field.allOf/0 Verified locally: cargo fmt + clippy -D warnings + workspace tests (662 core tests pass, all targets green). Co-Authored-By: Claude Opus 4.7 (1M context) <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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Phase 3 slice 3 of cross-repo API typegen unification. Closes the upstream half of fold_db_node Phase 4d'.
Adds `utoipa::ToSchema` to the transitive types referenced by the Schema/Field family that fold_db_node wants to register in its `openapi.rs`:
Adds `#[aliases(...)]` on `FieldBase` for the four molecule variants:
Resolves the `DeclarativeSchemaType as SchemaType` alias quirk in `declarative_schemas.rs` (same class as #679's `super::KeyMetadata` fix). The file-level alias is removed; usages collapse to the canonical `DeclarativeSchemaType` in struct fields, constructor params, match arms, and tests. The unrelated utoipa-internal `SchemaType` at line 92 is preserved.
`FieldMapper` is intentionally not touched — it already has a hand-written `ToSchema` impl that emits `type: string` per its `serde(into = "String")` contract.
Why
After this lands and bump-cascades to fold_db_node, the following $refs go from unresolved to resolved during `npm run generate:api`:
This closes the loop fold_db_node Phase 1.5 (#790) had to leave dangling and that Phase 4d (#801, atom-module family) couldn't reach because of these transitive ToSchema gaps.
Parent: gbrain `projects/api-typegen-unification`. Recipe: gbrain `projects/register-schema-field-bodies`.
Test plan
🤖 Generated with Claude Code