-
Notifications
You must be signed in to change notification settings - Fork 386
Decouple ui/* from api/* via openapi types #4725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: fe/feature/RI-7039-replace-eui
Are you sure you want to change the base?
Changes from all commits
bf14313
c7e81a8
c14b283
4e88dce
08f82aa
6f14c82
f5aae22
bc2b1bc
b44b204
ca69d01
0f214d6
d7b481b
6b01e88
69d9b76
9109723
8cda749
a138eca
6d40ba7
82c56a5
6645547
4ca94a9
12079de
87a4e31
2ed73d6
5f4a9ae
3fbc9d7
7e45f36
07b800a
5c05cfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "7.14.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export const REDIS_STRING_SCHEMA = { | ||
type: String, | ||
oneOf: [ | ||
{ type: 'string' }, | ||
{ | ||
type: 'object', | ||
properties: { | ||
type: { type: 'string', enum: ['Buffer'], example: 'Buffer' }, | ||
data: { | ||
type: 'array', | ||
items: { type: 'number' }, | ||
example: [61, 101, 49], | ||
}, | ||
}, | ||
required: ['type', 'data'], | ||
}, | ||
], | ||
}; | ||
Comment on lines
+3
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! I assume before we had "string" in swagger, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was mostly string yes |
||
|
||
export const ApiRedisString = ( | ||
description: string = undefined, | ||
isArray = false, | ||
required = true, | ||
) => | ||
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like it will be better to join There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I figured I'll get that comment |
||
ApiProperty({ | ||
description, | ||
isArray, | ||
required, | ||
...REDIS_STRING_SCHEMA, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import { KeyDto } from 'src/modules/browser/keys/dto'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { ArrayNotEmpty, IsArray, IsDefined } from 'class-validator'; | ||
import { IsRedisString, RedisStringType } from 'src/common/decorators'; | ||
import { | ||
ApiRedisString, | ||
IsRedisString, | ||
RedisStringType, | ||
} from 'src/common/decorators'; | ||
import { RedisString } from 'src/common/constants'; | ||
|
||
export class DeleteFieldsFromHashDto extends KeyDto { | ||
@ApiProperty({ | ||
description: 'Hash fields', | ||
type: String, | ||
isArray: true, | ||
}) | ||
@ApiRedisString('Hash fields', true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here it will be clear what we are doing: e.g. |
||
@IsDefined() | ||
@IsArray() | ||
@ArrayNotEmpty() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { RedisStringType } from 'src/common/decorators'; | ||
import { ApiRedisString, RedisStringType } from 'src/common/decorators'; | ||
import { RedisString } from 'src/common/constants'; | ||
|
||
export class DeleteListElementsResponse { | ||
@ApiProperty({ | ||
type: String, | ||
isArray: true, | ||
description: 'Removed elements from list', | ||
}) | ||
@ApiRedisString('Removed elements from list', true) | ||
@RedisStringType({ each: true }) | ||
elements: RedisString[]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
import { KeyResponse } from 'src/modules/browser/keys/dto'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { RedisStringType } from 'src/common/decorators'; | ||
import { ApiRedisString, RedisStringType } from 'src/common/decorators'; | ||
import { RedisString } from 'src/common/constants'; | ||
|
||
export class GetListElementResponse extends KeyResponse { | ||
@ApiProperty({ | ||
type: () => String, | ||
description: 'Element value', | ||
}) | ||
@ApiRedisString('Element value') | ||
@RedisStringType() | ||
value: RedisString; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we didn't use apiSrc from api folder. so it should be safe to remove