Add custom_mapping to the list of fields that can contain string-encoded JSON (#3065)

This commit is contained in:
Sara Zan 2022-08-29 11:10:24 +02:00 committed by GitHub
parent 4e518cdddd
commit e88f1e2577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -97,7 +97,10 @@ def read_pipeline_config_from_yaml(path: Path) -> Dict[str, Any]:
return yaml.safe_load(stream)
JSON_FIELDS = ["custom_query"] # ElasticsearchDocumentStore.custom_query
JSON_FIELDS = [
"custom_query", # ElasticsearchDocumentStore.custom_query
"custom_mapping", # ElasticsearchDocumentStore.custom_mapping
]
def validate_config_strings(pipeline_config: Any):

View File

@ -687,6 +687,9 @@ def test_validate_pipeline_config_component_with_json_input_valid():
validate_config_strings(
{"components": [{"name": "test", "type": "test", "params": {"custom_query": '{"json-key": "json-value"}'}}]}
)
validate_config_strings(
{"components": [{"name": "test", "type": "test", "params": {"custom_mapping": '{"json-key": "json-value"}'}}]}
)
def test_validate_pipeline_config_component_with_json_input_invalid_key():