Skip to content

Enforce that tabs have at least one item.#798

Merged
jgindin merged 2 commits intogoogle:mainfrom
jgindin:at-least-one-tab-item
Mar 10, 2026
Merged

Enforce that tabs have at least one item.#798
jgindin merged 2 commits intogoogle:mainfrom
jgindin:at-least-one-tab-item

Conversation

@jgindin
Copy link
Copy Markdown
Collaborator

@jgindin jgindin commented Mar 9, 2026

Description

Prior to this change, it would be possible to have an empty array of tab items.

Pre-launch Checklist

  • [ x] I signed the CLA.
  • [ x] I read the Contributors Guide.
  • [ x] I read the Style Guide.
  • I have added updates to the CHANGELOG.
  • [ x] I updated/added relevant documentation.
  • [ x] My code changes (if any) have tests.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds a minItems: 1 constraint to the tabs array in both v0.9 and v0.10 specifications, ensuring a Tabs component cannot be empty. My feedback focuses on the lack of accompanying tests for this change, which is required by the repository's contribution guidelines. Please add test cases that verify an empty tabs array fails validation for both specification versions.

Note: Security Review has been skipped due to the limited scope of the PR.

Comment thread specification/v0_10/json/basic_catalog.json
"tabs": {
"type": "array",
"description": "An array of objects, where each object defines a tab with a title and a child component.",
"minItems": 1,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This change correctly enforces that a Tabs component must have at least one tab. However, it is missing a corresponding test case for the v0.9 specification. To ensure this constraint is validated, please add a test case with a Tabs component that has an empty tabs array and is expected to fail validation.

References
  1. If there are code changes, code should have tests. (link)

@jgindin jgindin merged commit cc9c07b into google:main Mar 10, 2026
9 checks passed
@jgindin jgindin deleted the at-least-one-tab-item branch March 10, 2026 16:33
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Mar 10, 2026
peterblazejewicz pushed a commit to peterblazejewicz/A2UI that referenced this pull request Apr 5, 2026
* Enforce that tabs have at least one item.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants