-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issuance API with required attribute (#528)
* fix:issuance api Signed-off-by: pranalidhanavade <[email protected]> * fix:issuance api issue Signed-off-by: pranalidhanavade <[email protected]> * fix:sonarlint issues Signed-off-by: pranalidhanavade <[email protected]> * fix:requried attribute in issuance api Signed-off-by: pranalidhanavade <[email protected]> * fix:requried attributes in csv file Signed-off-by: pranalidhanavade <[email protected]> --------- Signed-off-by: pranalidhanavade <[email protected]> Signed-off-by: KulkarniShashank <[email protected]>
- Loading branch information
1 parent
541a06c
commit 11d7b50
Showing
2 changed files
with
170 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,11 @@ class Attribute { | |
@Transform(({ value }) => trim(value)) | ||
value: string; | ||
|
||
@ApiProperty() | ||
@ApiProperty({ default: false }) | ||
@IsBoolean() | ||
@IsOptional() | ||
@IsNotEmpty({ message: 'isRequired property is required' }) | ||
isRequired: boolean; | ||
isRequired?: boolean = false; | ||
|
||
} | ||
|
||
|
@@ -86,8 +87,7 @@ export class OOBIssueCredentialDto extends CredentialsIssuanceDto { | |
example: [ | ||
{ | ||
value: 'string', | ||
name: 'string', | ||
isRequired: 'boolean' | ||
name: 'string' | ||
} | ||
] | ||
}) | ||
|
@@ -99,7 +99,7 @@ export class OOBIssueCredentialDto extends CredentialsIssuanceDto { | |
} | ||
|
||
class CredentialOffer { | ||
@ApiProperty({ example: [{ 'value': 'string', 'name': 'string', 'isRequired':'boolean' }] }) | ||
@ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] }) | ||
@IsNotEmpty({ message: 'Attribute name is required' }) | ||
@IsArray({ message: 'Attributes should be an array' }) | ||
@ArrayNotEmpty({ message: 'Attributes are required' }) | ||
|
@@ -108,8 +108,8 @@ class CredentialOffer { | |
@Type(() => Attribute) | ||
attributes: Attribute[]; | ||
|
||
@ApiProperty() | ||
@IsEmail({}, { message: 'Email is invalid' }) | ||
@ApiProperty({ example: '[email protected]' }) | ||
@IsEmail({}, { message: 'Please provide a valid email' }) | ||
@IsNotEmpty({ message: 'Email is required' }) | ||
@MaxLength(256, { message: 'Email must be at most 256 character' }) | ||
@Transform(({ value }) => trim(value)) | ||
|
@@ -212,7 +212,7 @@ export class CredentialAttributes { | |
} | ||
|
||
export class OOBCredentialDtoWithEmail { | ||
@ApiProperty({ example: [{ 'emailId': '[email protected]', 'attributes': [{ 'value': 'string', 'name': 'string', 'isRequired':'boolean' }] }] }) | ||
@ApiProperty({ example: [{ 'emailId': '[email protected]', 'attributes': [{ 'value': 'string', 'name': 'string' }] }] }) | ||
@IsNotEmpty({ message: 'Please provide valid attributes' }) | ||
@IsArray({ message: 'attributes should be array' }) | ||
@ArrayMaxSize(Number(process.env.OOB_BATCH_SIZE), { message: `Limit reached (${process.env.OOB_BATCH_SIZE} credentials max). Easily handle larger batches via seamless CSV file uploads` }) | ||
|
Oops, something went wrong.