Skip to content

Commit

Permalink
updates setDefaultToInvisibleFields to handle case where field path c…
Browse files Browse the repository at this point in the history
…ontains ID of containing object
  • Loading branch information
ValJed committed Dec 30, 2024
1 parent f6f8b13 commit 5c709a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/@apostrophecms/schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,12 @@ module.exports = {
return validErrors;
}

function setDefaultToInvisibleField(destination, schema, fieldName) {
function setDefaultToInvisibleField(destination, schema, fieldPath) {
// Field path might contain the ID of the object in which it is contained
// We just want the field name here
const [ _id, fieldName ] = fieldPath.includes('.')
? fieldPath.split('.')
: [ null, fieldPath ];
// It is not reasonable to enforce required,
// min, max or anything else for fields
// hidden via "if" as the user cannot correct it
Expand Down

0 comments on commit 5c709a6

Please sign in to comment.