From 3908a7c46448d277b82318659cdea65db52f9e70 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 29 Mar 2020 20:19:23 +0300 Subject: [PATCH] fix: crash to wrong spelling in localeCompare fixes #1218 --- src/services/models/Schema.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts index 722c2bb78d..49e89f1220 100644 --- a/src/services/models/Schema.ts +++ b/src/services/models/Schema.ts @@ -261,7 +261,9 @@ export class SchemaModel { } } - const inversedMapping = isLimitedToMapping ? { ...explicitInversedMapping } : { ...implicitInversedMapping, ...explicitInversedMapping }; + const inversedMapping = isLimitedToMapping + ? { ...explicitInversedMapping } + : { ...implicitInversedMapping, ...explicitInversedMapping }; let refs: Array<{ $ref; name }> = []; @@ -276,7 +278,7 @@ export class SchemaModel { } } - // Make the listing respects the mapping + // Make the listing respects the mapping // in case a mapping is defined, the user usually wants to have the order shown // as it was defined in the yaml. This will sort the names given the provided // mapping (if provided). @@ -292,7 +294,7 @@ export class SchemaModel { if (indexLeft < 0 && indexRight < 0) { // out of mapping, order by name - return left.name.localCompare(right.name); + return left.name.localeCompare(right.name); } else if (indexLeft < 0) { // the right is found, so mapping wins return 1;