Skip to content

Commit

Permalink
Add restricted field to a json
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipZajdel committed Jan 17, 2025
1 parent 8e705ac commit eeb946f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions resources/output_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@
},
"docsUrl": {
"type": "string"
},
"restricted": {
"type": "boolean",
"default": false
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
"docsUrl": {
"type": "string",
"description": "The url of the addon's documentation"
},
"restricted": {
"type": "boolean",
"description": "Mark the restricted access to any of dependencies.",
"default": false
}
},
"additionalProperties": false,
Expand Down
4 changes: 4 additions & 0 deletions scripts/generate-index-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
Organization,
Application,
} from '../site/src/schema';
import { appIndexSchema } from '../site/src/schema';
import { ParsedOrgFile, readOrgIndexFiles } from './orgFiles';
import { execSync } from 'child_process';

Expand Down Expand Up @@ -143,6 +144,8 @@ async function fetchRepoData(

let docsUrl = app.docsUrl ?? await getReadmeUrl(orgId, app);

const restricted = app.restricted ? app.restricted : appIndexSchema.properties.apps.items.properties.restricted?.default;

console.log(colours.green(`Fetched data for ${orgId}/${app.name}`));

return {
Expand All @@ -164,6 +167,7 @@ async function fetchRepoData(
releases: app.releases,
tags: app.tags,
docsUrl: docsUrl,
restricted: restricted,
};
} catch {
throw new Error(`Failed to fetch data for ${orgId}/${app.name}`);
Expand Down
6 changes: 6 additions & 0 deletions site/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ export const appMetadataSchema = {
docsUrl: {
type: 'string',
description: `The url of the addon's documentation`
},
restricted: {
type: 'boolean',
description: 'Mark the restricted access to any of dependencies.',
default: false
}
},
additionalProperties: false,
Expand Down Expand Up @@ -215,6 +220,7 @@ export const appSchema = {
lastUpdate: { type: 'string', format: 'date-time' },
apps: { type: 'string' },
docsUrl: { type: 'string' },
restricted: { type: 'boolean', default: false },
},
required: [
'id',
Expand Down

0 comments on commit eeb946f

Please sign in to comment.