Skip to content
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

Update schema validation for credential schema #367

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Changed

- Adjusted the schema validation for credential schemas to no longer require title and description. The type is now required to be 'object'.

### Fixed

- An issue where changing the credential metadata URL to an invalid URL, or a URL that does not contain a credential metadata file, would result in an empty screen.
Expand Down
5 changes: 4 additions & 1 deletion packages/browser-wallet/src/shared/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,12 @@ export type TimestampProperty = {
};

type CredentialSchemaAttributes = {
title?: string;
description?: string;
type: 'object';
properties: Record<string, CredentialSchemaProperty | TimestampProperty>;
required: string[];
} & CredentialSchemaProperty;
};

interface CredentialSchemaSubject {
type: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,6 @@ const verifiableCredentialSchemaSchema = {
description: {
type: 'string',
},
format: {
type: 'string',
},
properties: {
additionalProperties: {
anyOf: [
Expand Down Expand Up @@ -419,10 +416,11 @@ const verifiableCredentialSchemaSchema = {
type: 'string',
},
type: {
const: 'object',
type: 'string',
},
},
required: ['description', 'properties', 'required', 'title', 'type'],
required: ['type', 'properties', 'required'],
type: 'object',
},
id: {
Expand Down
Loading