Strict Mode
By default, if you send input that doesn’t strictly match the input schema, the Logic API will try to make sense of it anyway. This improves backward compatibility: if your input shape changes over time, the Logic API will adapt instead of throwing an error. If you want to run the document in strict mode, which means it will error if the input data does not precisely match the input schema, you can add the query parameter?enforceInputSchema=true
to your call.
Note: This only impacts input data. The output data will always match the
output schema.
Examples of Strict Mode on and off
For a document that takes an input schema of:Strict Mode Off
Strict mode off would accept a slightly incorrect input, likeartistName
being artist-name
Below are examples of calling this document with strict mode
off, using input that doesn’t fit the schema but will still be accepted.
This would succeed, as strict mode is off by default.Even though the input variable is supposed to be called
artistName
, the Logic API will adapt to the input and return a response.Strict Mode On
The same request fails when strict mode is on, because the input doesn’t match the schema.This would fail, as strict mode is on and the input does not match the input schema.The Logic API will not adapt to the input and will return an error.