Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/contentstack-audit/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const config = {
'field-rules',
],
'fix-fields': ['reference', 'global_field', 'json:rte', 'json:extension', 'blocks', 'group', 'content_types'],
'schema-fields-data-type': ['blocks','group','global_field'],
moduleConfig: {
'content-types': {
name: 'content type',
Expand Down
10 changes: 7 additions & 3 deletions packages/contentstack-audit/src/modules/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ export default class ContentType {
field.schema = this.runFixOnSchema(tree, field.schema as ContentTypeSchemaType[]);
}
for (let child of field.schema ?? []) {

if (!fixTypes.includes(child.data_type) && child.data_type !== 'json') continue;

switch (child.data_type) {
Expand Down Expand Up @@ -487,8 +486,13 @@ export default class ContentType {
})
.filter((val: any) => {
if (this.config.skipFieldTypes.includes(val?.data_type)) return true;
if (val?.schema && isEmpty(val?.schema)) return false;
if (val?.reference_to && isEmpty(val?.reference_to) && val.data_type==='reference') return false;
if (
val?.schema &&
isEmpty(val?.schema) &&
(!val?.data_type || this.config['schema-fields-data-type'].includes(val.data_type))
)
return false;
if (val?.reference_to && isEmpty(val?.reference_to) && val.data_type === 'reference') return false;

return !!val;
}) as ContentTypeSchemaType[];
Expand Down
Loading