Skip to content

fix(config): exclude $schema from extra parameters sent to DNS APIs#576

Merged
NewFuture merged 2 commits into
masterfrom
copilot/fix-6290356-60844169-789a5ce2-b5d9-4a57-b0a1-ceb49f015fac
Nov 3, 2025
Merged

fix(config): exclude $schema from extra parameters sent to DNS APIs#576
NewFuture merged 2 commits into
masterfrom
copilot/fix-6290356-60844169-789a5ce2-b5d9-4a57-b0a1-ceb49f015fac

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 3, 2025

The $schema field from JSON config files was being passed to DNS provider APIs as an extra parameter, causing UnknownParameter errors in v4.1.1 (worked in v4.1.0).

Root Cause

$schema was not in the _known_keys set, so it was collected into the extra dict and unpacked via **extra when calling provider methods like _query_record() and _create_record().

Changes

  • ddns/config/config.py: Added $schema to _known_keys set to exclude it from extra parameters
  • tests/test_config_extra.py: Added test case to verify $schema exclusion

Example

Before fix, using this config:

{
  "$schema": "https://ddns.newfuture.cc/schema/v4.1.json",
  "dns": "tencentcloud",
  "extra": { "Remark": "DDNS" }
}

Would result in extra = {"$schema": "...", "Remark": "DDNS"} being sent to API.

After fix: extra = {"Remark": "DDNS"} (correct).

Original prompt

This section details on the original issue you should resolve

<issue_title>The parameter $schema is not recognized. (v4.1.1)</issue_title>
<issue_description>使用同样的配置文件,在4.1.0版本能正常运行,4.1.1版本报错
2025-11-03 14:49:52 ERROR [TencentCloudProvider]: TencentCloud API error: UnknownParameter - The parameter $schema is not recognized.</issue_description>

<agent_instructions>比较4.1.0和4.1.1相关的修改, 是否为 extra 参数带来的bug,并fix</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Copilot AI changed the title [WIP] The parameter $schema is not recognized. (v4.1.1) fix(config): exclude $schema from extra parameters sent to DNS APIs Nov 3, 2025
Copilot AI requested a review from NewFuture November 3, 2025 07:51
@NewFuture NewFuture requested a review from Copilot November 3, 2025 08:00
@NewFuture NewFuture marked this pull request as ready for review November 3, 2025 08:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents the $schema field from JSON configuration files from being collected as an extra field. The $schema field is a standard JSON Schema reference used for validation and IDE support, and should not be passed to DNS provider APIs.

  • Added $schema to the set of known configuration keys that are filtered out from extra fields
  • Added a comprehensive test to verify $schema is excluded while other extra fields are still collected

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ddns/config/config.py Added $schema to the _known_keys set to exclude it from extra field collection
tests/test_config_extra.py Added test case to verify $schema field is properly excluded from extra fields

@NewFuture NewFuture enabled auto-merge (squash) November 3, 2025 08:05
@NewFuture NewFuture merged commit ae5e9d0 into master Nov 3, 2025
30 of 44 checks passed
@NewFuture NewFuture deleted the copilot/fix-6290356-60844169-789a5ce2-b5d9-4a57-b0a1-ceb49f015fac branch November 3, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The parameter $schema is not recognized. (v4.1.1)

3 participants