Skip to content

Remove additionalProperties from the JSON response schema#18

Merged
JasonTheAdams merged 2 commits intoWordPress:trunkfrom
dkotter:fix/invalid-response-schema
Apr 15, 2026
Merged

Remove additionalProperties from the JSON response schema#18
JasonTheAdams merged 2 commits intoWordPress:trunkfrom
dkotter:fix/invalid-response-schema

Conversation

@dkotter
Copy link
Copy Markdown
Contributor

@dkotter dkotter commented Apr 3, 2026

What?

Closes #17

Ensure we remove additionalProperties from JSON response schemas

Why?

If using the AI Client to make requests and you set a JSON response schema, OpenAI requires the additionalProperties key but Google will throw an error if this exists. We already remove that key from function declarations but we also need to remove it from JSON schemas

How?

  • Ensure the response schema is passed through the existing removeAdditionalPropertiesKey method
  • Update that method to process the items key, both top-level and nested

Use of AI Tools

Used Cursor running GPT-5.3 Codex to initially diagnose the problem (was reported on the WordPress AI plugin). Took the suggested fix, tested that and cleaned it up

Testing Instructions

Hard to test with this package alone, recommend testing with the AI plugin:

  1. Install the AI plugin
  2. Set the Google Provider up
  3. Turn on the Review Notes Experiment
  4. Trigger that on a post
  5. Ensure it works correctly and no errors are shown in the console

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@dkotter Great catch!

@JasonTheAdams JasonTheAdams merged commit bfbb502 into WordPress:trunk Apr 15, 2026
2 checks passed
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.

Google AI API does not allow the additionalProperties key for response schemas

3 participants