Skip to content
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

feat: added support for reactive schemas #3238

Merged
merged 4 commits into from Apr 7, 2021
Merged

Conversation

logaretm
Copy link
Owner

@logaretm logaretm commented Mar 28, 2021

🔎 Overview

Adds support for reactive form schemas for the <Form /> and useForm

It allows using computed to create reactive schema objects

import * as yup from 'yup';
import { computed, ref } from 'vue';
import { useForm } from 'vee-validate';

const accepted = ref(['1', '2', '3']);
const schema = computed(() => {
  return yup.object({
    field: yup.string().oneOf(accepted.value);
  })
});

useForm({
  validationSchema: schema
});

Issues affected

closes #3235

@codecov-io
Copy link

codecov-io commented Apr 1, 2021

Codecov Report

Merging #3238 (4485ccd) into main (b029df5) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3238      +/-   ##
==========================================
+ Coverage   96.74%   96.76%   +0.01%     
==========================================
  Files          64       64              
  Lines        1473     1482       +9     
  Branches      359      363       +4     
==========================================
+ Hits         1425     1434       +9     
  Misses         47       47              
  Partials        1        1              
Impacted Files Coverage Δ
packages/vee-validate/src/Form.ts 100.00% <100.00%> (ø)
packages/vee-validate/src/useField.ts 98.25% <100.00%> (+0.02%) ⬆️
packages/vee-validate/src/useForm.ts 98.00% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b029df5...4485ccd. Read the comment docs.

@logaretm logaretm marked this pull request as ready for review April 2, 2021 14:10
@logaretm logaretm merged commit 295d656 into main Apr 7, 2021
@logaretm logaretm deleted the feat/reactive-schema branch April 7, 2021 13:33
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.

[v4] Support reactive form validation schema
2 participants