Skip to content

Validate Formula

POST
/api/creative/mechanics/formulas/validate

Validate a formula expression without evaluating.

FormulaValidateRequest
object
expression
required
Expression
string
knownVariables
Knownvariables
Array<string>
default:

Successful Response

FormulaValidationResult
object
expression
required
Expression
string
valid
required
Valid
boolean
errors
required
Errors
Array<string>
referencedVariables
required
Referencedvariables
Array<string>
unknownVariables
required
Unknownvariables
Array<string>
errorDetails
Errordetails
Array<object>
default:
FormulaErrorDetail

Structured formula error with position info for caret display.

position is a 0-based character offset into the original expression string. length is the highlight span (defaults to 1 for caret-only). code identifies the error category so the UI can group/style.

object
code
required
Code
string
message
required
Message
string
position
Any of:
integer
length
Length
integer
default: 1
hint
Any of:
string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object