Skip to main content

run

Function run 

Source
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 files
  • type_files - Optional vector of explicit type file paths
  • query_files - Optional vector of explicit query file paths
  • mutation_files - Optional vector of explicit mutation file paths
  • output - Path to write schema.compiled.json
  • check - If true, validate only without writing output
  • database - Optional database URL for indexed column validation

§Workflows

  1. TOML-only: fraiseql compile fraiseql.toml
  2. Language + TOML: fraiseql compile fraiseql.toml --types types.json
  3. Multi-file auto-discovery: fraiseql compile fraiseql.toml --schema-dir schema/
  4. Multi-file explicit: fraiseql compile fraiseql.toml --type-file a.json --type-file b.json
  5. 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)