Skip to content

fix(vue-vanilla): fix type coercion for Enum and OneOfEnum controls#3

Merged
darius-lesch merged 1 commit into
fix/enum-coercion-for-vue-vanillafrom
fix-vue-vanilla-enum-coercion-4822673399870400796
Jul 23, 2026
Merged

fix(vue-vanilla): fix type coercion for Enum and OneOfEnum controls#3
darius-lesch merged 1 commit into
fix/enum-coercion-for-vue-vanillafrom
fix-vue-vanilla-enum-coercion-4822673399870400796

Conversation

@darius-lesch

Copy link
Copy Markdown
Owner

Fixed type coercion in vue-vanilla enum and oneOf dropdowns.

Previously, target.value was used to grab the selected value from <select> inputs in EnumControlRenderer and EnumOneOfControlRenderer. This would implicitly coerce all values into strings, breaking schemas that demanded strictly typed values (e.g. integer schemas).

This changes both controls to look up the typed value using input.control.value.options[target.selectedIndex - 1].value, preserving the correct original type (e.g. number, boolean, etc.). Tests were expanded to explicitly ensure that numbers remain correctly typed.


PR created automatically by Jules for task 4822673399870400796 started by @darius-lesch

This commit fixes an issue where selecting an integer value in the `EnumControlRenderer` or `EnumOneOfControlRenderer` would incorrectly write a stringified version of the integer to the JSONForms data state, causing validation errors.

The components were updated to look up the correct value from `options` using `selectedIndex - 1` (accounting for the hardcoded empty option at index 0) instead of relying on `target.value`.

Additional tests were added to explicitly verify this behavior with an `integer` based schema.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@darius-lesch
darius-lesch changed the base branch from master to fix/enum-coercion-for-vue-vanilla July 23, 2026 21:23
@darius-lesch
darius-lesch merged commit d73dbd2 into fix/enum-coercion-for-vue-vanilla Jul 23, 2026
@darius-lesch
darius-lesch deleted the fix-vue-vanilla-enum-coercion-4822673399870400796 branch July 23, 2026 21:23
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.

1 participant