Skip to content

Commit

Permalink
Merge pull request #31 from taras-dubyk/master
Browse files Browse the repository at this point in the history
HCK-4084: RE: fix handling of the required and enum properties in request/response parameters schemas
  • Loading branch information
VitaliiBedletskyi authored Oct 10, 2023
2 parents 6fbc08e + 12fd8a4 commit 8eae123
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions reverse_engineering/helpers/commonHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ const reorderFields = (data, filedOrder) => {
};

const sortObject = (obj) => {
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
return obj;
}
return Object.keys(obj || {}).sort().reduce((acc,key)=>{
if (Array.isArray(obj[key])){
acc[key] = obj[key].map(sortObject);
}
if (typeof obj[key] === 'object'){
} else if (typeof obj[key] === 'object'){
acc[key]= sortObject(obj[key]);
}
else{
} else {
acc[key] = obj[key];
}
return acc;
Expand Down

0 comments on commit 8eae123

Please sign in to comment.