Files
codex/codex-rs/app-server-protocol-noop-macros/src/lib.rs
Michael Bolin acd540f158 Precompute app-server protocol exports (#36212)
## Why

Normal app-server protocol builds do not need the `ts-rs` and `schemars`
implementations used to generate schema exports.

## What changed

- Embed compressed stable and experimental TypeScript and JSON schema exports,
  and serve the existing export APIs from those artifacts.
- Use no-op schema derives in non-test builds while keeping the real generators
  available for fixture regeneration and tests.
- Move schema fixture regeneration behind a Python helper and update
  `just write-app-server-schema --experimental` to refresh the experimental
  embedded exports.

## Testing

- Verify embedded exports match freshly generated stable and experimental
  schemas.
- Verify export options and on-disk output remain compatible.

GitOrigin-RevId: e8536338b457e6eec34bdf29ec0684144bd13734
2026-07-30 19:47:30 +00:00

21 lines
811 B
Rust

//! No-op schema derives for production app-server protocol builds.
//!
//! The real `ts-rs` and `schemars` derives are only needed when regenerating
//! the vendored protocol exports. Normal builds retain the annotations so the
//! protocol definitions stay readable, but use these derives to avoid
//! generating implementations that cannot be reached at runtime.
use proc_macro::TokenStream;
/// Accepts `#[schemars(...)]` helper attributes without generating an impl.
#[proc_macro_derive(JsonSchema, attributes(schemars))]
pub fn derive_json_schema(_input: TokenStream) -> TokenStream {
TokenStream::new()
}
/// Accepts `#[ts(...)]` helper attributes without generating an impl.
#[proc_macro_derive(TS, attributes(ts))]
pub fn derive_ts(_input: TokenStream) -> TokenStream {
TokenStream::new()
}