@innet/server 2.0.0-beta.4 → 2.0.0-beta.5

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.
Files changed (45) hide show
  1. package/README.md +215 -0
  2. package/handler/handler.d.ts +1 -1
  3. package/hooks/index.d.ts +24 -24
  4. package/hooks/index.es6.js +24 -24
  5. package/hooks/index.js +24 -24
  6. package/index.d.ts +2 -2
  7. package/index.es6.js +86 -86
  8. package/index.js +195 -195
  9. package/package.json +3 -3
  10. package/plugins/index.d.ts +2 -2
  11. package/plugins/index.es6.js +2 -2
  12. package/plugins/index.js +2 -2
  13. package/plugins/main/index.d.ts +8 -8
  14. package/plugins/main/index.es6.js +8 -8
  15. package/plugins/main/index.js +8 -8
  16. package/plugins/request/index.d.ts +5 -5
  17. package/plugins/request/index.es6.js +5 -5
  18. package/plugins/request/index.js +5 -5
  19. package/plugins/schema/array/array.d.ts +3 -0
  20. package/plugins/schema/array/array.es6.js +10 -1
  21. package/plugins/schema/array/array.js +10 -1
  22. package/plugins/schema/field/field.d.ts +2 -0
  23. package/plugins/schema/field/field.es6.js +7 -1
  24. package/plugins/schema/field/field.js +7 -1
  25. package/plugins/schema/index.d.ts +8 -8
  26. package/plugins/schema/index.es6.js +8 -8
  27. package/plugins/schema/index.js +8 -8
  28. package/plugins/schema/integer/integer.d.ts +37 -0
  29. package/plugins/schema/integer/integer.es6.js +21 -7
  30. package/plugins/schema/integer/integer.js +21 -7
  31. package/plugins/schema/number/number.d.ts +32 -0
  32. package/plugins/schema/number/number.es6.js +21 -5
  33. package/plugins/schema/number/number.js +21 -5
  34. package/plugins/schema/string/string.d.ts +27 -0
  35. package/plugins/schema/string/string.es6.js +9 -3
  36. package/plugins/schema/string/string.js +9 -3
  37. package/plugins/utils/index.d.ts +2 -2
  38. package/plugins/utils/index.es6.js +2 -2
  39. package/plugins/utils/index.js +2 -2
  40. package/utils/index.d.ts +8 -8
  41. package/utils/index.es6.js +8 -8
  42. package/utils/index.js +8 -8
  43. package/utils/rules/index.d.ts +17 -17
  44. package/utils/rules/index.es6.js +17 -17
  45. package/utils/rules/index.js +18 -18
@@ -18,11 +18,20 @@ const array = () => {
18
18
  useBlock('path');
19
19
  const setRule = useContext(ruleContext);
20
20
  const handler = useNewHandler();
21
- const { children, ...props } = useProps();
21
+ const { children, maxItems, minItems, uniqueItems, ...props } = useProps();
22
22
  const schema = useSchemaType('array', props);
23
23
  const fieldSchema = {};
24
24
  handler[schemaContext.key] = fieldSchema;
25
25
  schema.items = fieldSchema;
26
+ if (maxItems) {
27
+ schema.maxItems = maxItems;
28
+ }
29
+ if (minItems) {
30
+ schema.minItems = minItems;
31
+ }
32
+ if (uniqueItems) {
33
+ schema.uniqueItems = uniqueItems;
34
+ }
26
35
  if (setRule) {
27
36
  let oneOfRulesMap;
28
37
  const rules = [];
@@ -22,11 +22,20 @@ const array = () => {
22
22
  useBlock.useBlock('path');
23
23
  const setRule = jsx.useContext(useRule.ruleContext);
24
24
  const handler = innet.useNewHandler();
25
- const { children, ...props } = jsx.useProps();
25
+ const { children, maxItems, minItems, uniqueItems, ...props } = jsx.useProps();
26
26
  const schema = useSchemaType.useSchemaType('array', props);
27
27
  const fieldSchema = {};
28
28
  handler[useSchemaContext.schemaContext.key] = fieldSchema;
29
29
  schema.items = fieldSchema;
30
+ if (maxItems) {
31
+ schema.maxItems = maxItems;
32
+ }
33
+ if (minItems) {
34
+ schema.minItems = minItems;
35
+ }
36
+ if (uniqueItems) {
37
+ schema.uniqueItems = uniqueItems;
38
+ }
30
39
  if (setRule) {
31
40
  let oneOfRulesMap;
32
41
  const rules = [];
@@ -4,5 +4,7 @@ export interface FieldProps {
4
4
  deprecated?: boolean;
5
5
  key: string;
6
6
  optional?: boolean;
7
+ readOnly?: boolean;
8
+ writeOnly?: boolean;
7
9
  }
8
10
  export declare const field: HandlerPlugin;
@@ -10,7 +10,7 @@ import { required } from '../../../utils/rules/required/required.es6.js';
10
10
 
11
11
  const field = () => {
12
12
  const handler = useNewHandler();
13
- const { children, deprecated, key, optional, } = useProps();
13
+ const { children, deprecated, key, optional, readOnly, writeOnly, } = useProps();
14
14
  const schema = useObjectSchemaContext();
15
15
  if (!schema.properties) {
16
16
  schema.properties = {};
@@ -23,6 +23,12 @@ const field = () => {
23
23
  if (deprecated) {
24
24
  fieldSchema.deprecated = true;
25
25
  }
26
+ if (readOnly) {
27
+ fieldSchema.readOnly = true;
28
+ }
29
+ if (writeOnly) {
30
+ fieldSchema.writeOnly = true;
31
+ }
26
32
  schema.properties[key] = fieldSchema;
27
33
  if (!optional) {
28
34
  if (!schema.required) {
@@ -14,7 +14,7 @@ var required = require('../../../utils/rules/required/required.js');
14
14
 
15
15
  const field = () => {
16
16
  const handler = innet.useNewHandler();
17
- const { children, deprecated, key, optional, } = jsx.useProps();
17
+ const { children, deprecated, key, optional, readOnly, writeOnly, } = jsx.useProps();
18
18
  const schema = useObjectSchemaContext.useObjectSchemaContext();
19
19
  if (!schema.properties) {
20
20
  schema.properties = {};
@@ -27,6 +27,12 @@ const field = () => {
27
27
  if (deprecated) {
28
28
  fieldSchema.deprecated = true;
29
29
  }
30
+ if (readOnly) {
31
+ fieldSchema.readOnly = true;
32
+ }
33
+ if (writeOnly) {
34
+ fieldSchema.writeOnly = true;
35
+ }
30
36
  schema.properties[key] = fieldSchema;
31
37
  if (!optional) {
32
38
  if (!schema.required) {
@@ -1,13 +1,13 @@
1
- export * from './object';
2
- export * from './field';
3
- export * from './number';
4
- export * from './integer';
5
- export * from './string';
1
+ export * from './any';
6
2
  export * from './array';
3
+ export * from './binary';
7
4
  export * from './boolean';
8
- export * from './null';
9
5
  export * from './date';
6
+ export * from './field';
7
+ export * from './integer';
8
+ export * from './null';
9
+ export * from './number';
10
+ export * from './object';
11
+ export * from './string';
10
12
  export * from './tuple';
11
13
  export * from './uuid';
12
- export * from './binary';
13
- export * from './any';
@@ -1,13 +1,13 @@
1
- import './object/index.es6.js';
2
- import './field/index.es6.js';
3
- import './number/index.es6.js';
4
- import './integer/index.es6.js';
5
- import './string/index.es6.js';
1
+ import './any/index.es6.js';
6
2
  import './array/index.es6.js';
3
+ import './binary/index.es6.js';
7
4
  import './boolean/index.es6.js';
8
- import './null/index.es6.js';
9
5
  import './date/index.es6.js';
6
+ import './field/index.es6.js';
7
+ import './integer/index.es6.js';
8
+ import './null/index.es6.js';
9
+ import './number/index.es6.js';
10
+ import './object/index.es6.js';
11
+ import './string/index.es6.js';
10
12
  import './tuple/index.es6.js';
11
13
  import './uuid/index.es6.js';
12
- import './binary/index.es6.js';
13
- import './any/index.es6.js';
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- require('./object/index.js');
4
- require('./field/index.js');
5
- require('./number/index.js');
6
- require('./integer/index.js');
7
- require('./string/index.js');
3
+ require('./any/index.js');
8
4
  require('./array/index.js');
5
+ require('./binary/index.js');
9
6
  require('./boolean/index.js');
10
- require('./null/index.js');
11
7
  require('./date/index.js');
8
+ require('./field/index.js');
9
+ require('./integer/index.js');
10
+ require('./null/index.js');
11
+ require('./number/index.js');
12
+ require('./object/index.js');
13
+ require('./string/index.js');
12
14
  require('./tuple/index.js');
13
15
  require('./uuid/index.js');
14
- require('./binary/index.js');
15
- require('./any/index.js');
16
16
 
@@ -1,8 +1,45 @@
1
1
  import { type HandlerPlugin } from 'innet';
2
2
  import { type IntegerFormats, type ValuesSchemaProps } from '../../../types';
3
3
  export interface IntegerProps extends ValuesSchemaProps<bigint | number> {
4
+ /**
5
+ * The `exclusiveMaximum` keyword is used to restrict the value to be less than the specified number.
6
+ * @example For example, the following value is valid:
7
+ * ```tsx
8
+ * <integer exclusiveMaximum={10} />
9
+ * ```
10
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
11
+ * */
12
+ exclusiveMaximum?: bigint | boolean | number;
13
+ /**
14
+ * The `exclusiveMinimum` keyword is used to restrict the value to be greater than the specified number.
15
+ * @example For example, the following value is valid:
16
+ * ```tsx
17
+ * <integer exclusiveMinimum={10} />
18
+ * ```
19
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
20
+ * */
21
+ exclusiveMinimum?: bigint | boolean | number;
22
+ /**
23
+ * An optional format modifier serves as a hint at the contents and format of the string.
24
+ * @example For example, the following value is valid:
25
+ * ```tsx
26
+ * <integer format='int64' />
27
+ * ```
28
+ * @see https://swagger.io/docs/specification/data-models/data-types/#numbers
29
+ * */
4
30
  format?: IntegerFormats;
31
+ /** Validate the integer number value by maximum. */
5
32
  max?: bigint | number;
33
+ /** Validate the integer number value by minimum. */
6
34
  min?: bigint | number;
35
+ /**
36
+ * The `multipleOf` keyword is used to restrict the value to be a multiple of the specified number.
37
+ * @example For example, the following value is valid:
38
+ * ```tsx
39
+ * <number multipleOf={2} />
40
+ * ```
41
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
42
+ * */
43
+ multipleOf?: bigint | number;
7
44
  }
8
45
  export declare const integer: HandlerPlugin;
@@ -12,7 +12,7 @@ import { optional } from '../../../utils/rules/optional/optional.es6.js';
12
12
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
13
13
 
14
14
  const integer = () => {
15
- const { default: defaultValue, example, examples, format = 'int32', max: max$1, min: min$1, values: values$1, ...props } = useProps() || {};
15
+ const { default: defaultValue, example, examples, exclusiveMaximum, exclusiveMinimum, format = 'int32', max: max$1, min: min$1, multipleOf, values: values$1, ...props } = useProps() || {};
16
16
  const schema = useSchemaType('integer', {
17
17
  ...props,
18
18
  default: defaultValue !== undefined ? Number(defaultValue) : undefined,
@@ -20,12 +20,26 @@ const integer = () => {
20
20
  examples: examples === null || examples === void 0 ? void 0 : examples.map(Number),
21
21
  values: values$1 === null || values$1 === void 0 ? void 0 : values$1.map(Number),
22
22
  });
23
- // @ts-expect-error: FIXME
24
- schema.format = format;
25
- // @ts-expect-error: FIXME
26
- schema.minimum = min$1 !== undefined ? Number(min$1) : undefined;
27
- // @ts-expect-error: FIXME
28
- schema.maximum = max$1 !== undefined ? Number(max$1) : undefined;
23
+ if (schema) {
24
+ if (format) {
25
+ schema.format = format;
26
+ }
27
+ if (min$1 !== undefined) {
28
+ schema.minimum = Number(min$1);
29
+ }
30
+ if (max$1 !== undefined) {
31
+ schema.maximum = Number(max$1);
32
+ }
33
+ if (exclusiveMinimum) {
34
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
35
+ }
36
+ if (exclusiveMaximum) {
37
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
38
+ }
39
+ if (multipleOf !== undefined) {
40
+ schema.multipleOf = Number(multipleOf);
41
+ }
42
+ }
29
43
  const rules = [];
30
44
  if (defaultValue !== undefined) {
31
45
  rules.push(defaultTo(defaultValue));
@@ -16,7 +16,7 @@ var optional = require('../../../utils/rules/optional/optional.js');
16
16
  var pipe = require('../../../utils/rules/pipe/pipe.js');
17
17
 
18
18
  const integer = () => {
19
- const { default: defaultValue, example, examples, format = 'int32', max: max$1, min: min$1, values: values$1, ...props } = jsx.useProps() || {};
19
+ const { default: defaultValue, example, examples, exclusiveMaximum, exclusiveMinimum, format = 'int32', max: max$1, min: min$1, multipleOf, values: values$1, ...props } = jsx.useProps() || {};
20
20
  const schema = useSchemaType.useSchemaType('integer', {
21
21
  ...props,
22
22
  default: defaultValue !== undefined ? Number(defaultValue) : undefined,
@@ -24,12 +24,26 @@ const integer = () => {
24
24
  examples: examples === null || examples === void 0 ? void 0 : examples.map(Number),
25
25
  values: values$1 === null || values$1 === void 0 ? void 0 : values$1.map(Number),
26
26
  });
27
- // @ts-expect-error: FIXME
28
- schema.format = format;
29
- // @ts-expect-error: FIXME
30
- schema.minimum = min$1 !== undefined ? Number(min$1) : undefined;
31
- // @ts-expect-error: FIXME
32
- schema.maximum = max$1 !== undefined ? Number(max$1) : undefined;
27
+ if (schema) {
28
+ if (format) {
29
+ schema.format = format;
30
+ }
31
+ if (min$1 !== undefined) {
32
+ schema.minimum = Number(min$1);
33
+ }
34
+ if (max$1 !== undefined) {
35
+ schema.maximum = Number(max$1);
36
+ }
37
+ if (exclusiveMinimum) {
38
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
39
+ }
40
+ if (exclusiveMaximum) {
41
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
42
+ }
43
+ if (multipleOf !== undefined) {
44
+ schema.multipleOf = Number(multipleOf);
45
+ }
46
+ }
33
47
  const rules = [];
34
48
  if (defaultValue !== undefined) {
35
49
  rules.push(defaultTo.defaultTo(defaultValue));
@@ -1,9 +1,41 @@
1
1
  import { type HandlerPlugin } from 'innet';
2
2
  import { type ValuesSchemaProps } from '../../../types';
3
3
  export interface NumberProps extends ValuesSchemaProps<number> {
4
+ /**
5
+ * The `exclusiveMaximum` keyword is used to restrict the value to be less than the specified number.
6
+ * @example For example, the following value is valid:
7
+ * ```tsx
8
+ * <number exclusiveMaximum={10} />
9
+ * ```
10
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
11
+ * */
12
+ exclusiveMaximum?: boolean;
13
+ /**
14
+ * The `exclusiveMinimum` keyword is used to restrict the value to be greater than the specified number.
15
+ * @example For example, the following value is valid:
16
+ * ```tsx
17
+ * <number exclusiveMinimum={10} />
18
+ * ```
19
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
20
+ * */
21
+ exclusiveMinimum?: boolean;
22
+ /**
23
+ * An optional format modifier serves as a hint at the contents and format of the string.
24
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
25
+ * */
26
+ format?: 'double' | 'float' | (string & {});
4
27
  /** Validate the number value by maximum. */
5
28
  max?: number;
6
29
  /** Validate the number value by minimum. */
7
30
  min?: number;
31
+ /**
32
+ * The `multipleOf` keyword is used to restrict the value to be a multiple of the specified number.
33
+ * @example For example, the following value is valid:
34
+ * ```tsx
35
+ * <number multipleOf={2} />
36
+ * ```
37
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
38
+ * */
39
+ multipleOf?: number;
8
40
  }
9
41
  export declare const number: HandlerPlugin;
@@ -13,12 +13,28 @@ import { useRule } from '../../../hooks/useRule/useRule.es6.js';
13
13
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
14
14
 
15
15
  const number = () => {
16
- const { max: max$1, min: min$1, ...props } = useProps() || {};
16
+ const { exclusiveMaximum, exclusiveMinimum, format, max: max$1, min: min$1, multipleOf, ...props } = useProps() || {};
17
17
  const schema = useSchemaType('number', props);
18
- // @ts-expect-error: FIXME
19
- schema.minimum = min$1;
20
- // @ts-expect-error: FIXME
21
- schema.maximum = max$1;
18
+ if (schema) {
19
+ if (format !== undefined) {
20
+ schema.format = format;
21
+ }
22
+ if (min$1 !== undefined) {
23
+ schema.minimum = min$1;
24
+ }
25
+ if (max$1 !== undefined) {
26
+ schema.maximum = max$1;
27
+ }
28
+ if (exclusiveMinimum) {
29
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
30
+ }
31
+ if (exclusiveMaximum) {
32
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
33
+ }
34
+ if (multipleOf !== undefined) {
35
+ schema.multipleOf = Number(multipleOf);
36
+ }
37
+ }
22
38
  const rules = [];
23
39
  if (props.default !== undefined) {
24
40
  rules.push(defaultTo(props.default));
@@ -17,12 +17,28 @@ var useRule = require('../../../hooks/useRule/useRule.js');
17
17
  var pipe = require('../../../utils/rules/pipe/pipe.js');
18
18
 
19
19
  const number = () => {
20
- const { max: max$1, min: min$1, ...props } = jsx.useProps() || {};
20
+ const { exclusiveMaximum, exclusiveMinimum, format, max: max$1, min: min$1, multipleOf, ...props } = jsx.useProps() || {};
21
21
  const schema = useSchemaType.useSchemaType('number', props);
22
- // @ts-expect-error: FIXME
23
- schema.minimum = min$1;
24
- // @ts-expect-error: FIXME
25
- schema.maximum = max$1;
22
+ if (schema) {
23
+ if (format !== undefined) {
24
+ schema.format = format;
25
+ }
26
+ if (min$1 !== undefined) {
27
+ schema.minimum = min$1;
28
+ }
29
+ if (max$1 !== undefined) {
30
+ schema.maximum = max$1;
31
+ }
32
+ if (exclusiveMinimum) {
33
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
34
+ }
35
+ if (exclusiveMaximum) {
36
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
37
+ }
38
+ if (multipleOf !== undefined) {
39
+ schema.multipleOf = Number(multipleOf);
40
+ }
41
+ }
26
42
  const rules = [];
27
43
  if (props.default !== undefined) {
28
44
  rules.push(defaultTo.defaultTo(props.default));
@@ -1,9 +1,36 @@
1
1
  import { type HandlerPlugin } from 'innet';
2
2
  import { type ValuesSchemaProps } from '../../../types';
3
3
  export interface StringProps extends ValuesSchemaProps<string> {
4
+ /**
5
+ * An optional format modifier serves as a hint at the contents and format of the string.
6
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
7
+ * */
8
+ format?: 'binary' | 'byte' | 'date' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'password' | 'uri' | 'uuid' | (string & {});
9
+ /**
10
+ * String length can be restricted using `min` and `max`.
11
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
12
+ * */
4
13
  max?: number;
14
+ /**
15
+ * String length can be restricted using `min` and `max`.
16
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
17
+ * */
5
18
  min?: number;
19
+ /**
20
+ * The pattern keyword lets you define a regular expression template for the string value.
21
+ * Only the values that match this template will be accepted.
22
+ * The regular expression syntax used is from JavaScript (more specifically, ECMA 262).
23
+ * Regular expressions are case-sensitive, that is, [a-z] and [A-Z] are different expressions.
24
+ * @example For example, the following pattern matches a Social Security Number (SSN) in the 123-45-6789 format:
25
+ * ```tsx
26
+ * <string pattern='^\d{3}-\d{2}-\d{4}$' />
27
+ * ```
28
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
29
+ * */
6
30
  pattern?: RegExp | string;
31
+ /**
32
+ * The `patternId` keyword is used to reference a pattern from the OpenAPI specification.
33
+ * */
7
34
  patternId?: string;
8
35
  }
9
36
  export declare const string: HandlerPlugin;
@@ -14,11 +14,14 @@ import { useRule } from '../../../hooks/useRule/useRule.es6.js';
14
14
  import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
15
15
 
16
16
  const string = () => {
17
- const { max, min, pattern: pattern$1, patternId, ...props } = useProps() || {};
17
+ const { format, max, min, pattern: pattern$1, patternId, ...props } = useProps() || {};
18
18
  const { refRules } = useApi();
19
19
  const schema = useSchemaType('string', props);
20
20
  if (schema) {
21
21
  const rules = [];
22
+ if (format !== undefined) {
23
+ schema.format = format;
24
+ }
22
25
  if (props.default !== undefined) {
23
26
  rules.push(defaultTo(props.default));
24
27
  }
@@ -26,12 +29,15 @@ const string = () => {
26
29
  if (props.values) {
27
30
  rules.push(values(props.values));
28
31
  }
32
+ if (format !== undefined) {
33
+ schema.format = format;
34
+ }
29
35
  if (min !== undefined) {
30
- schema.minimum = min;
36
+ schema.minLength = min;
31
37
  rules.push(minLength(min));
32
38
  }
33
39
  if (max !== undefined) {
34
- schema.maximum = max;
40
+ schema.maxLength = max;
35
41
  rules.push(maxLength(max));
36
42
  }
37
43
  if (pattern$1 !== undefined) {
@@ -18,11 +18,14 @@ var useRule = require('../../../hooks/useRule/useRule.js');
18
18
  var useParentRule = require('../../../hooks/useParentRule/useParentRule.js');
19
19
 
20
20
  const string = () => {
21
- const { max, min, pattern: pattern$1, patternId, ...props } = jsx.useProps() || {};
21
+ const { format, max, min, pattern: pattern$1, patternId, ...props } = jsx.useProps() || {};
22
22
  const { refRules } = useApi.useApi();
23
23
  const schema = useSchemaType.useSchemaType('string', props);
24
24
  if (schema) {
25
25
  const rules = [];
26
+ if (format !== undefined) {
27
+ schema.format = format;
28
+ }
26
29
  if (props.default !== undefined) {
27
30
  rules.push(defaultTo.defaultTo(props.default));
28
31
  }
@@ -30,12 +33,15 @@ const string = () => {
30
33
  if (props.values) {
31
34
  rules.push(values.values(props.values));
32
35
  }
36
+ if (format !== undefined) {
37
+ schema.format = format;
38
+ }
33
39
  if (min !== undefined) {
34
- schema.minimum = min;
40
+ schema.minLength = min;
35
41
  rules.push(minLength.minLength(min));
36
42
  }
37
43
  if (max !== undefined) {
38
- schema.maximum = max;
44
+ schema.maxLength = max;
39
45
  rules.push(maxLength.maxLength(max));
40
46
  }
41
47
  if (pattern$1 !== undefined) {
@@ -1,6 +1,6 @@
1
- export * from './swagger';
1
+ export * from './blacklist';
2
2
  export * from './dts';
3
3
  export * from './env';
4
4
  export * from './protection';
5
- export * from './blacklist';
5
+ export * from './swagger';
6
6
  export * from './whitelist';
@@ -1,6 +1,6 @@
1
- import './swagger/index.es6.js';
1
+ import './blacklist/index.es6.js';
2
2
  import './dts/index.es6.js';
3
3
  import './env/index.es6.js';
4
4
  import './protection/index.es6.js';
5
- import './blacklist/index.es6.js';
5
+ import './swagger/index.es6.js';
6
6
  import './whitelist/index.es6.js';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- require('./swagger/index.js');
3
+ require('./blacklist/index.js');
4
4
  require('./dts/index.js');
5
5
  require('./env/index.js');
6
6
  require('./protection/index.js');
7
- require('./blacklist/index.js');
7
+ require('./swagger/index.js');
8
8
  require('./whitelist/index.js');
9
9
 
package/utils/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export * from './parseSearch';
2
- export * from './stringifySearch';
3
- export * from './httpOnStart';
1
+ export * from './FileData';
2
+ export * from './JSONString';
3
+ export * from './action';
4
+ export * from './decorators';
5
+ export * from './generateTypes';
4
6
  export * from './getEndpoint';
5
7
  export * from './getOrAdd';
6
- export * from './decorators';
7
- export * from './action';
8
+ export * from './httpOnStart';
8
9
  export * from './parseBody';
9
10
  export * from './parseFormBody';
11
+ export * from './parseSearch';
10
12
  export * from './rules';
11
- export * from './JSONString';
12
- export * from './FileData';
13
- export * from './generateTypes';
13
+ export * from './stringifySearch';
@@ -1,13 +1,13 @@
1
- import './parseSearch/index.es6.js';
2
- import './stringifySearch/index.es6.js';
3
- import './httpOnStart/index.es6.js';
1
+ import './FileData/index.es6.js';
2
+ import './JSONString/index.es6.js';
3
+ import './action/index.es6.js';
4
+ import './decorators/index.es6.js';
5
+ import './generateTypes/index.es6.js';
4
6
  import './getEndpoint/index.es6.js';
5
7
  import './getOrAdd/index.es6.js';
6
- import './decorators/index.es6.js';
7
- import './action/index.es6.js';
8
+ import './httpOnStart/index.es6.js';
8
9
  import './parseBody/index.es6.js';
9
10
  import './parseFormBody/index.es6.js';
11
+ import './parseSearch/index.es6.js';
10
12
  import './rules/index.es6.js';
11
- import './JSONString/index.es6.js';
12
- import './FileData/index.es6.js';
13
- import './generateTypes/index.es6.js';
13
+ import './stringifySearch/index.es6.js';
package/utils/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- require('./parseSearch/index.js');
4
- require('./stringifySearch/index.js');
5
- require('./httpOnStart/index.js');
3
+ require('./FileData/index.js');
4
+ require('./JSONString/index.js');
5
+ require('./action/index.js');
6
+ require('./decorators/index.js');
7
+ require('./generateTypes/index.js');
6
8
  require('./getEndpoint/index.js');
7
9
  require('./getOrAdd/index.js');
8
- require('./decorators/index.js');
9
- require('./action/index.js');
10
+ require('./httpOnStart/index.js');
10
11
  require('./parseBody/index.js');
11
12
  require('./parseFormBody/index.js');
13
+ require('./parseSearch/index.js');
12
14
  require('./rules/index.js');
13
- require('./JSONString/index.js');
14
- require('./FileData/index.js');
15
- require('./generateTypes/index.js');
15
+ require('./stringifySearch/index.js');
16
16