Skip to content

Commit

Permalink
Merge pull request #3969 from novuhq/nv-2653-make-sure-our-swagger-js…
Browse files Browse the repository at this point in the history
…on-pass-validation

fix: so swagger json validates
  • Loading branch information
davidsoderberg authored Aug 15, 2023
2 parents 59e54a8 + 9509d41 commit 8b48525
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ jobs:
targets: test:e2e
projects: ${{matrix.projectName}}

- name: Start Api
env:
IN_MEMORY_CLUSTER_MODE_ENABLED: true
run: cd apps/api && pnpm start:test &

- name: Wait on Api
run: wait-on --timeout=180000 http://localhost:1336/v1/health-check

- name: Get swagger json as file
run: |
curl -o swagger.json http://localhost:1336/api-json
- uses: char0n/swagger-editor-validate@v1
with:
definition-file: swagger.json

- name: Kill port for api 1336 for unit tests
run: sudo kill -9 $(sudo lsof -t -i:1336)

test_unit:
name: Unit Test
runs-on: ubuntu-latest
Expand Down
20 changes: 12 additions & 8 deletions apps/api/src/app/events/dtos/trigger-event-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ export class TopicPayloadDto {
type: TriggerRecipientsTypeEnum;
}

export class BulkTriggerEventDto {
@ApiProperty()
@IsArray()
@ArrayNotEmpty()
@ArrayMaxSize(100)
events: TriggerEventRequestDto[];
}

@ApiExtraModels(SubscriberPayloadDto)
@ApiExtraModels(TopicPayloadDto)
export class TriggerEventRequestDto {
Expand Down Expand Up @@ -77,6 +69,7 @@ export class TriggerEventRequestDto {
$ref: getSchemaPath(TopicPayloadDto),
},
],
type: [String, SubscriberPayloadDto, TopicPayloadDto],
isArray: true,
})
@IsDefined()
Expand All @@ -101,3 +94,14 @@ export class TriggerEventRequestDto {
@IsOptional()
actor?: TriggerRecipientSubscriber;
}

export class BulkTriggerEventDto {
@ApiProperty({
isArray: true,
type: TriggerEventRequestDto,
})
@IsArray()
@ArrayNotEmpty()
@ArrayMaxSize(100)
events: TriggerEventRequestDto[];
}
1 change: 1 addition & 0 deletions apps/api/src/app/shared/dtos/pagination-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class PaginatedResponseDto<T> implements IPaginatedResponseDto<T> {
@ApiProperty({
description: 'The list of items matching the query',
isArray: true,
type: Object,
})
data: T[];
}

0 comments on commit 8b48525

Please sign in to comment.