mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-10-29 16:59:47 +00:00
fix: stable YAML schema generation (#3388)
* add key sorting in schema generation * add pre-commit hook * try pre-commit hook * Fixed schemas * trying a simpler version * pylint * ordered dict * reverting to dict * unused import * remove hook
This commit is contained in:
parent
7d0f89b6f5
commit
50f34372e1
@ -14,7 +14,6 @@ repos:
|
|||||||
- id: check-shebang-scripts-are-executable # checks all shell scripts have executable permissions
|
- id: check-shebang-scripts-are-executable # checks all shell scripts have executable permissions
|
||||||
- id: mixed-line-ending # normalizes line endings
|
- id: mixed-line-ending # normalizes line endings
|
||||||
- id: no-commit-to-branch # prevents committing to main
|
- id: no-commit-to-branch # prevents committing to main
|
||||||
#- id: pretty-format-json # indents and sorts JSON files # FIXME: JSON schema generator conflicts with this
|
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.6.0 # IMPORTANT: keep this aligned with the black version in pyproject.toml
|
rev: 22.6.0 # IMPORTANT: keep this aligned with the black version in pyproject.toml
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -380,6 +380,9 @@ def get_json_schema(filename: str, version: str, modules: List[str] = ["haystack
|
|||||||
],
|
],
|
||||||
"definitions": schema_definitions,
|
"definitions": schema_definitions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Leveraging an implementation detail of dict: keys stay in the order they are inserted.
|
||||||
|
pipeline_schema = dict(sorted(pipeline_schema.items(), key=lambda pair: pair[0]))
|
||||||
return pipeline_schema
|
return pipeline_schema
|
||||||
|
|
||||||
|
|
||||||
@ -435,4 +438,4 @@ def update_json_schema(destination_path: Path = JSON_SCHEMAS_PATH):
|
|||||||
if new_entry not in index["oneOf"]:
|
if new_entry not in index["oneOf"]:
|
||||||
index["oneOf"].append(new_entry)
|
index["oneOf"].append(new_entry)
|
||||||
with open(destination_path / index_name, "w") as json_file:
|
with open(destination_path / index_name, "w") as json_file:
|
||||||
json.dump(index, json_file, indent=2)
|
json.dump(obj=index, fp=json_file, indent=2)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user