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