-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(sample): use openapi cli plugin for dtos and schema (#1611)
## Description Use openapi plugin in samples module ## Motivation <!-- Background on use case, changes needed --> ## Fixes Related to #1590 ## Changes: * Removed all @ApiProperty decorators in samples module. ## Tests included - [ ] Included for each change/fix? - [x] Passing? <!-- Merge will not be approved unless tests pass --> ## Documentation - [ ] swagger documentation updated (required for API changes) - [ ] official documentation updated
- Loading branch information
Showing
5 changed files
with
46 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,35 @@ | ||
import { ApiProperty, PartialType } from "@nestjs/swagger"; | ||
import { PartialType } from "@nestjs/swagger"; | ||
import { IsBoolean, IsObject, IsOptional, IsString } from "class-validator"; | ||
import { OwnableDto } from "../../common/dto/ownable.dto"; | ||
|
||
export class UpdateSampleDto extends OwnableDto { | ||
@ApiProperty({ | ||
type: String, | ||
required: false, | ||
description: "The owner of the sample.", | ||
}) | ||
/** | ||
* The owner of the sample. | ||
*/ | ||
@IsString() | ||
@IsOptional() | ||
readonly owner?: string; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
required: false, | ||
description: "A description of the sample.", | ||
}) | ||
/** | ||
* A description of the sample. | ||
*/ | ||
@IsString() | ||
@IsOptional() | ||
readonly description?: string; | ||
|
||
@ApiProperty({ | ||
type: Object, | ||
default: {}, | ||
required: false, | ||
description: "JSON object containing the sample characteristics metadata.", | ||
}) | ||
/** | ||
* JSON object containing the sample characteristics metadata. | ||
*/ | ||
@IsObject() | ||
@IsOptional() | ||
readonly sampleCharacteristics?: Record<string, unknown>; | ||
readonly sampleCharacteristics?: Record<string, unknown> = {}; | ||
|
||
@ApiProperty({ | ||
type: Boolean, | ||
default: false, | ||
required: false, | ||
description: "Flag is true when data are made publicly available.", | ||
}) | ||
/** | ||
* Flag is true when data are made publicly available. | ||
*/ | ||
@IsBoolean() | ||
@IsOptional() | ||
readonly isPublished?: boolean; | ||
readonly isPublished?: boolean = false; | ||
} | ||
|
||
export class PartialUpdateSampleDto extends PartialType(UpdateSampleDto) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters