You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bc9d6bb
Browse filesBrowse the repository at this point in the historyBrowse files
refactor!: rename FormAIController API to include field (#9544) (CP: 25.2) (#9547)
This PR cherry-picks changes from the original PR #9544 to branch 25.2.
---
#### Original PR description
> ## Description
>
> This PR renames `FormAIController` APIs to include "field" in order to
make it clearer for the developer.
>
> | Old | New |
> | --- | --- |
> | ignore | ignoreField |
> | describe | describeField |
> | valueOptions | fieldValueOptions |
> | setValuesHidden | setFieldValuesHidden |
> | isValuesHidden | isFieldValuesHidden |
> | showHighlight | showFieldHighlight |
> | hideHighlight | hideFieldHighlight |
>
> Based on DX test session findings.
>
> No related issue.
>
> ## Type of change
>
> - [ ] Bugfix
> - [ ] Feature
> - [x] Refactor
>
> ## Checklist
>
> - [x] I have read the contribution guide:
https://vaadin.com/docs/latest/contributing/overview
> - [x] I have added a description following the guideline.
> - [ ] The issue is created in the corresponding repository and I have
referenced it.
> - [ ] I have added tests to ensure my change is effective and works as
intended.
> - [x] New and existing tests are passing locally with my change.
> - [x] I have performed self-review and corrected misspellings.
Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/FormAIController.java
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/FormFieldHighlighter.java
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/FormFieldHints.java
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,14 +23,14 @@
23
23
* Mutable per-field hint state held by {@link FormAIController}, keyed by the
24
24
* field's opaque id.
25
25
* <p>
26
-
* Set by {@link FormAIController#valueOptions(ValueOptions)
27
-
* controller.valueOptions(...)}: {@link #valueOptionsQuery} carries the filter
28
-
* callback (or a fixed-options snapshot wrapped in one), {@link #fixedOptions}
29
-
* flags whether the schema should render the options as {@code enum} or
30
-
* {@code queryable}, and {@link #valueOptionsToValue} resolves one label to one
31
-
* element. For multi-select fields the controller wraps the resolved elements
32
-
* into a {@link java.util.LinkedHashSet} before {@code setValue}; the hint
33
-
* state is the same shape in both cases.
26
+
* Set by {@link FormAIController#fieldValueOptions(ValueOptions)
27
+
* controller.fieldValueOptions(...)}: {@link #valueOptionsQuery} carries the
28
+
* filter callback (or a fixed-options snapshot wrapped in one),
29
+
* {@link #fixedOptions} flags whether the schema should render the options as
30
+
* {@code enum} or {@code queryable}, and {@link #valueOptionsToValue} resolves
31
+
* one label to one element. For multi-select fields the controller wraps the
32
+
* resolved elements into a {@link java.util.LinkedHashSet} before
33
+
* {@code setValue}; the hint state is the same shape in both cases.
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/FormFieldSchema.java
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/FormValueConverter.java
+28-25Lines changed: 28 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -181,36 +181,38 @@ static final class RejectedValueException extends RuntimeException {
181
181
* {@link HasValue#setValue}. Returns the field's empty value when the JSON
182
182
* node is {@code null} or a JSON {@code null}. Throws
183
183
* {@link RejectedValueException} when the JSON shape doesn't match the
184
-
* field's type, or when the registered {@code valueOptions} cannot resolve
185
-
* a label.
184
+
* field's type, or when the registered {@code fieldValueOptions} cannot
185
+
* resolve a label.
186
186
* <p>
187
-
* <b>Selection and {@code valueOptions} routing:</b> when a field has a
188
-
* {@code valueOptionsToValue} registered, the LLM sees the field as an
187
+
* <b>Selection and {@code fieldValueOptions} routing:</b> when a field has
188
+
* a {@code valueOptionsToValue} registered, the LLM sees the field as an
189
189
* {@code enum} or {@code queryable} string in {@code get_form_state} and
190
190
* picks one or more labels. The label-to-value resolution happens here so
191
191
* the resulting object matches the field's value type before
192
192
* {@link HasValue#setValue} sees it. Multi-select fields expect a JSON
193
193
* array of labels; single-select and other label-routed fields expect a
194
-
* single string. A selection field without a {@code valueOptions}
194
+
* single string. A selection field without a {@code fieldValueOptions}
195
195
* registration falls back to matching the supplied label(s) against the
196
196
* field's own in-memory items (an eager {@code setItems(...)}), which carry
197
197
* the same labels {@code get_form_state} advertised; only a field that has
198
-
* neither a {@code valueOptions} registration nor items is rejected with a
199
-
* curated reason naming the missing registration.
198
+
* neither a {@code fieldValueOptions} registration nor items is rejected
199
+
* with a curated reason naming the missing registration.
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/form/ValueOptions.java
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -31,15 +31,15 @@
31
31
* The label set is either fixed ({@link #options(Collection)}) or supplied on
32
32
* demand by a callback ({@link #options(BiFunction)}); exactly one of the two
33
33
* must be set, with the last call winning. Pass the configured registration to
Copy file name to clipboardExpand all lines: vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/test/java/com/vaadin/flow/component/ai/AIComponentsSerializableTest.java
0 commit comments