bug: validate custom_mapping as an object (#3189)

* Validate custom_mapping properly as an object

* Remove related test

* black
This commit is contained in:
Sara Zan 2022-09-09 18:03:29 +02:00 committed by GitHub
parent 621e1af74c
commit 96bb9b5905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -21,7 +21,7 @@ from haystack.errors import PipelineError, PipelineConfigError, PipelineSchemaEr
logger = logging.getLogger(__name__)
VALID_INPUT_REGEX = re.compile(r"^[-a-zA-Z0-9_/\\.:]+$")
VALID_INPUT_REGEX = re.compile(r"^[-a-zA-Z0-9_/\\.:*]+$")
VALID_ROOT_NODES = ["Query", "File"]
@ -97,10 +97,7 @@ def read_pipeline_config_from_yaml(path: Path) -> Dict[str, Any]:
return yaml.safe_load(stream)
JSON_FIELDS = [
"custom_query", # ElasticsearchDocumentStore.custom_query
"custom_mapping", # ElasticsearchDocumentStore.custom_mapping
]
JSON_FIELDS = ["custom_query"] # ElasticsearchDocumentStore.custom_query
def validate_config_strings(pipeline_config: Any):

View File

@ -687,9 +687,6 @@ 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():