Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/multichain-pa…
Browse files Browse the repository at this point in the history
…yment
  • Loading branch information
x1m3 committed Dec 19, 2024
2 parents 9f63af5 + 241ad97 commit 9b6438c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ui/src/components/credentials/IssueCredentialForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ export function IssueCredentialForm({
}
};

const isCountryCode = (x: number) => {
const iso31661NumericRegex = /^\d{1,3}$/;
return iso31661NumericRegex.test(x.toString());
};

function isFormValid(value: Record<string, unknown>, objectAttribute: ObjectAttribute): boolean {
if (isAsyncTaskDataAvailable(jsonSchema)) {
const serializedSchemaForm = serializeSchemaForm({
Expand All @@ -165,10 +170,18 @@ export function IssueCredentialForm({
type: "string",
validate: isPositiveBigInt,
});
ajv.addFormat("positive-integer-eth-address", {
type: "string",
validate: isPositiveBigInt,
});
ajv.addFormat("non-negative-integer", {
type: "string",
validate: isNonNegativeBigInt,
});
ajv.addFormat("iso-3166-1-numeric", {
type: "number",
validate: isCountryCode,
});
ajv.addVocabulary(["$metadata"]);
applyDraft2019Formats(ajv);

Expand Down

0 comments on commit 9b6438c

Please sign in to comment.