src/issuer/configuration/credentials/dto/claim-field-definition.dto.ts
Properties |
|
| Optional constraints |
Type : Record<string | unknown>
|
Decorators :
@ApiPropertyOptional({description: 'Additional JSON schema constraints for this field', type: Object})
|
| Optional defaultValue |
Type : unknown
|
Decorators :
@ApiPropertyOptional({description: 'Default value', oneOf: undefined})
|
| Optional disclosable |
Type : boolean
|
Decorators :
@ApiPropertyOptional({description: 'Whether claim is disclosable in SD-JWT'})
|
| Optional display |
Type : FieldDisplayDto[]
|
Decorators :
@ApiPropertyOptional({type: () => })
|
| Optional mandatory |
Type : boolean
|
Decorators :
@ApiPropertyOptional({description: 'Whether claim is mandatory'})
|
| Optional namespace |
Type : string
|
Decorators :
@ApiPropertyOptional({description: 'Namespace for mDOC field', example: 'eu.europa.ec.eudi.pid.1'})
|
| path |
Type : Array<string | number | null>
|
Decorators :
@ApiProperty({description: 'Path to claim value', example: undefined, type: 'array', items: undefined})
|
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
IsBoolean,
IsIn,
IsObject,
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
export class FieldDisplayDto {
@ApiProperty({
description: "Locale code based on BCP47 (RFC 5646)",
example: "en-US",
})
@IsString()
locale!: string;
@ApiProperty({ description: "Display name", example: "Given Name" })
@IsString()
name!: string;
@ApiPropertyOptional({
description: "Optional display description",
example: "Primary first name",
})
@IsOptional()
@IsString()
description?: string;
}
export class ClaimFieldDefinitionDto {
@ApiProperty({
description: "Path to claim value",
example: ["address", "locality"],
type: "array",
items: {
oneOf: [{ type: "string" }, { type: "number" }, { type: "null" }],
},
})
@IsArray()
path!: Array<string | number | null>;
@ApiProperty({
description: "Claim value type",
enum: [
"string",
"number",
"integer",
"boolean",
"object",
"array",
"date",
],
})
@IsString()
@IsIn(["string", "number", "integer", "boolean", "object", "array", "date"])
type!:
| "string"
| "number"
| "integer"
| "boolean"
| "object"
| "array"
| "date";
@ApiPropertyOptional({
description: "Default value",
oneOf: [
{ type: "string" },
{ type: "number" },
{ type: "boolean" },
{ type: "object", additionalProperties: true },
{ type: "array", items: {} },
{ type: "null" },
],
})
@IsOptional()
defaultValue?: unknown;
@ApiPropertyOptional({ description: "Whether claim is mandatory" })
@IsOptional()
@IsBoolean()
mandatory?: boolean;
@ApiPropertyOptional({
description: "Whether claim is disclosable in SD-JWT",
})
@IsOptional()
@IsBoolean()
disclosable?: boolean;
@ApiPropertyOptional({
description: "Namespace for mDOC field",
example: "eu.europa.ec.eudi.pid.1",
})
@IsOptional()
@IsString()
namespace?: string;
@ApiPropertyOptional({ type: () => [FieldDisplayDto] })
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => FieldDisplayDto)
display?: FieldDisplayDto[];
@ApiPropertyOptional({
description: "Additional JSON schema constraints for this field",
type: Object,
})
@IsOptional()
@IsObject()
constraints?: Record<string, unknown>;
}