Skip to content

feat: remove unsupported array schema properties and add validation #457

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

surendar-05
Copy link

Description

This PR addresses the issue with unsupported minItems and maxItems properties in array schemas that were causing API errors. Instead of allowing these properties to pass through to the API and fail, we now validate them early and provide a clear error message.

Changes

  • Removed minItems and maxItems from ArraySchema interface
  • Added validation to catch usage of these properties
  • Updated documentation to clarify limitations
  • Added test case for validation

Testing

  • Added unit test for validation
  • Manually tested with example usage
  • Ran full test suite

Fixes #200

Remove minItems and maxItems from ArraySchema interface
 Add validation to prevent usage of unsupported properties
Update documentation to clarify limitations
Add test case for validation
Copy link

google-cla bot commented Apr 6, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@MarkDaoust MarkDaoust left a comment

Choose a reason for hiding this comment

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

Hi, thanks for taking the time to create a PR.

minItems and maxItems properties in array schemas that were causing API errors.

When was this? The API definitely supports this.

Here's a quick example in python:

https://colab.research.google.com/drive/1ffoMRvPzRUvnP8zuYHt6mqCH-u9-piid

This works:

{"items":{"type":"NUMBER"},"max_items":4,"min_items":3,"type":"ARRAY"}

The API is insensitive to snake_case vs camelCase.

So I don't think removing this is the right approach.

@MarkDaoust MarkDaoust added the status: awaiting user response Awaiting a response from the author label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting user response Awaiting a response from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for minItems and maxItems for FunctionDeclarationSchemaType.ARRAY?
2 participants