@remoteoss/json-schema-form 0.5.0-dev.20230717103306 → 0.5.0-dev.20230719145458

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.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230717103306
5
- Generated: Mon, 17 Jul 2023 10:33:17 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230719145458
5
+ Generated: Wed, 19 Jul 2023 14:55:12 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -393,16 +393,10 @@ var compareDates = (d1, d2) => {
393
393
  }
394
394
  };
395
395
  var validateMinDate = (value, minDate) => {
396
- if (!value) {
397
- return true;
398
- }
399
396
  const compare = compareDates(value, minDate);
400
397
  return compare === "GREATER" || compare === "EQUAL" ? true : false;
401
398
  };
402
399
  var validateMaxDate = (value, minDate) => {
403
- if (!value) {
404
- return true;
405
- }
406
400
  const compare = compareDates(value, minDate);
407
401
  return compare === "LESSER" || compare === "EQUAL" ? true : false;
408
402
  };
@@ -420,44 +414,25 @@ var yupSchemas = {
420
414
  return `The option ${JSON.stringify(value)} is not valid.`;
421
415
  }),
422
416
  date: ({ minDate, maxDate }) => {
423
- if (minDate && maxDate) {
424
- return (0, import_yup.string)().nullable().trim().matches(
425
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
426
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
427
- ).test(
428
- "minDate",
429
- `The date must be ${minDate} or after`,
430
- (value) => validateMinDate(value, minDate)
431
- ).test(
432
- "maxDate",
433
- `The date must be ${maxDate} or before`,
434
- (value) => validateMaxDate(value, maxDate)
435
- );
436
- }
417
+ let dateString = (0, import_yup.string)().nullable().trim().matches(
418
+ /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
419
+ `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
420
+ );
437
421
  if (minDate) {
438
- return (0, import_yup.string)().nullable().trim().matches(
439
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
440
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
441
- ).test(
422
+ dateString = dateString.test(
442
423
  "minDate",
443
- `The date must be ${minDate} or after`,
424
+ `The date must be ${minDate} or after.`,
444
425
  (value) => validateMinDate(value, minDate)
445
426
  );
446
427
  }
447
428
  if (maxDate) {
448
- return (0, import_yup.string)().nullable().trim().matches(
449
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
450
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
451
- ).test(
429
+ dateString = dateString.test(
452
430
  "maxDate",
453
- `The date must be ${maxDate} or before`,
431
+ `The date must be ${maxDate} or before.`,
454
432
  (value) => validateMaxDate(value, maxDate)
455
433
  );
456
434
  }
457
- return (0, import_yup.string)().nullable().trim().matches(
458
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
459
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
460
- );
435
+ return dateString;
461
436
  },
462
437
  number: (0, import_yup.number)().typeError("The value must be a number").nullable(),
463
438
  file: (0, import_yup.array)().nullable(),
@@ -503,7 +478,7 @@ var getYupSchema = ({ inputType, ...field }) => {
503
478
  const optionValues = getOptions(field);
504
479
  return yupSchemas.radioOrSelect(optionValues);
505
480
  }
506
- if (inputType === "date") {
481
+ if (field.format === "date") {
507
482
  return yupSchemas.date({ minDate: field.minDate, maxDate: field.maxDate });
508
483
  }
509
484
  return yupSchemas[inputType] || yupSchemasToJsonTypes[jsonType];
@@ -965,6 +940,7 @@ function extractParametersFromNode(schemaNode) {
965
940
  maxFileSize: node.maxFileSize,
966
941
  // @deprecated in favor of presentation.maxFileSize
967
942
  default: node.default,
943
+ format: node.format,
968
944
  // Checkboxes conditions
969
945
  // — For checkboxes that only accept one value (string)
970
946
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230717103306
5
- Generated: Mon, 17 Jul 2023 10:33:17 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230719145458
5
+ Generated: Wed, 19 Jul 2023 14:55:12 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -357,16 +357,10 @@ var compareDates = (d1, d2) => {
357
357
  }
358
358
  };
359
359
  var validateMinDate = (value, minDate) => {
360
- if (!value) {
361
- return true;
362
- }
363
360
  const compare = compareDates(value, minDate);
364
361
  return compare === "GREATER" || compare === "EQUAL" ? true : false;
365
362
  };
366
363
  var validateMaxDate = (value, minDate) => {
367
- if (!value) {
368
- return true;
369
- }
370
364
  const compare = compareDates(value, minDate);
371
365
  return compare === "LESSER" || compare === "EQUAL" ? true : false;
372
366
  };
@@ -384,44 +378,25 @@ var yupSchemas = {
384
378
  return `The option ${JSON.stringify(value)} is not valid.`;
385
379
  }),
386
380
  date: ({ minDate, maxDate }) => {
387
- if (minDate && maxDate) {
388
- return string().nullable().trim().matches(
389
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
390
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
391
- ).test(
392
- "minDate",
393
- `The date must be ${minDate} or after`,
394
- (value) => validateMinDate(value, minDate)
395
- ).test(
396
- "maxDate",
397
- `The date must be ${maxDate} or before`,
398
- (value) => validateMaxDate(value, maxDate)
399
- );
400
- }
381
+ let dateString = string().nullable().trim().matches(
382
+ /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
383
+ `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
384
+ );
401
385
  if (minDate) {
402
- return string().nullable().trim().matches(
403
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
404
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
405
- ).test(
386
+ dateString = dateString.test(
406
387
  "minDate",
407
- `The date must be ${minDate} or after`,
388
+ `The date must be ${minDate} or after.`,
408
389
  (value) => validateMinDate(value, minDate)
409
390
  );
410
391
  }
411
392
  if (maxDate) {
412
- return string().nullable().trim().matches(
413
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
414
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
415
- ).test(
393
+ dateString = dateString.test(
416
394
  "maxDate",
417
- `The date must be ${maxDate} or before`,
395
+ `The date must be ${maxDate} or before.`,
418
396
  (value) => validateMaxDate(value, maxDate)
419
397
  );
420
398
  }
421
- return string().nullable().trim().matches(
422
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
423
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
424
- );
399
+ return dateString;
425
400
  },
426
401
  number: number().typeError("The value must be a number").nullable(),
427
402
  file: array().nullable(),
@@ -467,7 +442,7 @@ var getYupSchema = ({ inputType, ...field }) => {
467
442
  const optionValues = getOptions(field);
468
443
  return yupSchemas.radioOrSelect(optionValues);
469
444
  }
470
- if (inputType === "date") {
445
+ if (field.format === "date") {
471
446
  return yupSchemas.date({ minDate: field.minDate, maxDate: field.maxDate });
472
447
  }
473
448
  return yupSchemas[inputType] || yupSchemasToJsonTypes[jsonType];
@@ -929,6 +904,7 @@ function extractParametersFromNode(schemaNode) {
929
904
  maxFileSize: node.maxFileSize,
930
905
  // @deprecated in favor of presentation.maxFileSize
931
906
  default: node.default,
907
+ format: node.format,
932
908
  // Checkboxes conditions
933
909
  // — For checkboxes that only accept one value (string)
934
910
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230717103306
5
- Generated: Mon, 17 Jul 2023 10:33:17 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.5.0-dev.20230719145458
5
+ Generated: Wed, 19 Jul 2023 14:55:12 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -11333,16 +11333,10 @@ var compareDates = (d1, d2) => {
11333
11333
  }
11334
11334
  };
11335
11335
  var validateMinDate = (value, minDate) => {
11336
- if (!value) {
11337
- return true;
11338
- }
11339
11336
  const compare = compareDates(value, minDate);
11340
11337
  return compare === "GREATER" || compare === "EQUAL" ? true : false;
11341
11338
  };
11342
11339
  var validateMaxDate = (value, minDate) => {
11343
- if (!value) {
11344
- return true;
11345
- }
11346
11340
  const compare = compareDates(value, minDate);
11347
11341
  return compare === "LESSER" || compare === "EQUAL" ? true : false;
11348
11342
  };
@@ -11360,44 +11354,25 @@ var yupSchemas = {
11360
11354
  return `The option ${JSON.stringify(value)} is not valid.`;
11361
11355
  }),
11362
11356
  date: ({ minDate, maxDate }) => {
11363
- if (minDate && maxDate) {
11364
- return StringSchema().nullable().trim().matches(
11365
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11366
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
11367
- ).test(
11368
- "minDate",
11369
- `The date must be ${minDate} or after`,
11370
- (value) => validateMinDate(value, minDate)
11371
- ).test(
11372
- "maxDate",
11373
- `The date must be ${maxDate} or before`,
11374
- (value) => validateMaxDate(value, maxDate)
11375
- );
11376
- }
11357
+ let dateString = StringSchema().nullable().trim().matches(
11358
+ /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11359
+ `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
11360
+ );
11377
11361
  if (minDate) {
11378
- return StringSchema().nullable().trim().matches(
11379
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11380
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
11381
- ).test(
11362
+ dateString = dateString.test(
11382
11363
  "minDate",
11383
- `The date must be ${minDate} or after`,
11364
+ `The date must be ${minDate} or after.`,
11384
11365
  (value) => validateMinDate(value, minDate)
11385
11366
  );
11386
11367
  }
11387
11368
  if (maxDate) {
11388
- return StringSchema().nullable().trim().matches(
11389
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11390
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
11391
- ).test(
11369
+ dateString = dateString.test(
11392
11370
  "maxDate",
11393
- `The date must be ${maxDate} or before`,
11371
+ `The date must be ${maxDate} or before.`,
11394
11372
  (value) => validateMaxDate(value, maxDate)
11395
11373
  );
11396
11374
  }
11397
- return StringSchema().nullable().trim().matches(
11398
- /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11399
- `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
11400
- );
11375
+ return dateString;
11401
11376
  },
11402
11377
  number: NumberSchema().typeError("The value must be a number").nullable(),
11403
11378
  file: array_default().nullable(),
@@ -11443,7 +11418,7 @@ var getYupSchema = ({ inputType, ...field }) => {
11443
11418
  const optionValues = getOptions(field);
11444
11419
  return yupSchemas.radioOrSelect(optionValues);
11445
11420
  }
11446
- if (inputType === "date") {
11421
+ if (field.format === "date") {
11447
11422
  return yupSchemas.date({ minDate: field.minDate, maxDate: field.maxDate });
11448
11423
  }
11449
11424
  return yupSchemas[inputType] || yupSchemasToJsonTypes[jsonType];
@@ -11905,6 +11880,7 @@ function extractParametersFromNode(schemaNode) {
11905
11880
  maxFileSize: node.maxFileSize,
11906
11881
  // @deprecated in favor of presentation.maxFileSize
11907
11882
  default: node.default,
11883
+ format: node.format,
11908
11884
  // Checkboxes conditions
11909
11885
  // — For checkboxes that only accept one value (string)
11910
11886
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.5.0-dev.20230717103306",
3
+ "version": "0.5.0-dev.20230719145458",
4
4
  "description": "Headless UI form powered by JSON Schemas",
5
5
  "author": "Remote.com <engineering@remote.com> (https://remote.com/)",
6
6
  "license": "MIT",
@@ -1009,86 +1009,116 @@ describe('createHeadlessForm', () => {
1009
1009
  });
1010
1010
 
1011
1011
  it('support "date" field type', () => {
1012
- const result = createHeadlessForm(schemaInputTypeDate);
1012
+ const { fields, handleValidation } = createHeadlessForm(schemaInputTypeDate);
1013
1013
 
1014
- expect(result).toMatchObject({
1015
- fields: [
1016
- {
1017
- label: 'Birthdate',
1018
- name: 'birthdate',
1019
- required: true,
1020
- schema: expect.any(Object),
1021
- type: 'date',
1022
- maxLength: 10,
1023
- minDate: '1922-03-01',
1024
- maxDate: '2022-03-01',
1025
- },
1026
- ],
1014
+ const validateForm = (vals) => friendlyError(handleValidation(vals));
1015
+
1016
+ expect(fields[0]).toMatchObject({
1017
+ label: 'Birthdate',
1018
+ name: 'birthdate',
1019
+ required: true,
1020
+ schema: expect.any(Object),
1021
+ type: 'date',
1022
+ minDate: '1922-03-01',
1023
+ maxDate: '2022-03-01',
1027
1024
  });
1028
1025
 
1029
- const fieldValidator = result.fields[0].schema;
1030
1026
  const todayDateHint = new Date().toISOString().substring(0, 10);
1031
- expect(fieldValidator.isValidSync('2020-10-10')).toBe(true);
1032
- expect(fieldValidator.isValidSync('2020-13-10')).toBe(false);
1033
- expect(() => fieldValidator.validateSync('')).toThrowError(
1034
- `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`
1035
- );
1027
+
1028
+ expect(validateForm({})).toEqual({
1029
+ birthdate: 'Required field',
1030
+ });
1031
+
1032
+ expect(validateForm({ birthdate: '2020-10-10' })).toBeUndefined();
1033
+ expect(validateForm({ birthdate: '2020-13-10' })).toEqual({
1034
+ birthdate: `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`,
1035
+ });
1036
1036
  });
1037
1037
 
1038
1038
  it('support "date" field type with a minDate', () => {
1039
- const result = createHeadlessForm(schemaInputTypeDate);
1039
+ const { fields, handleValidation } = createHeadlessForm(schemaInputTypeDate);
1040
1040
 
1041
- expect(result).toMatchObject({
1042
- fields: [
1043
- {
1044
- label: 'Birthdate',
1045
- name: 'birthdate',
1046
- required: true,
1047
- schema: expect.any(Object),
1048
- type: 'date',
1049
- maxLength: 10,
1050
- minDate: '1922-03-01',
1051
- maxDate: '2022-03-01',
1052
- },
1053
- ],
1041
+ const validateForm = (vals) => friendlyError(handleValidation(vals));
1042
+
1043
+ expect(fields[0]).toMatchObject({
1044
+ label: 'Birthdate',
1045
+ name: 'birthdate',
1046
+ required: true,
1047
+ schema: expect.any(Object),
1048
+ type: 'date',
1049
+ minDate: '1922-03-01',
1050
+ maxDate: '2022-03-01',
1051
+ });
1052
+
1053
+ expect(validateForm({})).toEqual({
1054
+ birthdate: 'Required field',
1054
1055
  });
1055
1056
 
1056
- const fieldValidator = result.fields[0].schema;
1057
1057
  const todayDateHint = new Date().toISOString().substring(0, 10);
1058
- expect(fieldValidator.isValidSync('1922-02-01')).toBe(false);
1059
- expect(fieldValidator.isValidSync('1922-03-01')).toBe(true);
1060
- expect(fieldValidator.isValidSync('2021-03-01')).toBe(true);
1061
- expect(() => fieldValidator.validateSync('')).toThrowError(
1062
- `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`
1063
- );
1058
+
1059
+ expect(validateForm({ birthdate: '' })).toEqual({
1060
+ birthdate: `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`,
1061
+ });
1062
+
1063
+ expect(validateForm({ birthdate: '1922-02-01' })).toEqual({
1064
+ birthdate: 'The date must be 1922-03-01 or after.',
1065
+ });
1066
+
1067
+ expect(validateForm({ birthdate: '1922-03-01' })).toBeUndefined();
1068
+
1069
+ expect(validateForm({ birthdate: '2021-03-01' })).toBeUndefined();
1064
1070
  });
1065
1071
 
1066
1072
  it('support "date" field type with a maxDate', () => {
1067
- const result = createHeadlessForm(schemaInputTypeDate);
1073
+ const { fields, handleValidation } = createHeadlessForm(schemaInputTypeDate);
1068
1074
 
1069
- expect(result).toMatchObject({
1070
- fields: [
1071
- {
1072
- label: 'Birthdate',
1073
- name: 'birthdate',
1074
- required: true,
1075
- schema: expect.any(Object),
1076
- type: 'date',
1077
- maxLength: 10,
1078
- minDate: '1922-03-01',
1079
- maxDate: '2022-03-01',
1080
- },
1081
- ],
1075
+ const validateForm = (vals) => friendlyError(handleValidation(vals));
1076
+
1077
+ expect(fields[0]).toMatchObject({
1078
+ label: 'Birthdate',
1079
+ name: 'birthdate',
1080
+ required: true,
1081
+ schema: expect.any(Object),
1082
+ type: 'date',
1083
+ minDate: '1922-03-01',
1084
+ maxDate: '2022-03-01',
1082
1085
  });
1083
1086
 
1084
- const fieldValidator = result.fields[0].schema;
1085
1087
  const todayDateHint = new Date().toISOString().substring(0, 10);
1086
- expect(fieldValidator.isValidSync('2022-02-01')).toBe(true);
1087
- expect(fieldValidator.isValidSync('2022-03-01')).toBe(true);
1088
- expect(fieldValidator.isValidSync('2022-04-01')).toBe(false);
1089
- expect(() => fieldValidator.validateSync('')).toThrowError(
1090
- `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`
1091
- );
1088
+
1089
+ expect(validateForm({ birthdate: '' })).toEqual({
1090
+ birthdate: `Must be a valid date in yyyy-mm-dd format. e.g. ${todayDateHint}`,
1091
+ });
1092
+
1093
+ expect(validateForm({ birthdate: '2022-02-01' })).toBeUndefined();
1094
+ expect(validateForm({ birthdate: '2022-03-01' })).toBeUndefined();
1095
+ expect(validateForm({ birthdate: '2022-04-01' })).toEqual({
1096
+ birthdate: 'The date must be 2022-03-01 or before.',
1097
+ });
1098
+ });
1099
+
1100
+ it('support format date with minDate and maxDate', () => {
1101
+ const schemaFormatDate = {
1102
+ properties: {
1103
+ birthdate: {
1104
+ title: 'Birthdate',
1105
+ type: 'string',
1106
+ format: 'date',
1107
+ 'x-jsf-presentation': {
1108
+ inputType: 'myDateType',
1109
+ maxDate: '2022-03-01',
1110
+ minDate: '1922-03-01',
1111
+ },
1112
+ },
1113
+ },
1114
+ };
1115
+
1116
+ const { handleValidation } = createHeadlessForm(schemaFormatDate);
1117
+ const validateForm = (vals) => friendlyError(handleValidation(vals));
1118
+
1119
+ expect(validateForm({ birthdate: '1922-02-01' })).toEqual({
1120
+ birthdate: 'The date must be 1922-03-01 or after.',
1121
+ });
1092
1122
  });
1093
1123
 
1094
1124
  it('supports "file" field type', () => {
@@ -272,18 +272,6 @@ export const mockSelectInputMultipleOptional = {
272
272
  type: ['array', 'null'],
273
273
  };
274
274
 
275
- export const mockDateInput = {
276
- 'x-jsf-presentation': {
277
- inputType: 'date',
278
- maxDate: '2022-03-01',
279
- minDate: '1922-03-01',
280
- },
281
- title: 'Birthdate',
282
- type: 'string',
283
- format: 'date',
284
- maxLength: 10,
285
- };
286
-
287
275
  export const mockFileInput = {
288
276
  description: 'File Input Description',
289
277
  'x-jsf-presentation': {
@@ -998,12 +986,19 @@ export const schemaInputTypeNumberWithPercentage = JSONSchemaBuilder()
998
986
  .setRequiredFields(['shares'])
999
987
  .build();
1000
988
 
1001
- export const schemaInputTypeDate = JSONSchemaBuilder()
1002
- .addInput({
1003
- birthdate: mockDateInput,
1004
- })
1005
- .setRequiredFields(['birthdate'])
1006
- .build();
989
+ export const schemaInputTypeDate = {
990
+ type: 'object',
991
+ additionalProperties: false,
992
+ properties: {
993
+ birthdate: {
994
+ 'x-jsf-presentation': { inputType: 'date', maxDate: '2022-03-01', minDate: '1922-03-01' },
995
+ title: 'Birthdate',
996
+ type: 'string',
997
+ format: 'date',
998
+ },
999
+ },
1000
+ required: ['birthdate'],
1001
+ };
1007
1002
 
1008
1003
  export const schemaInputTypeEmail = JSONSchemaBuilder()
1009
1004
  .addInput({