From 33c8ab39955f0fdd0367ded8533cd9eb189570b2 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 8 Sep 2023 18:26:31 +0530 Subject: [PATCH] #785 - Schema fields are getting required automatically- fixed --- src/app/admin/create-entity/create-entity.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/admin/create-entity/create-entity.component.ts b/src/app/admin/create-entity/create-entity.component.ts index 36467ba..a9f5ada 100644 --- a/src/app/admin/create-entity/create-entity.component.ts +++ b/src/app/admin/create-entity/create-entity.component.ts @@ -685,7 +685,7 @@ export class CreateEntityComponent implements OnInit, AfterContentChecked { let required: any = []; - required = (self.required != undefined) ? self.required.includes(key) : false; + required = propertyObj[key]?.hasOwnProperty('required') ? propertyObj[key].required : (self.required ?? []).includes(key); if (!self.usecaseSchema[self.activeMenuNo].hasOwnProperty('isRefSchema') && !self.usecaseSchema[self.activeMenuNo].isRefSchema) { if (!required && self.usecaseSchema[self.activeMenuNo].definitions[self.usecaseSchema[self.activeMenuNo].title].hasOwnProperty('required')) { @@ -1295,7 +1295,9 @@ export class CreateEntityComponent implements OnInit, AfterContentChecked { let requiredSecFields = []; for (let j = 0; j < formioJson[i].components.length; j++) { + if(formioJson[i].components[j].hasOwnProperty('validate') && formioJson[i].components[j].validate.required){ requiredSecFields.push(formioJson[i].components[j].key); + } }