Skip to content

Commit

Permalink
fix enum patching in array
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim committed Jan 16, 2024
1 parent 2826fb6 commit 33b7641
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 18 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "openapi-workspaces",
"license": "MIT",
"private": true,
"version": "0.53.21",
"version": "0.53.22-0",
"workspaces": [
"projects/json-pointer-helpers",
"projects/openapi-io",
Expand All @@ -27,5 +27,6 @@
"**/*.+(js|jsx|ts|tsx|json|css)": [
"yarn prettier --write"
]
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/fastify-capture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/fastify-capture",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -37,5 +37,6 @@
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/json-pointer-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/json-pointer-helpers",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -32,5 +32,6 @@
"dependencies": {
"jsonpointer": "^5.0.1",
"minimatch": "9.0.3"
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/openapi-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-io",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -57,5 +57,6 @@
"upath": "^2.0.1",
"yaml": "^2.3.2",
"yaml-ast-parser": "^0.0.43"
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/openapi-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-utilities",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -53,5 +53,6 @@
"ts-invariant": "^0.9.3",
"url-join": "^4.0.1",
"yaml-ast-parser": "^0.0.43"
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/optic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/optic",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -138,5 +138,6 @@
"node18-win-x64"
],
"outputPath": "../../dist"
}
},
"stableVersion": "0.53.21"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports[`enum shape patch generator when enum is nested in array 1`] = `
"query": [],
},
},
"shouldRegeneratePatches": false,
"shouldRegeneratePatches": true,
},
]
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,17 @@ export function* enumPatches(
path: jsonPointerHelpers.append(diff.propertyPath, '-'), // "-" indicates append to array
value: diff.value,
});
// If the enum is inside of an array, we could have multiple instances of enum - this updates the enum and reruns diffs
const shouldRegeneratePatches = jsonPointerHelpers
.decode(diff.propertyPath)
.includes('items');

yield {
description: `add enum ${diff.value} to ${diff.key} `,
diff,
impact: [PatchImpact.Addition],
groupedOperations,
shouldRegeneratePatches: false,
shouldRegeneratePatches,
interaction,
};
}
5 changes: 3 additions & 2 deletions projects/rulesets-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/rulesets-base",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -40,5 +40,6 @@
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
}
},
"stableVersion": "0.53.21"
}
5 changes: 3 additions & 2 deletions projects/standard-rulesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/standard-rulesets",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.21",
"version": "0.53.22-0",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down Expand Up @@ -45,5 +45,6 @@
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
}
},
"stableVersion": "0.53.21"
}

0 comments on commit 33b7641

Please sign in to comment.