Skip to content

Commit 75f1a0b

Browse files
authored
fix: Increase choices limit for turbo (#1043)
* fix: Increase choices limit for turbo * v0.12.4
1 parent 8f07c8c commit 75f1a0b

File tree

7 files changed

+1022
-8
lines changed

7 files changed

+1022
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snapshot-labs/snapshot.js",
3-
"version": "0.12.3",
3+
"version": "0.12.4",
44
"repository": "snapshot-labs/snapshot.js",
55
"license": "MIT",
66
"main": "dist/snapshot.cjs.js",

src/schemas/proposal.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
"type": "array",
3232
"title": "choices",
3333
"minItems": 1,
34-
"maxItems": 500
34+
"maxLengthWithSpaceType": {
35+
"default": 500,
36+
"turbo": 1000
37+
}
3538
},
3639
"type": {
3740
"type": "string",

src/schemas/update-proposal.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"type": "array",
3636
"title": "choices",
3737
"minItems": 1,
38-
"maxItems": 500
38+
"maxLengthWithSpaceType": {
39+
"default": 500,
40+
"turbo": 1000
41+
}
3942
},
4043
"type": {
4144
"enum": [

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ ajv.addKeyword({
155155
validate.errors = [
156156
{
157157
keyword: 'maxLengthWithSpaceType',
158-
message: `must NOT have more than ${schema[spaceType]} characters`,
158+
message: `must not have more than ${schema[spaceType]}`,
159159
params: { limit: schema[spaceType] }
160160
}
161161
];

test/examples/proposal-maxLengthWithSpaceType-error.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
{
33
"instancePath": "/body",
44
"keyword": "maxLengthWithSpaceType",
5-
"message": "must NOT have more than 10000 characters",
5+
"message": "must not have more than 10000",
66
"params": {
77
"limit": 10000
88
},
99
"schemaPath": "#/properties/body/maxLengthWithSpaceType"
10+
},
11+
{
12+
"instancePath": "/choices",
13+
"keyword": "maxLengthWithSpaceType",
14+
"message": "must not have more than 500",
15+
"params": {
16+
"limit": 500
17+
},
18+
"schemaPath": "#/properties/choices/maxLengthWithSpaceType"
1019
}
1120
]

test/examples/proposal-turbo.json

Lines changed: 1000 additions & 2 deletions
Large diffs are not rendered by default.

test/schema.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import schemas from '../src/schemas';
1212
import proposalMaxLengthWithSpaceTypeError from './examples/proposal-maxLengthWithSpaceType-error.json';
1313
import spaceMaxItemsWithSpaceTypeError from './examples/space-maxItemsWithSpaceType-error.json';
1414

15+
// Tests for default spaces
1516
describe.each([
1617
{ schemaType: 'space', schema: schemas.space, example: space },
1718
{ schemaType: 'proposal', schema: schemas.proposal, example: proposal },
@@ -30,7 +31,6 @@ describe.each([
3031
});
3132

3233
// Tests for turbo spaces
33-
3434
describe.each([
3535
{ schemaType: 'space', schema: schemas.space, example: spaceTurbo },
3636
{ schemaType: 'proposal', schema: schemas.proposal, example: proposalTurbo }
@@ -44,6 +44,7 @@ describe.each([
4444
});
4545
});
4646

47+
// tests for default schema with turbo example, should fail
4748
describe.each([
4849
{
4950
schemaType: 'space',

0 commit comments

Comments
 (0)