Skip to content

Commit 2ff5939

Browse files
committed
address issues
1 parent 79b2181 commit 2ff5939

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

redisinsight/api/src/modules/browser/array/dto/get.array-element.response.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { KeyResponse } from 'src/modules/browser/keys/dto';
33
import { RedisStringType } from 'src/common/decorators';
4+
import { REDIS_STRING_SCHEMA } from 'src/common/decorators/redis-string-schema.decorator';
45
import { RedisString } from 'src/common/constants';
56

67
export class GetArrayElementResponse extends KeyResponse {
78
@ApiProperty({
89
description:
910
'Value stored at the requested index, or null if the slot is empty.',
10-
type: String,
11+
...REDIS_STRING_SCHEMA,
1112
nullable: true,
1213
})
1314
@RedisStringType()

redisinsight/api/src/modules/browser/array/dto/get.array-multi-elements.response.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { KeyResponse } from 'src/modules/browser/keys/dto';
33
import { RedisStringType } from 'src/common/decorators';
4+
import { REDIS_STRING_SCHEMA } from 'src/common/decorators/redis-string-schema.decorator';
45
import { RedisString } from 'src/common/constants';
56

67
export class GetArrayMultiElementsResponse extends KeyResponse {
@@ -9,11 +10,10 @@ export class GetArrayMultiElementsResponse extends KeyResponse {
910
'Values for each requested index, in request order. ' +
1011
'Empty slots are returned as null.',
1112
type: 'array',
12-
// OAS 3.0: `type: 'null'` is not a valid schema type and `nullable: true`
13-
// on the array would mark the array itself as nullable. Putting
14-
// `nullable: true` on the item schema is the OAS 3.0 way to express
15-
// `(string | null)[]` so the generated client types items correctly.
16-
items: { type: 'string', nullable: true },
13+
// Each item mirrors the project-wide RedisString schema (string | Buffer
14+
// object under ?encoding=buffer); `nullable: true` on the item is the
15+
// OAS 3.0 way to express `(string | null)[]`.
16+
items: { oneOf: REDIS_STRING_SCHEMA.oneOf, nullable: true },
1717
})
1818
@RedisStringType({ each: true })
1919
elements: (RedisString | null)[];

redisinsight/api/src/modules/browser/array/dto/get.array-range.response.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { KeyResponse } from 'src/modules/browser/keys/dto';
33
import { RedisStringType } from 'src/common/decorators';
4+
import { REDIS_STRING_SCHEMA } from 'src/common/decorators/redis-string-schema.decorator';
45
import { RedisString } from 'src/common/constants';
56

67
export class GetArrayRangeResponse extends KeyResponse {
@@ -9,11 +10,10 @@ export class GetArrayRangeResponse extends KeyResponse {
910
'Values for each index in the requested range, in order. ' +
1011
'Empty slots are returned as null.',
1112
type: 'array',
12-
// OAS 3.0: `type: 'null'` is not a valid schema type and `nullable: true`
13-
// on the array would mark the array itself as nullable. Putting
14-
// `nullable: true` on the item schema is the OAS 3.0 way to express
15-
// `(string | null)[]` so the generated client types items correctly.
16-
items: { type: 'string', nullable: true },
13+
// Each item mirrors the project-wide RedisString schema (string | Buffer
14+
// object under ?encoding=buffer); `nullable: true` on the item is the
15+
// OAS 3.0 way to express `(string | null)[]`.
16+
items: { oneOf: REDIS_STRING_SCHEMA.oneOf, nullable: true },
1717
})
1818
@RedisStringType({ each: true })
1919
elements: (RedisString | null)[];

redisinsight/api/src/modules/browser/array/dto/get.array-scan.response.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { KeyResponse } from 'src/modules/browser/keys/dto';
3-
import { RedisStringType } from 'src/common/decorators';
3+
import { ApiRedisString, RedisStringType } from 'src/common/decorators';
44
import { RedisString } from 'src/common/constants';
55
import { Type } from 'class-transformer';
66

@@ -12,10 +12,7 @@ export class ArrayElement {
1212
})
1313
index: string;
1414

15-
@ApiProperty({
16-
description: 'Value stored at this index.',
17-
type: String,
18-
})
15+
@ApiRedisString('Value stored at this index.')
1916
@RedisStringType()
2017
value: RedisString;
2118
}

0 commit comments

Comments
 (0)