diff --git a/packages/json-machete/src/healJSONSchema.ts b/packages/json-machete/src/healJSONSchema.ts index 3db58a2a5f746..72d748d57f9b1 100644 --- a/packages/json-machete/src/healJSONSchema.ts +++ b/packages/json-machete/src/healJSONSchema.ts @@ -183,7 +183,11 @@ export async function healJSONSchema( if (typeof subSchema.additionalProperties === 'object') { delete subSchema.additionalProperties.readOnly; delete subSchema.additionalProperties.writeOnly; - if (Object.keys(subSchema.additionalProperties).length === 0) { + const additionalPropertiesKeys = Object.keys(subSchema.additionalProperties); + if ( + additionalPropertiesKeys.length === 0 || + (additionalPropertiesKeys.length === 1 && subSchema.additionalProperties.type === 'string') + ) { logger.debug( `${path} has an empty additionalProperties object. So this is invalid. Replacing it with 'true'` );