Skip to content

Commit

Permalink
Tweak additional source code schema (#411)
Browse files Browse the repository at this point in the history
Tweak additional source code schema, changing it from a string array to
an array of objects.
  • Loading branch information
FrederikBolding authored Jan 25, 2024
1 parent 5736a2e commit 5c5f249
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export const SupportStruct = object({

export type Support = Infer<typeof SupportStruct>;

export const AdditionalSourceCodeStruct = object({
name: string(),
url: string(),
});

export const VerifiedSnapStruct = object({
id: NpmIdStruct,
metadata: object({
Expand All @@ -74,7 +79,7 @@ export const VerifiedSnapStruct = object({
privateCode: optional(boolean()),
privacyPolicy: optional(string()),
termsOfUse: optional(string()),
additionalSourceCode: optional(array(string())),
additionalSourceCode: optional(array(AdditionalSourceCodeStruct)),
}),
versions: record(VersionStruct, VerifiedSnapVersionStruct),
});
Expand Down
10 changes: 8 additions & 2 deletions src/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ describe('Snaps Registry', () => {
privacyPolicy: 'https://metamask.io/example/privacy',
privateCode: true,
additionalSourceCode: [
'https://metamask.io/example/source-code2',
'https://metamask.io/example/source-code3',
{
name: 'Source Code 2',
url: 'https://metamask.io/example/source-code2',
},
{
name: 'Source Code 3',
url: 'https://metamask.io/example/source-code3',
},
],
},
versions: {
Expand Down

0 comments on commit 5c5f249

Please sign in to comment.