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:
{
  "artistName": {
    "type": "string",
    "description": "The name of the artist."
  }
}

Strict Mode Off

Strict mode off would accept a slightly incorrect input, like artistName 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.
curl -X POST 'https://api.logic.inc/2024-03-01/documents/summarize-music-artist-profile/executions'
  -H "Authorization: Bearer $LOGIC_API_TOKEN"
  -H "Content-Type: application/json"
  -d '{
        "artist-name": "Adele"
      }'
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.
curl -X POST 'https://api.logic.inc/2024-03-01/documents/summarize-music-artist-profile/executions?enforceInputSchema=true'
  -H "Authorization: Bearer $LOGIC_API_TOKEN"
  -H "Content-Type: application/json"
  -d '{
        "artist-name": "Adele"
      }'
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.