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