a2ui-project / a2ui-project/a2ui
Improve error messages when attempting to convert unsupported schema features to Firebase AI Logic format
- 主要言語
- TypeScript
- スター
- 16.4k
- フォーク
- 1.3k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 134
説明
_↴ Ported from [flutter/genui#415](https://github.com/flutter/genui/issues/415) — originally opened by [juan-vgv](https://github.com/juan-vgv) on 2025-10-21._
_Original labels: P2_
---
**Describe the bug**
There seems to be an issue in which creating a component with `ListSchema` with `uniqueItems: true` will trigger the following warning:
`
[WARNING] 2025-10-21 15:03:22.543: Errors adapting parameters for tool surfaceUpdate: Error at path "#/properties/components/items/properties/component/properties/XXXX/properties/items": Unsupported keyword "uniqueItems". It will be ignored.
`
**To Reproduce**
Steps to reproduce the behavior:
1. Create a component with `ListSchema` and `uniqueItems: true`
2. Run the app
**Expected behavior**
No warning.
**Additional context**
Tested with `FirebaseAiClient` and latest commit from the repo beb5be5828f113cfde5dc738c9af16c2b3a07c52
---
### 2 comment(s) from the original issue
**[jacobsimionato](https://github.com/jacobsimionato)** commented on 2025-10-23:
Hi Juan!
Thanks for the report.
The underlying issue here is that the `json_schema_builder` library supports the full JSON specification, but Gemini (and other major LLM products) only support a subset of JSON schema features in structured output mode and function calling interfaces. There is some documentation of that here: https://ai.google.dev/gemini-api/docs/structured-output#json-schemas
We've chosen to build the Gen UI library on top of a generic JSON schema library rather than a limited one to make it easier to support the different and changing schema features of different models, and so that developers are free to use `json_schema_builder` as a generic schema library similar to `zod` in libraries which interop with Gen UI.
The error you're seeing is being thrown from the schema adapter at https://github.com/flutter/genui/blob/c369890604868e86d7b2e7b335789c7a6ceffba2/packages/flutter_genui_firebase_ai/lib/src/gemini_schema_adapter.dart#L372
Perhaps what we need here is an improved error message so that it's clear why this doesn't work? We'd love your suggestions!
---
**[juan-vgv](https://github.com/juan-vgv)** commented on 2025-10-27:
Ahhh, ok, I understand.
And yes, a more clear error message will definitely go a long way, but also maybe add a warning in the [json_schema_builder](https://github.com/flutter/genui/tree/main/packages/json_schema_builder) documentation with something like:
> Even though this library is JSON Schema 2020-12 compatible, most LLMs only take a subset, here's Gemini's...
Thanks!
コントリビューションガイド
評価
この issue はまだ評価されていません。