fc.graphql.compatibility.nullEmptyValidation
Changed on:
20 Feb 2025
Setting Area | System |
---|---|
Supported context levels: | ACCOUNT |
Overview
This setting is a feature toggle that defines how empty strings and `null`
inputs are handled by the API and how the values are persisted.
To enable it, set the setting `fc.graphql.compatibility.nullEmptyValidation`
value to `validate-empty-fields`
.
Values
Data Type | Values |
---|---|
STRING | Value(s):
|
Detailed technical description
An opt-in behavioural change to change how empty strings and `null`
inputs are handled by the 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.
- Optional fields:
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}
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}
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