chore: allow filter with limit zero

Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
This commit is contained in:
Ricardo Arturo Cabral Mejía 2022-12-29 01:04:04 -05:00
parent bb63d60b8b
commit efd4c00a8e
2 changed files with 2 additions and 2 deletions

View File

@ -8,5 +8,5 @@ export const filterSchema = Schema.object({
kinds: Schema.array().items(kindSchema).max(20),
since: Schema.number().min(0).multiple(1),
until: Schema.number().min(0).multiple(1),
limit: Schema.number().min(1).multiple(1).max(10000),
limit: Schema.number().min(0).multiple(1).max(10000),
}).pattern(/^#[a-z]$/, Schema.array().items(Schema.string().max(1024)).max(256))

View File

@ -69,7 +69,7 @@ describe('NIP-01', () => {
],
limit: [
{ message: 'must be a number', transform: assocPath(['limit'], null) },
{ message: 'must be greater than or equal to 1', transform: assocPath(['limit'], -1) },
{ message: 'must be greater than or equal to 0', transform: assocPath(['limit'], -1) },
{ message: 'must be a multiple of 1', transform: assocPath(['limit'], Math.PI) },
{ message: 'must be less than or equal to 10000', transform: assocPath(['limit'], 10001) },
],