Skip to content

Commit

Permalink
[Connector API] Fix bug with nullable tooltip field in parser (#103427)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrazb committed Dec 14, 2023
1 parent 58a133e commit 029d42b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/changelog/103427.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 103427
summary: "[Connector API] Fix bug with nullable tooltip field in parser"
area: Application
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,41 @@ setup:
- match: { configuration.some_field.value: 456 }
- match: { status: configured }

---
"Update Connector Configuration with null tooltip":
- do:
connector.update_configuration:
connector_id: test-connector
body:
configuration:
some_field:
default_value: null
depends_on:
- field: some_field
value: 31
display: numeric
label: Very important field
options: [ ]
order: 4
required: true
sensitive: false
tooltip: null
type: str
ui_restrictions: [ ]
validations:
- constraint: 0
type: greater_than
value: 123


- match: { result: updated }

- do:
connector.get:
connector_id: test-connector

- match: { configuration.some_field.tooltip: null }

---
"Update Connector Configuration - Connector doesn't exist":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class ConnectorConfiguration implements Writeable, ToXContentObject {
private final String placeholder;
private final boolean required;
private final boolean sensitive;
@Nullable
private final String tooltip;
private final ConfigurationFieldType type;
private final List<String> uiRestrictions;
Expand Down Expand Up @@ -199,7 +200,7 @@ public ConnectorConfiguration(StreamInput in) throws IOException {
PARSER.declareString(optionalConstructorArg(), PLACEHOLDER_FIELD);
PARSER.declareBoolean(constructorArg(), REQUIRED_FIELD);
PARSER.declareBoolean(constructorArg(), SENSITIVE_FIELD);
PARSER.declareStringOrNull(constructorArg(), TOOLTIP_FIELD);
PARSER.declareStringOrNull(optionalConstructorArg(), TOOLTIP_FIELD);
PARSER.declareField(
constructorArg(),
(p, c) -> ConfigurationFieldType.fieldType(p.text()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,31 @@ public void testToXContent() throws IOException {
}
],
"value":""
},
"field_with_null_tooltip":{
"default_value":null,
"depends_on":[
{
"field":"some_field",
"value":true
}
],
"display":"textbox",
"label":"Very important field",
"options":[],
"order":4,
"required":true,
"sensitive":false,
"tooltip":null,
"type":"str",
"ui_restrictions":[],
"validations":[
{
"constraint":0,
"type":"greater_than"
}
],
"value":""
}
},
"description":"test-connector",
Expand Down

0 comments on commit 029d42b

Please sign in to comment.