pub async fn run(
input: &str,
types: Option<&str>,
schema_dir: Option<&str>,
type_files: Vec<String>,
query_files: Vec<String>,
mutation_files: Vec<String>,
output: &str,
check: bool,
database: Option<&str>,
) -> Result<()>Expand description
Run the compile command
§Arguments
input- Path to fraiseql.toml (TOML) or schema.json (legacy)types- Optional path to types.json (when using TOML workflow)schema_dir- Optional directory for auto-discovery of schema filestype_files- Optional vector of explicit type file pathsquery_files- Optional vector of explicit query file pathsmutation_files- Optional vector of explicit mutation file pathsoutput- Path to write schema.compiled.jsoncheck- If true, validate only without writing outputdatabase- Optional database URL for indexed column validation
§Workflows
- TOML-only:
fraiseql compile fraiseql.toml - Language + TOML:
fraiseql compile fraiseql.toml --types types.json - Multi-file auto-discovery:
fraiseql compile fraiseql.toml --schema-dir schema/ - Multi-file explicit:
fraiseql compile fraiseql.toml --type-file a.json --type-file b.json - Legacy JSON:
fraiseql compile schema.json
§Errors
Returns error if:
- Input file doesn’t exist or can’t be read
- JSON/TOML parsing fails
- Schema validation fails
- Output file can’t be written
- Database connection fails (when database URL is provided)