Skip to content

Commit a0cb0dc

Browse files
Merge pull request #65 from DSACMS/DSACMS/nat/more-schema-updates
Add optional fields to model
2 parents a14edaf + 2a4c19a commit a0cb0dc

5 files changed

Lines changed: 74 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ The automated code.json generator calculates specific fields by analyzing your r
7676
7777
**languages**: This field populates the programming languages in your repository. No configuration needed.
7878
79+
**SBOM**: The repository's SBOM URL in the format of {repositoryURL/network/dependencies}. If you already have a code.json file with the SBOM, the generator preserves those values. No configuration needed.
80+
7981
**dateCreated**: The generator pulls your repository's creation date. No configuration needed.
8082
8183
**dateLastModified**: This uses your repository's last update timestamp, reflecting the most recent changes. No configuration needed.

dist/index.js

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/model.d.ts

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as helpers from "./helper.js";
33

44
const baselineCodeJSON: CodeJSON = {
55
name: "",
6+
version: "",
67
description: "",
78
longDescription: "",
89
status: "",
@@ -18,9 +19,12 @@ const baselineCodeJSON: CodeJSON = {
1819
},
1920
organization: "",
2021
repositoryURL: "",
21-
projectURL: "",
2222
repositoryHost: "github",
2323
repositoryVisibility: "",
24+
homepageURL: "",
25+
downloadURL: "",
26+
disclaimerURL: "",
27+
disclaimerText: "",
2428
vcs: "git",
2529
laborHours: 0,
2630
reuseFrequency: {
@@ -33,6 +37,10 @@ const baselineCodeJSON: CodeJSON = {
3337
languages: [],
3438
maintenance: "",
3539
contractNumber: [],
40+
SBOM: "",
41+
relatedCode: [],
42+
reusedCode: [],
43+
partners: [],
3644
date: {
3745
created: "",
3846
lastModified: "",
@@ -52,7 +60,6 @@ const baselineCodeJSON: CodeJSON = {
5260
group: "",
5361
projects: [],
5462
systems: [],
55-
upstream: "",
5663
subsetInHealthcare: [],
5764
userType: [],
5865
maturityModelTier: 0,
@@ -66,6 +73,9 @@ async function getMetaData(
6673
// preserve existing feedback mechanisms if they exist, otherwise default to GitHub Issues
6774
const feedbackMechanism = existingCodeJSON?.feedbackMechanism || `${partialCodeJSON.repositoryURL}/issues`;
6875

76+
// preserve existing SBOM link if they exist, otherwise default to GitHub SBOM link
77+
const SBOM = existingCodeJSON?.SBOM || `${partialCodeJSON.repositoryURL}/network/dependencies`;
78+
6979
// only use the calculated description if its not empty, otherwise keep existing
7080
const shouldUpdateDescription =
7181
partialCodeJSON.description && partialCodeJSON.description.trim() !== "";
@@ -99,6 +109,7 @@ async function getMetaData(
99109
partialCodeJSON.date?.metaDataLastUpdated ?? new Date().toISOString(),
100110
},
101111
feedbackMechanism,
112+
SBOM
102113
};
103114
}
104115

src/model.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
export interface CodeJSON {
22
name: string; // calculated
3+
version?: string;
34
description: string; // calculated
45
longDescription: string;
56
status: string;
67
permissions: Permissions;
78
organization: string;
89
repositoryURL: string; // calculated
9-
projectURL: string;
1010
repositoryHost: string;
1111
repositoryVisibility: string; // calculated
12+
homepageURL?: string;
13+
downloadURL?: string;
14+
disclaimerURL?: string;
15+
disclaimerText?: string;
1216
vcs: string;
1317
laborHours: number; // calculated
1418
reuseFrequency: ReuseFrequency; // semi-calculated
@@ -18,6 +22,10 @@ export interface CodeJSON {
1822
languages: string[]; // calculated
1923
maintenance: string;
2024
contractNumber: string[];
25+
SBOM: string; //calculated
26+
relatedCode?: RelatedCode[];
27+
reusedCode?: ReusedCode[];
28+
partners?: Partner[];
2129
date: Date; // calculated
2230
tags: string[]; // calculated
2331
contact: Contact;
@@ -30,7 +38,6 @@ export interface CodeJSON {
3038
group: string;
3139
projects: string[];
3240
systems: string[];
33-
upstream: string;
3441
subsetInHealthcare: string[];
3542
userType: string[];
3643
maturityModelTier: number;
@@ -52,6 +59,22 @@ export interface License {
5259
URL: string;
5360
}
5461

62+
export interface RelatedCode {
63+
name: string;
64+
URL: string;
65+
isGovernmentRepo: boolean;
66+
}
67+
68+
export interface ReusedCode {
69+
name: string;
70+
URL: string;
71+
}
72+
73+
export interface Partner {
74+
name: string;
75+
email: string;
76+
}
77+
5578
export interface Date {
5679
created: string;
5780
lastModified: string;

0 commit comments

Comments
 (0)