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`
To enable it, set the setting
`fc.graphql.compatibility.nullEmptyValidation`
`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`
To enable it, set the setting
`fc.graphql.compatibility.nullEmptyValidation`
- :
`validate-null-as-string`
Convertsto string`null`
and preserves empty strings as provided. This reflects the previous behavior.`"null"`
- (Default):
`validate-empty-fields`
- Optional fields:
- saved as
`null`
`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}
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