Skip to content

Conversation

@ddog-nasirthomas
Copy link
Contributor

@ddog-nasirthomas ddog-nasirthomas commented Oct 24, 2025

What does this PR do?

  • Non-existent option or value-level fields in spec.yaml are detected and reported when running ddev validate config.
  • The default field behavior is clarified for users by ensuring that both default_display and default are properly respected.
  • Fix existing spec.yaml fields with incorrect option or value level fields

Value and Option level fields were validated following these docs: https://datadoghq.dev/integrations-core/meta/config-specs/#example-file-consumer

Motivation

https://datadoghq.atlassian.net/browse/AI-5146

The issue was that this spec.yaml:

    - name: tenant
      required: false
      description: |
        A comma-separated list of tenant names, by default set to admin.
      value:
        type: string
        example: "admin,tenant_a,tenant_b"
        default: admin

generated this conf.yaml.example:

    ## @param tenant - string - optional - default: admin,tenant_a,tenant_b
    ## A comma-separated list of tenant names, by default set to admin.
    #
    # tenant: admin,tenant_a,tenant_b

Instead of using "admin" as default, it used "example".
It seemed like it was skipping 'default' in this method:

The goal of this change was so that we could detect fields that did not exist for the option or value level attributes and notify the user when running ddev validate config.

Also, as shown in the example, the default field was not being respected even though it’s a valid field. This change ensures that default will now be properly respected.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged


from datadog_checks.dev.tooling.configuration.constants import OPENAPI_SCHEMA_PROPERTIES

ALLOWED_OPTION_FIELDS = {
Copy link
Contributor Author

@ddog-nasirthomas ddog-nasirthomas Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if the ALLOWED_OPTION_FIELDS would be better suited in datadog_checks.dev.tooling.configuration.constants since the file seemed specific to Open API constants. Please let me know if I should move it. Thanks

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 13 to 16
- name: proxy_port
value: <PROXY_PORT>
description: The port of your proxy server.
value:
type: integer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep snowflake proxy option values as mappings

The proxy_port option now defines value: <PROXY_PORT> at the option level before the nested value: block. Because write_option assigns option['value'] to this string and then expects a mapping (value['type'] and value_type_string(value)), rendering the example or running ddev validate config will fail with a type error (str is not subscriptable) and the proxy settings cannot be documented. The same structure is duplicated for proxy_user and proxy_password below.

Useful? React with 👍 / 👎.

@ddog-nasirthomas
Copy link
Contributor Author

Please disregard

ddog-nasirthomas and others added 2 commits December 8, 2025 15:19
…6/ddev-validate-config-fields

Merge master into nasir.thomas/AI-5146/ddev-validate-config-field
AAraKKe
AAraKKe previously approved these changes Jan 23, 2026
Copy link
Contributor

@AAraKKe AAraKKe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the log delay @ddog-nasirthomas , I lost a bit of context of what we decided to do about what default and example meant. I remember though that the issue we discussed offline was outside the scope of this PR. I wanted to have the team come to agreement about what we wanted to do about this, in case it meant some changes from this pr. However, we never managed to discuss this.

I am approving it for now and discuss later the implications of what default/example mean.

Thanks for the contribution!

@temporal-github-worker-1 temporal-github-worker-1 bot dismissed AAraKKe’s stale review January 23, 2026 15:13

Review from AAraKKe is dismissed. Related teams and files:

  • agent-integrations
    • datadog_checks_dev/datadog_checks/dev/tooling/configuration/consumers/example.py
@datadog-datadog-prod-us1

This comment has been minimized.

@ddog-nasirthomas
Copy link
Contributor Author

A new config fleet_configurable , was added in this PR. I added that new field to the allowed option level fields so this does not produce errors for other users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment