oas 17.1.6 → 17.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -459,7 +459,9 @@ function toJSONSchema(data, opts) {
|
|
|
459
459
|
}
|
|
460
460
|
// Enums should not have duplicated items as those will break AJV validation.
|
|
461
461
|
if ('enum' in schema && Array.isArray(schema["enum"])) {
|
|
462
|
-
|
|
462
|
+
// If we ever target ES6 for typescript we can drop this array.from.
|
|
463
|
+
// https://stackoverflow.com/questions/33464504/using-spread-syntax-and-new-set-with-typescript/56870548
|
|
464
|
+
schema["enum"] = Array.from(new Set(schema["enum"]));
|
|
463
465
|
}
|
|
464
466
|
// Clean up any remaining `items` or `properties` schema fragments lying around if there's also polymorphism present.
|
|
465
467
|
if ('allOf' in schema || 'anyOf' in schema || 'oneOf' in schema) {
|
package/package.json
CHANGED
|
@@ -468,7 +468,9 @@ function toJSONSchema(data, opts = {}) {
|
|
|
468
468
|
|
|
469
469
|
// Enums should not have duplicated items as those will break AJV validation.
|
|
470
470
|
if ('enum' in schema && Array.isArray(schema.enum)) {
|
|
471
|
-
|
|
471
|
+
// If we ever target ES6 for typescript we can drop this array.from.
|
|
472
|
+
// https://stackoverflow.com/questions/33464504/using-spread-syntax-and-new-set-with-typescript/56870548
|
|
473
|
+
schema.enum = Array.from(new Set(schema.enum));
|
|
472
474
|
}
|
|
473
475
|
|
|
474
476
|
// Clean up any remaining `items` or `properties` schema fragments lying around if there's also polymorphism present.
|