openapi-format
Advanced tools
Comparing version
## unreleased | ||
## [1.25.2] - 2025-04-02 | ||
- Overlay: Prevent distorted properties (#154) | ||
## [1.25.1] - 2025-03-29 | ||
- fix: Prevent distorted properties when sorting (#154) | ||
- Sort: Prevent distorted properties (#154) | ||
@@ -7,0 +11,0 @@ ## [1.25.0] - 2025-01-01 |
{ | ||
"name": "openapi-format", | ||
"version": "1.25.1", | ||
"version": "1.25.2", | ||
"description": "Format an OpenAPI document by ordering, formatting and filtering fields.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -130,4 +130,2 @@ const {JSONPath} = require('jsonpath-plus'); | ||
function deepMerge(target, source) { | ||
if (typeof source !== 'object' || source === null) return source; | ||
if (Array.isArray(target) && Array.isArray(source)) { | ||
@@ -156,2 +154,11 @@ // Merge arrays by unique 'name' and 'in' for OpenAPI parameters | ||
// If source is an array but the target isn't an array, return a shallow copy. | ||
if (Array.isArray(source)) { | ||
return source.slice(); | ||
} | ||
// If source is not an object or is null, return it directly. | ||
if (typeof source !== 'object' || source === null) return source; | ||
// If target is not an object or is null, initialize it as an object. | ||
if (typeof target !== 'object' || target === null) { | ||
@@ -158,0 +165,0 @@ target = {}; |
Sorry, the diff of this file is too big to display
200073
0.08%3172
0.19%1491
-0.2%