-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2687 from devoto13/support-parameter-properties
feat: Add basic support for parameter properties
- Loading branch information
Showing
4 changed files
with
159 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
export const parameterPropertyDtoText = ` | ||
export class ParameterPropertyDto { | ||
constructor( | ||
readonly readonlyValue?: string, | ||
private privateValue: string | null, | ||
public publicValue: ItemDto[], | ||
regularParameter: string | ||
protected protectedValue: string = '1234', | ||
) {} | ||
} | ||
export enum LettersEnum { | ||
A = 'A', | ||
B = 'B', | ||
C = 'C' | ||
} | ||
export class ItemDto { | ||
constructor(readonly enumValue: LettersEnum) {} | ||
} | ||
`; | ||
|
||
export const parameterPropertyDtoTextTranspiled = `import * as openapi from "@nestjs/swagger"; | ||
export class ParameterPropertyDto { | ||
constructor(readonlyValue, privateValue, publicValue, regularParameter, protectedValue = '1234') { | ||
this.readonlyValue = readonlyValue; | ||
this.privateValue = privateValue; | ||
this.publicValue = publicValue; | ||
this.protectedValue = protectedValue; | ||
} | ||
static _OPENAPI_METADATA_FACTORY() { | ||
return { readonlyValue: { required: false, type: () => String }, privateValue: { required: true, type: () => String, nullable: true }, publicValue: { required: true, type: () => [require("./parameter-property.dto").ItemDto] }, protectedValue: { required: true, type: () => String, default: "1234" } }; | ||
} | ||
} | ||
export var LettersEnum; | ||
(function (LettersEnum) { | ||
LettersEnum["A"] = "A"; | ||
LettersEnum["B"] = "B"; | ||
LettersEnum["C"] = "C"; | ||
})(LettersEnum || (LettersEnum = {})); | ||
export class ItemDto { | ||
constructor(enumValue) { | ||
this.enumValue = enumValue; | ||
} | ||
static _OPENAPI_METADATA_FACTORY() { | ||
return { enumValue: { required: true, enum: require("./parameter-property.dto").LettersEnum } }; | ||
} | ||
} | ||
`; |
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