Skip to content
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

fix swagger for two controllers #1919

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ export class MetricController {
* type: array
* children:
* type: array
* context:
* type: array
* items:
* type: string
* description: Filtered Metrics
* tags:
* - Experiment Point
* - Metrics
* produces:
* - application/json
* responses:
Expand Down
71 changes: 67 additions & 4 deletions backend/packages/Upgrade/src/api/controllers/SegmentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface getSegmentData {
* type: array
* items:
* type: string
* example: '5812a759-1dcf-47a8-b0ba-26c89092863e'
* segmentResponse:
* description: ''
* type: object
Expand Down Expand Up @@ -231,6 +232,7 @@ export class SegmentController {
* required: true
* schema:
* type: string
* example: '5812a759-1dcf-47a8-b0ba-26c89092863e'
* responses:
* '200':
* description: Get segment by id
Expand Down Expand Up @@ -352,6 +354,7 @@ export class SegmentController {
* required: true
* schema:
* type: string
* example: '5812a759-1dcf-47a8-b0ba-26c89092863e'
* responses:
* '200':
* description: Delete a segment
Expand Down Expand Up @@ -414,15 +417,25 @@ export class SegmentController {

/**
* @swagger
* /segments/{validation}:
* put:
* /segments/validation:
* post:
* description: Validating Segments
* consumes:
* - application/json
* parameters:
* - in: path
* - in: body
* name: params
* description: Segment file
* required: true
* schema:
* type: object
* properties:
* fileName:
* type: string
* fileContent:
* type: string
* tags:
* - Segments
* - Segment
* produces:
* - application/json
* responses:
Expand All @@ -439,6 +452,31 @@ export class SegmentController {
return this.segmentService.validateSegments(segments, request.logger);
}

/**
* @swagger
* /segments/export/json:
* get:
* description: Get segment JSON export
* produces:
* - application/json
* parameters:
* - in: path
* name: segmentId
* description: Segment id
* required: true
* schema:
* type: array
* items:
* type: string
* example: '5812a759-1dcf-47a8-b0ba-26c89092863e'
* tags:
* - Segment
* responses:
* '200':
* description: Get segment JSON export
* '401':
* description: AuthorizationRequiredError
*/
@Get('/export/json')
public exportSegments(
@QueryParams()
Expand All @@ -449,6 +487,31 @@ export class SegmentController {
return this.segmentService.exportSegments(segmentIds, request.logger);
}

/**
* @swagger
* /segments/export/csv:
* get:
* description: Get segment csv export
* produces:
* - application/json
* parameters:
* - in: path
* name: segmentId
* description: Segment id
* required: true
* schema:
* type: array
* items:
* type: string
* example: '5812a759-1dcf-47a8-b0ba-26c89092863e'
* tags:
* - Segment
* responses:
* '200':
* description: Get segment csv export
* '401':
* description: AuthorizationRequiredError
*/
@Get('/export/csv')
public exportSegment(
@QueryParams()
Expand Down
Loading