Skip to content

Commit

Permalink
fix: x-validator typo error (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin authored May 9, 2023
1 parent a0be694 commit d856abc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-squids-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/codesmith-formily': patch
---

fix: x-validator typo error
9 changes: 6 additions & 3 deletions packages/formily/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import {
isFunction,
} from '@modern-js/utils/lodash';
import { Question as InquirerQuestion } from 'inquirer';
import { validate } from '@formily/validator';
import { Validator, validate } from '@formily/validator';

export type Schema = Partial<
Pick<
FormilySchema,
'type' | 'title' | 'default' | 'enum' | 'x-validate' | 'x-reactions'
'type' | 'title' | 'default' | 'enum' | 'x-validator' | 'x-reactions'
>
> & {
properties?: Record<string, Schema>;
'x-validate'?: Validator; // fix typo error
};

export type Question = InquirerQuestion & { origin: Schema };
Expand Down Expand Up @@ -57,9 +58,11 @@ export function getQuestionFromSchema(
title,
default: defaultValue,
enum: items,
'x-validate': fieldValidate,
'x-validator': _fieldValidate_1,
'x-validate': _fieldValidate_2,
...extra
} = properties![field];
const fieldValidate = _fieldValidate_1 || _fieldValidate_2;
if (type === 'void' || type === 'object') {
return getQuestionFromSchema(
properties![field],
Expand Down

0 comments on commit d856abc

Please sign in to comment.