@remoteoss/json-schema-form 0.11.5-dev.20240821091937 → 0.11.5-dev.20240821121440

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) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821091937
5
- Generated: Wed, 21 Aug 2024 09:19:48 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821121440
5
+ Generated: Wed, 21 Aug 2024 12:15:00 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -745,12 +745,13 @@ function buildYupSchema(field, config, logic) {
745
745
  validators[0] = () => withBaseSchema().of(buildGroupArraySchema());
746
746
  } else if (inputType === supportedTypes.FIELDSET) {
747
747
  validators[0] = () => withBaseSchema().shape(buildFieldSetSchema(propertyFields.fields));
748
- } else if (inputType === supportedTypes.FILE) {
749
- validators.push(withFile);
750
748
  }
751
749
  if (propertyFields.required) {
752
750
  validators.push(withRequired);
753
751
  }
752
+ if (inputType === supportedTypes.FILE) {
753
+ validators.push(withFile);
754
+ }
754
755
  if (typeof propertyFields.minimum !== "undefined") {
755
756
  validators.push(withMin);
756
757
  }
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821091937
5
- Generated: Wed, 21 Aug 2024 09:19:48 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821121440
5
+ Generated: Wed, 21 Aug 2024 12:15:00 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -708,12 +708,13 @@ function buildYupSchema(field, config, logic) {
708
708
  validators[0] = () => withBaseSchema().of(buildGroupArraySchema());
709
709
  } else if (inputType === supportedTypes.FIELDSET) {
710
710
  validators[0] = () => withBaseSchema().shape(buildFieldSetSchema(propertyFields.fields));
711
- } else if (inputType === supportedTypes.FILE) {
712
- validators.push(withFile);
713
711
  }
714
712
  if (propertyFields.required) {
715
713
  validators.push(withRequired);
716
714
  }
715
+ if (inputType === supportedTypes.FILE) {
716
+ validators.push(withFile);
717
+ }
717
718
  if (typeof propertyFields.minimum !== "undefined") {
718
719
  validators.push(withMin);
719
720
  }
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821091937
5
- Generated: Wed, 21 Aug 2024 09:19:48 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821121440
5
+ Generated: Wed, 21 Aug 2024 12:15:00 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12224,12 +12224,13 @@ function buildYupSchema(field, config, logic) {
12224
12224
  validators[0] = () => withBaseSchema().of(buildGroupArraySchema());
12225
12225
  } else if (inputType === supportedTypes.FIELDSET) {
12226
12226
  validators[0] = () => withBaseSchema().shape(buildFieldSetSchema(propertyFields.fields));
12227
- } else if (inputType === supportedTypes.FILE) {
12228
- validators.push(withFile);
12229
12227
  }
12230
12228
  if (propertyFields.required) {
12231
12229
  validators.push(withRequired);
12232
12230
  }
12231
+ if (inputType === supportedTypes.FILE) {
12232
+ validators.push(withFile);
12233
+ }
12233
12234
  if (typeof propertyFields.minimum !== "undefined") {
12234
12235
  validators.push(withMin);
12235
12236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.11.5-dev.20240821091937",
3
+ "version": "0.11.5-dev.20240821121440",
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",
@@ -61,6 +61,7 @@ import {
61
61
  schemaInputTypeNumberWithPercentage,
62
62
  schemaForErrorMessageSpecificity,
63
63
  jsfConfigForErrorMessageSpecificity,
64
+ schemaInputTypeFile,
64
65
  } from './helpers';
65
66
  import { mockConsole, restoreConsoleAndEnsureItWasNotCalled } from './testUtils';
66
67
 
@@ -2775,6 +2776,25 @@ describe('createHeadlessForm', () => {
2775
2776
  });
2776
2777
  });
2777
2778
 
2779
+ describe('when a field file is required', () => {
2780
+ it('it validates missing file correctly', () => {
2781
+ const { handleValidation } = createHeadlessForm(schemaInputTypeFile);
2782
+ const validateForm = (vals) => friendlyError(handleValidation(vals));
2783
+
2784
+ expect(validateForm({})).toEqual({
2785
+ a_file: 'Required field',
2786
+ });
2787
+
2788
+ expect(
2789
+ validateForm({
2790
+ a_file: null,
2791
+ })
2792
+ ).toEqual({
2793
+ a_file: 'Required field',
2794
+ });
2795
+ });
2796
+ });
2797
+
2778
2798
  describe('when a field has accepted extensions', () => {
2779
2799
  let fields;
2780
2800
  beforeEach(() => {