mobiletto-orm-typedef-gen 2.1.39 → 2.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{{#if disclaimer}}// {{{ disclaimer }}}{{#if header}}
|
|
2
2
|
{{{header}}}{{/if}}
|
|
3
|
+
|
|
3
4
|
import * as yup from "yup";{{/if}}
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
export const {{Name}}SchemaFields = {{{curlyOpen}}}{{#each fields}}
|
|
5
7
|
{{name}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Schema{{else}}{{#if typeIsArray}}yup.array().of(yup.{{valueType}}{{else}}yup.{{type}}{{/if}}(){{#if typeIsString}}.trim().transform(v => v === '' ? undefined : v){{/if}}{{#if isEnum}}
|
|
6
8
|
{{arrayIndent}}.oneOf({{{enumValues}}}, '{{fullName}}_enum'){{/if}}{{#if minValue}}
|
|
7
9
|
{{arrayIndent}}.min({{minValue}}, '{{fullName}}_minValue'){{/if}}{{#if maxValue}}
|
|
@@ -32,4 +34,6 @@ export const {{Name}}Schema = yup.object({{{curlyOpen}}}{{#each fields}}
|
|
|
32
34
|
then: (schema) => schema.required('{{fullName}}_required'),
|
|
33
35
|
otherwise: (schema) => schema.notRequired(),
|
|
34
36
|
}){{/if}},{{/each}}
|
|
35
|
-
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const {{Name}}Schema = yup.object({{Name}}SchemaFields);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{{#if disclaimer}}// {{{ disclaimer }}}{{#if header}}
|
|
2
2
|
{{{header}}}{{/if}}
|
|
3
|
+
|
|
3
4
|
import * as yup from "yup";{{/if}}
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
export const {{Name}}SchemaFields = {{{curlyOpen}}}{{#each fields}}
|
|
5
7
|
{{name}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Schema{{else}}{{#if typeIsArray}}yup.array().of(yup.{{valueType}}{{else}}yup.{{type}}{{/if}}(){{#if typeIsString}}.trim().transform(v => v === '' ? undefined : v){{/if}}{{#if isEnum}}
|
|
6
8
|
{{arrayIndent}}.oneOf({{{enumValues}}}, '{{fullName}}_enum'){{/if}}{{#if minValue}}
|
|
7
9
|
{{arrayIndent}}.min({{minValue}}, '{{fullName}}_minValue'){{/if}}{{#if maxValue}}
|
|
@@ -32,4 +34,6 @@ export const {{Name}}Schema = yup.object({{{curlyOpen}}}{{#each fields}}
|
|
|
32
34
|
then: (schema) => schema.required('{{fullName}}_required'),
|
|
33
35
|
otherwise: (schema) => schema.notRequired(),
|
|
34
36
|
}){{/if}},{{/each}}
|
|
35
|
-
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const {{Name}}Schema = yup.object({{Name}}SchemaFields);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobiletto-orm-typedef-gen",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "generate various files based on mobiletto-orm-typedef definitions",
|
|
6
6
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"copyfiles": "^2.4.1",
|
|
52
52
|
"eslint": "^8.44.0",
|
|
53
53
|
"eslint-config-prettier": "^8.8.0",
|
|
54
|
-
"mobiletto-orm-typedef": "^2.1.
|
|
54
|
+
"mobiletto-orm-typedef": "^2.1.44",
|
|
55
55
|
"mocha": "^10.2.0",
|
|
56
56
|
"prettier": "^3.0.0",
|
|
57
57
|
"tslint-config-prettier": "^1.18.0",
|