Skip to content

Add duplicate-key validation for model config JSONs#581

Open
akhilmmenon wants to merge 7 commits intomainfrom
github-actions/duplicate-object-check
Open

Add duplicate-key validation for model config JSONs#581
akhilmmenon wants to merge 7 commits intomainfrom
github-actions/duplicate-object-check

Conversation

@akhilmmenon
Copy link
Copy Markdown

Summary

  • add a new validation script at scripts/check_duplicate_keys.py to catch:
    • duplicate JSON object keys at any nesting level (e.g. duplicate model IDs like "gpt-4")
    • duplicate params[].key values within the same params array (e.g. two "max_tokens" entries)
  • update .github/workflows/validate-json.yml to run on both push and pull_request to main for pricing/** and general/**
  • add a new workflow step to run python3 scripts/check_duplicate_keys.py after existing jq syntax checks

Why

jq empty only validates JSON syntax and does not fail when duplicate object keys exist.
This change prevents silent config overrides and conflicting param definitions from being merged.

Test plan

  • run locally from models/:
    • python3 scripts/check_duplicate_keys.py
  • verify workflow behavior:
    • passes when no duplicate keys are present
    • fails with GitHub Actions ::error annotations when duplicates are found

Notes

  • current repo data already contains some duplicate params[].key entries (e.g. response_format in certain gpt-5* sections), so CI may fail until those are cleaned up.

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

Adds CI validation to prevent silent overrides in general/*.json and pricing/*.json by detecting duplicate JSON object keys and duplicate params[].key entries, complementing existing jq syntax checks.

Changes:

  • Added scripts/check_duplicate_keys.py to detect duplicate JSON object keys and duplicate params[].key values.
  • Updated validate-json.yml to run on push to main (path-filtered) in addition to pull_request.
  • Added a workflow step to execute the duplicate-key validation script after jq validation.

Reviewed changes

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

File Description
scripts/check_duplicate_keys.py New Python validator to detect duplicate JSON object keys and duplicate params[].key entries.
.github/workflows/validate-json.yml Adds push trigger and runs the new duplicate-key validator in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants