Skip to content

Commit

Permalink
test (#13)
Browse files Browse the repository at this point in the history
* test

* better debug message

* better debug message

* better debug message

* subdoc parsing

* subdoc parsing
  • Loading branch information
dandlezzz authored Oct 14, 2024
1 parent 9549cc7 commit 9db5527
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 42 deletions.
28 changes: 19 additions & 9 deletions .github/scripts/validate-and-merge.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,12 @@ async function validateAndMerge() {
const content = Buffer.from(fileContent.content, 'base64').toString('utf-8');

// Parse all YAML documents in the file
const yamlDocuments = yaml.loadAll(content);
const yamlDocuments = yaml.load(content);

for (const document of yamlDocuments) {
const isValid = requiredKeys.every(key => key in document);

const isValid = validateSubdocument(document);
if (!isValid) {
console.log('Added object does not contain all required keys');
return;
}

if (!Array.isArray(document.categories) || document.categories.length === 0) {
console.log('Categories must be a non-empty array');
console.log(`Invalid subdocument: ${JSON.stringify(document)}`);
return;
}
}
Expand All @@ -88,4 +82,20 @@ async function validateAndMerge() {
}
}

function validateSubdocument(subdocument) {
const isValid = requiredKeys.every(key => key in subdocument);

if (!isValid) {
console.log(`Subdocument is missing required keys: ${JSON.stringify(subdocument)}`);
return false;
}

if (!Array.isArray(subdocument.categories) || subdocument.categories.length === 0) {
console.log('Categories must be a non-empty array');
return false;
}

return true;
}

validateAndMerge();
33 changes: 0 additions & 33 deletions node_modules/.yarn-integrity

This file was deleted.

11 changes: 11 additions & 0 deletions programs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,14 @@
- NFT Marketplace
- Nft Launchpad
- Nft infra

- name: test
description: test
repo: https://github.com/blobscriptions/blobscriptions
icon: https://blobscriptions.xyz/blobscriptions-logo.png
framework: NextJS
program_address: "sfsd"
categories:
- NFT Marketplace
- Nft Launchpad
- Nft infra

0 comments on commit 9db5527

Please sign in to comment.