Skip to content

Stop relying on manifest.json to validate spec.yaml #20398

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

Merged
merged 6 commits into from
Jun 2, 2025
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
1 change: 1 addition & 0 deletions datadog_checks_dev/changelog.d/20398.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop relying on manifest.json to validate spec.yaml. Also stop checking the 'name' field in spec.yaml.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ...config_validator.validator_errors import SEVERITY_ERROR, SEVERITY_WARNING
from ...configuration import ConfigSpec
from ...configuration.consumers import ExampleConsumer
from ...constants import get_root
from ...manifest_utils import Manifest
from ...testing import process_checks_option
from ...utils import complete_valid_checks, get_config_files, get_data_directory, get_version_string
Expand Down Expand Up @@ -67,7 +68,7 @@ def config(ctx, check, sync, verbose):
echo_debug(f"Skipping validation for check: {check}; can't process manifest")
continue

spec_file_path = manifest.get_config_spec()
spec_file_path = path_join(get_root(), check, 'assets', 'configuration', 'spec.yaml')
if not file_exists(spec_file_path):
example_location = get_data_directory(check)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from ...configuration import ConfigSpec
from ...configuration.consumers import ModelConsumer
from ...constants import get_root
from ...manifest_utils import Manifest
from ...testing import process_checks_option
from ...utils import (
CUSTOM_FILES,
Expand Down Expand Up @@ -108,12 +107,9 @@ def models(ctx, check, sync, verbose):
source = 'test'
version = '0.0.1'
else:
manifest = Manifest.load_manifest(check)
if not manifest:
echo_debug(f"Skipping validation for check: {check}; can't process manifest")
continue
spec_path = manifest.get_config_spec()
spec_path = path_join(root, check, 'assets', 'configuration', 'spec.yaml')
if not file_exists(spec_path):
echo_debug(f"Skipping validation for check: {check}; 'spec.yaml' file doesn't exist")
continue

source = check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ def spec_validator(spec: dict, loader) -> None:
loader.errors.append(f'{loader.source}: Configuration specifications must be a mapping object')
return

if 'name' not in spec:
loader.errors.append(f'{loader.source}: Configuration specifications must contain a top-level `name` attribute')
return

name = spec['name']
if not isinstance(name, str):
loader.errors.append(f'{loader.source}: The top-level `name` attribute must be a string')
return

release_version = spec.setdefault('version', loader.version)
if not release_version:
loader.errors.append(
Expand Down
Loading
Loading