Skip to content

fix(specta): set ndt.ty in build_ndt for rc.25 init_with_sentinel#10

Draft
johncarmack1984 wants to merge 1 commit into
mainfrom
john/fix-rc25-init-with-sentinel
Draft

fix(specta): set ndt.ty in build_ndt for rc.25 init_with_sentinel#10
johncarmack1984 wants to merge 1 commit into
mainfrom
john/fix-rc25-init-with-sentinel

Conversation

@johncarmack1984
Copy link
Copy Markdown
Collaborator

Summary

init_with_sentinel in specta rc.25 split into two callbacks: build_ndt (metadata + exported type body) and build_ty (type used for inline references). The current JsonValue impl only sets metadata in build_ndt, never assigns ndt.ty, so the named type registers but its body is never written.

Result: any field overridden as #[specta(type = ::geojson::specta_compat::JsonValue)] produces TS bindings that reference an undefined JsonValue alias.

Fix

Mirror the pattern specta-macros uses for derived types: hoist the type body into a local fn build, call it inside build_ndt to assign ndt.ty, and pass the same fn as the build_ty argument.

Same shape was applied to fltsci's internal string_enum_type! / opaque_ts_type! macros in the bump branch.

Test plan

  • cargo build -p geojson clean
  • In a downstream consumer, regenerate taurpc bindings and confirm JsonValue is now defined as a top-level alias rather than referenced-but-undefined
  • Draft for now -- pin gets validated end-to-end via fltsci's specta rc.25 bump branch before un-drafting

rc.25 split init_with_sentinel into separate build_ndt (metadata +
exported type) and build_ty (inline-reference type) callbacks.
Without setting ndt.ty in build_ndt, the named type registers but
its body is never written, so consumers reference an undefined
JsonValue alias in the generated TS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant