Skip to content
Snippets Groups Projects
Unverified Commit ca08b709 authored by Franck Nijhof's avatar Franck Nijhof Committed by GitHub
Browse files

Revert removal of JSON validator in hassfest (#34504)

parent 867138eb
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from . import (
config_flow,
coverage,
dependencies,
json,
manifest,
services,
ssdp,
......@@ -18,6 +19,7 @@ from . import (
from .model import Config, Integration
INTEGRATION_PLUGINS = [
json,
codeowners,
config_flow,
dependencies,
......
"""Validate integration JSON files."""
import json
from typing import Dict
from .model import Integration
def validate_json_files(integration: Integration):
"""Validate JSON files for integration."""
for json_file in integration.path.glob("**/*.json"):
if not json_file.is_file():
continue
try:
json.loads(json_file.read_text())
except json.JSONDecodeError:
relative_path = json_file.relative_to(integration.path)
integration.add_error("json", f"Invalid JSON file {relative_path}")
return
def validate(integrations: Dict[str, Integration], config):
"""Handle JSON files inside integrations."""
if not config.specific_integrations:
return
for integration in integrations.values():
if not integration.manifest:
continue
validate_json_files(integration)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment