Skip to content

Commit 1c160f7

Browse files
committed
fix: bad split on conflicting mapping
1 parent f342d59 commit 1c160f7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/split-definition.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const path = require('path');
22
const fs = require('fs');
33
const mkdirp = require('mkdirp');
44
const chalk = require('chalk');
5+
const isEqual = require('lodash.isequal')
56

67
const {
78
writeYaml,
@@ -87,10 +88,10 @@ module.exports = function(openapi, openapiDir) {
8788
for (const componentName of Object.keys(openapi.components[componentType])) {
8889
const filename = path.join(compDir, componentName) + '.yaml';
8990
const componentData = openapi.components[componentType][componentName];
90-
if (fs.existsSync(filename)) {
91+
if (fs.existsSync(filename) && isEqual(readYaml(filename), componentData)) {
9192
console.warn(
9293
chalk.yellow(
93-
`warning: conflict for ${componentName} - file already exists: ${chalk.blue(
94+
`warning: conflict for ${componentName} - file already exists with different content: ${chalk.blue(
9495
filename
9596
)} ... Skip.`
9697
)

0 commit comments

Comments
 (0)