openapi-format
Advanced tools
Comparing version 1.10.0 to 1.10.1
@@ -155,3 +155,3 @@ #!/usr/bin/env node | ||
// Convert large number value safely before parsing | ||
const regexEncodeLargeNumber = /: ([0-9]*\.?[0-9]+)(,|\n)/g; // match > : 123456789.123456789 | ||
const regexEncodeLargeNumber = /: ([0-9]+(\.[0-9]+)?)\b(?!\.[0-9])(,|\n)/g; // match > : 123456789.123456789 | ||
inputContent = inputContent.replace(regexEncodeLargeNumber, (rawInput) => { | ||
@@ -162,3 +162,3 @@ const endChar = (rawInput.endsWith(',') ? ',' : '\n'); | ||
// Handle large numbers safely in javascript | ||
if (!Number.isSafeInteger(Number(number)) || number.replace('.', '').length > 15) { | ||
if (Number(number).toString().includes('e') || number.replace('.', '').length > 15) { | ||
return `: '${number}==='${endChar}`; | ||
@@ -208,3 +208,3 @@ } else { | ||
// Decode stringified large number JSON values safely before writing output | ||
const regexDecodeJsonLargeNumber = /: "([0-9]*\.?[0-9]+)==="/g; // match > : "123456789.123456789"=== | ||
const regexDecodeJsonLargeNumber = /: "([0-9]+(\.[0-9]+)?)\b(?!\.[0-9])==="/g; // match > : "123456789.123456789"=== | ||
output = output.replace(regexDecodeJsonLargeNumber, (strNumber) => { | ||
@@ -226,3 +226,3 @@ const number = strNumber.replace(/: "|"/g, ''); | ||
// Decode stringified large number YAML values safely before writing output | ||
const regexDecodeYamlLargeNumber = /: ([0-9]*\.?[0-9]+)===/g; // match > : 123456789.123456789=== | ||
const regexDecodeYamlLargeNumber = /: ([0-9]+(\.[0-9]+)?)\b(?!\.[0-9])===/g; // match > : 123456789.123456789=== | ||
output = output.replace(regexDecodeYamlLargeNumber, (strNumber) => { | ||
@@ -229,0 +229,0 @@ const number = strNumber.replace(/: '|'/g, ''); |
## unreleased | ||
## [1.10.1] - 2022-05-03 | ||
- Bugfix for unwanted conversion of numbers in x-tags (#52) | ||
- Bugfix for components.examples.properties distortion (#54) | ||
- Bumped minimist version to v1.2.6 | ||
## [1.10.0] - 2022-03-17 | ||
- Bugfix for unwanted conversion of numbers in strings(#47) | ||
- Filter - Handle components with period (.) in their name/key (#37) | ||
- Bugfix for unwanted conversion of numbers in strings (#47) | ||
- Filter - added responseContent and inverseResponseContent filters (#48) | ||
@@ -8,0 +14,0 @@ ## [1.9.2] - 2022-02-10 |
@@ -199,3 +199,3 @@ #!/usr/bin/env node | ||
} else if ((this.key === 'responses' || this.key === 'schemas' || this.key === 'properties') | ||
&& (this.parent && this.parent.key !== 'properties' && this.parent.key !== 'value') | ||
&& (this.parent && this.parent.key !== 'properties' && this.parent.key !== 'value' && this.path[1] !== 'examples') | ||
) { | ||
@@ -334,3 +334,3 @@ // debugStep = 'Generic sorting - responses/schemas/properties' | ||
// Filter out object matching the "response content" | ||
if (filterResponseContent.length > 0 && filterResponseContent.includes(this.key) | ||
if (filterResponseContent.length > 0 && filterResponseContent.includes(this.key) | ||
&& this.parent && this.parent.key === 'content' | ||
@@ -343,3 +343,3 @@ && this.parent.parent && this.parent.parent.parent && this.parent.parent.parent.key === 'responses') { | ||
// Filter out object matching the inverse "response content" | ||
if (inverseFilterResponseContent.length > 0 && !inverseFilterResponseContent.includes(this.key) | ||
if (inverseFilterResponseContent.length > 0 && !inverseFilterResponseContent.includes(this.key) | ||
&& this.parent && this.parent.key === 'content' | ||
@@ -346,0 +346,0 @@ && this.parent.parent && this.parent.parent.parent && this.parent.parent.parent.key === 'responses') { |
{ | ||
"name": "openapi-format", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"description": "Format an OpenAPI document by ordering, formatting and filtering fields.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104593