Fluent Commerce Logo
Docs
Sign In

fc.graphql.compatibility.nullEmptyValidation

Setting

Changed on:

20 Feb 2025

Setting AreaSystem
Supported context levels:ACCOUNT

Overview

This setting is a feature toggle that defines how empty strings and

`null`
inputs are handled by the GraphQL API and how the values are persisted. 

To enable it, set the setting

`fc.graphql.compatibility.nullEmptyValidation`
value to
`validate-empty-fields`
.

Values

Data TypeValues
STRING

Value(s):

  • `validate-null-as-string`
    for existing accounts (accounts created before February 2025)
  • `validate-empty-fields`
    for new accounts (accounts created after February 2025)

Detailed technical description

An opt-in behavioural change to change how empty strings and

`null`
inputs are handled by the GraphQL API.

To enable it, set the setting

`fc.graphql.compatibility.nullEmptyValidation`
value to one of the below options:

  • `validate-null-as-string`
    :
    Converts
    `null`
    to string
    `"null"`
    and preserves empty strings as provided. This reflects the previous behavior.
  • `validate-empty-fields`
    (Default):
    • Optional fields:
      • `null`
        saved as
        `null`
      • `""`
        and
        `" "`
        saved as-is
    • Required fields:
      • `null`
        ,
        `""`
        , or whitespace-only strings trigger validation errors.
    • Note:
      For the purpose of validating required fields, literal nulls and strings containing only whitespace are now correctly considered invalid.
Example of a required field error
1{
2    "errors": [
3        {
4            "message": "Exception while fetching data (/updateOrder) : 'status' argument value cannot be null or empty",
5            "locations": [
6                {
7                    "line": 2,
8                    "column": 5
9                }
10            ],
11            "path": [
12                "updateOrder"
13            ],
14            "extensions": {
15                "classification": "DataFetchingException"
16            }
17        }
18    ],
19    "data": {
20        "updateOrder": null
21    }
22}

Language: plain_text

Name: Example of a required field error

Description:

Example of a required field error

Configuration example

1mutation {
2	createSetting(
3		input: {
4			context: "ACCOUNT"
5			contextId: 0
6			valueType: "BOOLEAN"
7			name: "fc.gql.compatibility.persistEmptyStrings"
8			value: "true"
9		}
10	) {
11		id
12	}
13}

Language: json

Update example

1mutation{
2	updateSetting(input: {
3		context: "ACCOUNT"
4		contextId: 0
5		id: 123
6		valueType: "STRING"
7		name: "fc.graphql.compatibility.nullEmptyValidation"
8		value: "validate-empty-fields"
9	}){
10		id
11	}
12}
13

Language: json