Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remoteoss/json-schema-form",
"version": "0.4.3-beta.0",
"version": "0.4.4-dev.20230829101351",
"description": "Headless UI form powered by JSON Schemas",
"author": "Remote.com <[email protected]> (https://remote.com/)",
"license": "MIT",
Expand Down
19 changes: 14 additions & 5 deletions src/createHeadlessForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,22 @@ function removeInvalidAttributes(fields) {
*
* @returns {FieldParameters}
*/
function buildFieldParameters(name, fieldProperties, required = [], config = {}) {
function buildFieldParameters(name, fieldProperties, required = [], config = {}, validations) {
const { position } = pickXKey(fieldProperties, 'presentation') ?? {};
let fields;

const inputType = getInputType(fieldProperties, config.strictInputType, name);

if (inputType === supportedTypes.FIELDSET) {
// eslint-disable-next-line no-use-before-define
fields = getFieldsFromJSONSchema(fieldProperties, {
customProperties: get(config, `customProperties.${name}`, {}),
});
fields = getFieldsFromJSONSchema(
fieldProperties,
{
customProperties: get(config, `customProperties.${name}`, {}),
parentID: name,
},
validations
);
}

const result = {
Expand Down Expand Up @@ -285,7 +290,11 @@ function getFieldsFromJSONSchema(scopedJsonSchema, config, validations) {
return [];
}

const fieldParamsList = convertJSONSchemaPropertiesToFieldParameters(scopedJsonSchema, config);
const fieldParamsList = convertJSONSchemaPropertiesToFieldParameters(
scopedJsonSchema,
config,
validations
);

applyFieldsDependencies(fieldParamsList, scopedJsonSchema);

Expand Down
Loading