-
Notifications
You must be signed in to change notification settings - Fork 9
feat: [LC-1309][LC-1310] - Add Evidence Support #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gerardopar
wants to merge
9
commits into
main
Choose a base branch
from
lc-1310
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+331
β20
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
594b3f4
update template-types, add evidence support
gerardopar 5bc931d
update boost-VC templates, add evidence
gerardopar ac3cae2
update evidence validators
gerardopar 15886c6
extend evidence fields, add additional meta data
gerardopar 713d875
bump context 1.0.3, add EvidenceFile
gerardopar c025b16
bump context -> 1.0.3
gerardopar c026e93
Create rare-forks-occur.md
gerardopar c8d7d15
Merge branch 'main' of github.com:learningeconomy/LearnCard into lc-1310
gerardopar 2a3cf53
Merge branch 'lc-1310' of github.com:learningeconomy/LearnCard into lβ¦
gerardopar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,6 @@ | ||
--- | ||
"@learncard/types": patch | ||
"@learncard/vc-templates-plugin": patch | ||
--- | ||
|
||
feat: LC-1310 - Add Evidence Support |
This file contains hidden or 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,252 @@ | ||
{ | ||
"@context": { | ||
"id": "@id", | ||
"type": "@type", | ||
"lcn": "https://docs.learncard.com/definitions#", | ||
"cred": "https://www.w3.org/2018/credentials#", | ||
"xsd": "https://www.w3.org/2001/XMLSchema#", | ||
"EvidenceFile": { | ||
"@id": "https://docs.learncard.com/definitions#EvidenceFile", | ||
"@context": { | ||
"fileName": { | ||
"@id": "https://docs.learncard.com/definitions#evidenceFileName", | ||
"@type": "xsd:string" | ||
}, | ||
"fileType": { | ||
"@id": "https://docs.learncard.com/definitions#evidenceFileType", | ||
"@type": "xsd:string" | ||
}, | ||
"fileSize": { | ||
"@id": "https://docs.learncard.com/definitions#evidenceFileSize", | ||
"@type": "xsd:string" | ||
} | ||
} | ||
}, | ||
"BoostCredential": { | ||
"@context": { | ||
"address": { | ||
"@id": "https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address" | ||
}, | ||
"attachments": { | ||
"@container": "@set", | ||
"@context": { | ||
"title": { | ||
"@id": "lcn:boostAttachmentTitle", | ||
"@type": "xsd:string" | ||
}, | ||
"type": { | ||
"@id": "lcn:boostAttachmentType", | ||
"@type": "xsd:string" | ||
}, | ||
"url": { | ||
"@id": "lcn:boostAttachmentUrl", | ||
"@type": "xsd:string" | ||
}, | ||
"fileName": { | ||
"@id": "lcn:boostAttachmentFileName", | ||
"@type": "xsd:string" | ||
}, | ||
"fileSize": { | ||
"@id": "lcn:boostAttachmentFileSize", | ||
"@type": "xsd:string" | ||
}, | ||
"fileType": { | ||
"@id": "lcn:boostAttachmentFileType", | ||
"@type": "xsd:string" | ||
} | ||
}, | ||
"@id": "lcn:boostAttachments" | ||
}, | ||
"boostId": { | ||
"@id": "lcn:boostId", | ||
"@type": "xsd:string" | ||
}, | ||
"display": { | ||
"@context": { | ||
"backgroundColor": { | ||
"@id": "lcn:boostBackgroundColor", | ||
"@type": "xsd:string" | ||
}, | ||
"backgroundImage": { | ||
"@id": "lcn:boostBackgroundImage", | ||
"@type": "xsd:string" | ||
}, | ||
"displayType": { | ||
"@id": "lcn:boostDisplayType", | ||
"@type": "xsd:string" | ||
}, | ||
"previewType": { | ||
"@id": "lcn:boostPreviewType", | ||
"@type": "xsd:string" | ||
}, | ||
"emoji": { | ||
"@context": { | ||
"activeSkinTone": { | ||
"@id": "lcn:boostEmojiActiveSkinTone", | ||
"@type": "xsd:string" | ||
}, | ||
"imageUrl": { | ||
"@id": "lcn:boostEmojiImageUrl", | ||
"@type": "xsd:string" | ||
}, | ||
"names": { | ||
"@container": "@set", | ||
"@id": "lcn:boostEmojiNames", | ||
"@type": "xsd:string" | ||
}, | ||
"unified": { | ||
"@id": "lcn:boostEmojiUnified", | ||
"@type": "xsd:string" | ||
}, | ||
"unifiedWithoutSkinTone": { | ||
"@id": "lcn:boostEmojiUnifiedWithoutSkinTone", | ||
"@type": "xsd:string" | ||
} | ||
}, | ||
"@id": "lcn:boostEmoji" | ||
}, | ||
"fadeBackgroundImage": { | ||
"@id": "lcn:boostFadeBackgroundImage", | ||
"@type": "xsd:boolean" | ||
}, | ||
"repeatBackgroundImage": { | ||
"@id": "lcn:boostRepeatBackgroundImage", | ||
"@type": "xsd:boolean" | ||
} | ||
}, | ||
"@id": "lcn:boostDisplay" | ||
}, | ||
"familyTitles": { | ||
"@context": { | ||
"dependents": { | ||
"@container": "@set", | ||
"@context": { | ||
"plural": { | ||
"@id": "lcn:plural", | ||
"@type": "xsd:string" | ||
}, | ||
"singular": { | ||
"@id": "lcn:singular", | ||
"@type": "xsd:string" | ||
} | ||
}, | ||
"@id": "lcn:dependents" | ||
}, | ||
"guardians": { | ||
"@container": "@set", | ||
"@context": { | ||
"plural": { | ||
"@id": "lcn:plural", | ||
"@type": "xsd:string" | ||
}, | ||
"singular": { | ||
"@id": "lcn:singular", | ||
"@type": "xsd:string" | ||
} | ||
}, | ||
"@id": "lcn:guardians" | ||
} | ||
}, | ||
"@id": "lcn:familyTitles" | ||
}, | ||
"groupID": { | ||
"@id": "lcn:groupID", | ||
"@type": "xsd:string" | ||
}, | ||
"skills": { | ||
"@container": "@set", | ||
"@context": { | ||
"category": { | ||
"@id": "lcn:boostSkillCategory", | ||
"@type": "xsd:string" | ||
}, | ||
"skill": { | ||
"@id": "lcn:boostSkill", | ||
"@type": "xsd:string" | ||
}, | ||
"subskills": { | ||
"@container": "@set", | ||
"@id": "lcn:boostSubskills", | ||
"@type": "xsd:string" | ||
} | ||
}, | ||
"@id": "lcn:boostSkills" | ||
} | ||
}, | ||
"@id": "lcn:boostCredential" | ||
}, | ||
"BoostID": { | ||
"@id": "lcn:boostID", | ||
"@context": { | ||
"boostID": { | ||
"@id": "lcn:boostIDField", | ||
"@context": { | ||
"fontColor": { | ||
"@id": "lcn:boostIDFontColor", | ||
"@type": "xsd:string" | ||
}, | ||
"accentColor": { | ||
"@id": "lcn:boostIDAccentColor", | ||
"@type": "xsd:string" | ||
}, | ||
"backgroundImage": { | ||
"@id": "lcn:boostIDBackgroundImage", | ||
"@type": "xsd:string" | ||
}, | ||
"dimBackgroundImage": { | ||
"@id": "lcn:boostIDDimBackgroundImage", | ||
"@type": "xsd:boolean" | ||
}, | ||
"issuerThumbnail": { | ||
"@id": "lcn:boostIDIssuerThumbnail", | ||
"@type": "xsd:string" | ||
}, | ||
"showIssuerThumbnail": { | ||
"@id": "lcn:boostIDShowIssuerThumbnail", | ||
"@type": "xsd:boolean" | ||
}, | ||
"IDIssuerName": { | ||
"@id": "lcn:boostIDIssuerName", | ||
"@type": "xsd:string" | ||
}, | ||
"idThumbnail": { | ||
"@id": "lcn:boostIDThumbnail", | ||
"@type": "xsd:string" | ||
}, | ||
"accentFontColor": { | ||
"@id": "lcn:boostIDFontColor", | ||
"@type": "xsd:string" | ||
}, | ||
"idBackgroundColor": { | ||
"@id": "lcn:boostIDBackgroundColor", | ||
"@type": "xsd:string" | ||
}, | ||
"repeatIdBackgroundImage": { | ||
"@id": "lcn:boostIDRepeatIdBackgroundImage", | ||
"@type": "xsd:boolean" | ||
}, | ||
"idDescription": { | ||
"@id": "lcn:boostIDDescription", | ||
"@type": "xsd:string" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"CertifiedBoostCredential": { | ||
"@id": "lcn:certifiedBoostCredential", | ||
"@context": { | ||
"@version": 1.1, | ||
"boostId": { | ||
"@id": "lcn:boostId", | ||
"@type": "xsd:string" | ||
}, | ||
"boostCredential": { | ||
"@id": "cred:VerifiableCredential", | ||
"@type": "@id", | ||
"@container": "@graph" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 | ||||
---|---|---|---|---|---|---|
|
@@ -122,7 +122,15 @@ export const TermsOfUseValidator = z | |||||
export type TermsOfUse = z.infer<typeof TermsOfUseValidator>; | ||||||
|
||||||
export const VC2EvidenceValidator = z | ||||||
.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }) | ||||||
.object({ | ||||||
id: z.string().optional(), | ||||||
type: z.array(z.string()).nonempty(), | ||||||
name: z.string().optional(), | ||||||
narrative: z.string().optional(), | ||||||
description: z.string().optional(), | ||||||
genre: z.string().optional(), | ||||||
audience: z.string().optional(), | ||||||
}) | ||||||
.catchall(z.any()); | ||||||
export type VC2Evidence = z.infer<typeof VC2EvidenceValidator>; | ||||||
|
||||||
|
@@ -152,7 +160,7 @@ export const UnsignedVCValidator = z | |||||
validUntil: z.string().optional(), | ||||||
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(), | ||||||
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(), | ||||||
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional(), | ||||||
evidence: z.union([VC2EvidenceValidator, z.array(VC2EvidenceValidator)]).optional(), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§Ή Maintainability - Inconsistent Validation Pattern: Change to use the consistent .or() pattern:
Suggested change
|
||||||
}) | ||||||
.catchall(z.any()); | ||||||
export type UnsignedVC = z.infer<typeof UnsignedVCValidator>; | ||||||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π§Ή Maintainability - Inconsistent Union Syntax: Use consistent syntax by changing to VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional() to match the pattern used for other similar fields.