API Exposure Guide

Schema & Field Types

Learn what influences the generated GraphQL types, type promotion, and dynamic type inference.

Schema & Field Types

Rescile automatically generates a strongly-typed GraphQL schema and corresponding REST JSON boundaries. Understanding how the engine determines these types helps you prevent schema conflicts and ensures reliable API consumption.

Explicit Schemas (module.toml)

The most predictable way to influence API field types is by explicitly defining them in your module.toml. When the controller initializes, it reads the [[asset.columns]] and [[input.fields]] declarations.

Allowed explicit types are:

  • string (Maps to GraphQL String)
  • integer (Maps to GraphQL Int)
  • number (Maps to GraphQL Float)
  • boolean (Maps to GraphQL Boolean)
  • array_of_string (Maps to [String])
  • array_of_integer (Maps to [Int])

Dynamic Type Inference & Nested Objects

If an asset is ingested without a strict schema (e.g., a raw JSON upload or an unmapped CSV), Rescile infers the types dynamically using a json_value_to_typeref mapping.

If a property contains a complex nested JSON object, Rescile automatically generates a new composite GraphQL type. For example, if a server node has a property configuration containing an object, the API will expose a new strongly-typed object named ServerConfiguration.

Type Promotion (Conflict Resolution)

In hybrid environments, data can be messy. Node A might have version = 2 (Integer), while Node B of the same type has version = "2.1.0" (String).

To prevent schema compilation crashes, the engine uses a Type Promotion algorithm (promote_typeref). If a field’s type is inconsistent across different nodes of the same label, Rescile automatically promotes the field to the most permissive type in the following hierarchy: IntFloatString

Note: Mixing Boolean with numeric types immediately promotes the field to a String.