fraiseql_cli/schema/mod.rs
1//! Schema format handling
2//!
3//! This module handles the intermediate schema format (language-agnostic)
4//! and converts it to `CompiledSchema` (Rust-specific).
5
6pub mod artifact;
7pub mod converter;
8pub mod database_validator;
9pub mod function_root_contract;
10pub mod intermediate;
11pub mod merger;
12pub mod multi_file_loader;
13pub mod mutation_contract;
14pub mod native_joins;
15pub mod optimizer;
16pub mod pg_catalog;
17pub mod seam;
18pub mod validator;
19
20pub use artifact::CompiledArtifact;
21pub use converter::{ConvertOptions, SchemaConverter};
22pub use intermediate::{IntermediateScalar, IntermediateSchema};
23pub use merger::SchemaMerger;
24pub use multi_file_loader::MultiFileLoader;
25pub use optimizer::{OptimizationReport, SchemaOptimizer};
26pub use validator::SchemaValidator;
27
28/// Every scalar type name the compiler recognizes, for the validator and the
29/// converter to seed their known-type registries with.
30///
31/// Derived from `fraiseql_core::schema::BUILTIN_SCALARS`, which is the same
32/// table `SchemaConverter::parse_field_type` reads — the only other place that
33/// decides whether a name is a scalar or an object-type reference. The two were
34/// separately hand-maintained lists and drifted twice. First over spelling
35/// (#724 item 2): this list held `"JSON"`, which the converter does not
36/// recognize, while `"Json"` — the spelling every SDK emits — was missing here,
37/// so one name compiled to a reference to a type that does not exist and the
38/// other was reported as undeclared. Then over the vector types added in #959,
39/// which the converter parsed and this list did not carry, so every schema
40/// authoring a `BitVector` compiled with a warning advising the author to
41/// declare a custom scalar shadowing a built-in.
42pub(crate) fn builtin_scalar_names() -> impl Iterator<Item = &'static str> {
43 fraiseql_core::schema::BUILTIN_SCALARS.iter().map(|(name, _)| *name)
44}
45
46#[cfg(test)]
47mod tests;