Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: OpensearchDocumentStore.custom_mapping should accept JSON strings at validation #3065

Merged
merged 1 commit into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion haystack/pipelines/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions test/pipelines/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down