Skip to content

Commit c55b419

Browse files
Remove enum sorting (#576)
* remove enum sorting * fix enum tests by updating the order of enums in assertions
1 parent 655d774 commit c55b419

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

test/programs/enums-compiled-compute/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"enum": [
4-
1,
54
2,
65
4,
7-
6
6+
6,
7+
1
88
],
99
"type": "number"
1010
}

test/programs/enums-mixed/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"enum": [
77
0,
88
1,
9-
null,
9+
true,
1010
"str",
11-
true
11+
null
1212
],
1313
"type": [
1414
"number",

test/programs/enums-number-initialized/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"enum": [
4-
1,
54
10,
65
11,
7-
12
6+
12,
7+
1
88
],
99
"type": "number"
1010
}

test/programs/enums-string/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"definitions": {
55
"Enum": {
66
"enum": [
7-
"123",
87
"x",
9-
"y"
8+
"y",
9+
"123"
1010
],
1111
"type": "string"
1212
}

typescript-json-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ export class JsonSchemaGenerator {
926926

927927
if (enumValues.length > 0) {
928928
if (enumValues.length > 1) {
929-
definition.enum = enumValues.sort();
929+
definition.enum = enumValues;
930930
} else {
931931
definition.const = enumValues[0];
932932
}

0 commit comments

Comments
 (0)