Skip to content
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
2 changes: 1 addition & 1 deletion js/autoGenerateFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async function preFillFields(repoData, languages) {

// Update feedback mechanisms
if (repoData.html_url) {
const feedbackComp = form.getComponent('feedbackMechanisms')
const feedbackComp = form.getComponent('feedbackMechanism')

const issuesUrl = repoData.html_url + "/issues"

Expand Down
8 changes: 6 additions & 2 deletions js/formDataToJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async function retrieveFile(filePath) {

function isMultiSelect(obj) {
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) return false;

for (const key in obj) {
if (typeof obj[key] !== 'boolean') {
return false;
Expand Down Expand Up @@ -45,12 +44,17 @@ function populateObject(data, fields) {
for (const field of fields) {
let value = data[field];

// Does not assign optional properties with blank values
if (value == null || value === "") {
continue;
}

// Adjusts value accordingly if multi-select field
if ((typeof value === "object" && isMultiSelect(value))) {
value = getSelectedOptions(value);
}
// Recurses if multi-field object
else if (typeof value === 'object' && value !== null && Object.keys(value).length > 1) {
else if (typeof value === 'object' && !Array.isArray(value) && value !== null && Object.keys(value).length > 1) {
value = populateObject(value, Object.keys(value));
}

Expand Down
43 changes: 23 additions & 20 deletions schemas/cms/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
},
"description": {
"type": "string",
"description": "A short description of the project. It should be a single line containing a single sentence. Maximum 150 characters are allowed.",
"maxLength": 150
"description": "A one or two sentence description of the software."
},
"longDescription": {
"type": "string",
Expand Down Expand Up @@ -82,7 +81,7 @@
"openSource",
"governmentWideReuse",
"exemptByNationalSecurity",
"exemptByIntelligence",
"exemptByNationalIntelligence",
"exemptByFOIA",
"exemptByEAR",
"exemptByITAR",
Expand Down Expand Up @@ -115,7 +114,10 @@
},
"organization": {
"type": "string",
"description": "The organization or component within the agency to which the releases listed belong. For example, '18F' or 'Navy'."
"description": "The organization or component within the agency to which the releases listed belong.",
"enum": [
"Centers for Medicare & Medicaid Services"
]
},
"repositoryURL": {
"type": "string",
Expand Down Expand Up @@ -231,8 +233,11 @@
]
},
"contractNumber": {
"type": "string",
"description": "Contract number"
"type": "array",
"description": "Contract number(s) under which the project was developed",
"items": {
"type": "string"
}
},
"date": {
"type": "object",
Expand Down Expand Up @@ -277,12 +282,14 @@
}
}
},
"feedbackMechanisms": {
"type": "array",
"description": "Methods a repository receives feedback from the community. Default value is the URL to GitHub repository issues page.",
"items": {
"type": "string"
}
"feedbackMechanism": {
"type": "string",
"format": "uri",
"description": "Method a repository receives feedback from the community (i.e. URL to GitHub repository issues page)"
},
"AIUseCaseID": {
"type": "string",
"description": "The software's ID in the AI Use Case Inventory. If the software is not currently listed in the inventory, enter '0'."
},
"localisation": {
"type": "boolean",
Expand Down Expand Up @@ -372,10 +379,6 @@
4
],
"description": "Maturity model tier according to the CMS Open Source Repository Maturity Model Framework: https://github.com/DSACMS/repo-scaffolder/blob/main/maturity-model-tiers.md"
},
"AIUseCaseInventory": {
"type": "boolean",
"description": "Is the software included in the agency's AI use case inventory?"
}
},
"required": [
Expand All @@ -400,7 +403,8 @@
"date",
"tags",
"contact",
"feedbackMechanisms",
"feedbackMechanism",
"AIUseCaseID",
"localisation",
"repositoryType",
"userInput",
Expand All @@ -409,8 +413,7 @@
"projects",
"subsetInHealthcare",
"userType",
"maturityModelTier",
"AIUseCaseInventory"
"maturityModelTier"
],
"additionalProperties": false
}
}
23 changes: 15 additions & 8 deletions schemas/gov/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"openSource",
"governmentWideReuse",
"exemptByNationalSecurity",
"exemptByIntelligence",
"exemptByNationalIntelligence",
"exemptByFOIA",
"exemptByEAR",
"exemptByITAR",
Expand Down Expand Up @@ -151,6 +151,13 @@
},
"additionalProperties": true
},
"languages": {
"type": "array",
"description": "Programming languages that make up the codebase",
"items": {
"type": "string"
}
},
"maintenance": {
"type": "string",
"description": "The dedicated staff that keeps the software up-to-date, if any",
Expand Down Expand Up @@ -211,14 +218,14 @@
}
}
},
"feedbackMechanisms": {
"feedbackMechanism": {
"type": "string",
"format": "uri",
"description": "Method a repository receives feedback from the community (i.e. URL to GitHub repository issues page)"
},
"AIUseCaseInventory": {
"type": "boolean",
"description": "Is the software included in the agency's AI use case inventory?"
"AIUseCaseID": {
"type": "string",
"description": "The software's ID in the AI Use Case Inventory. If the software is not currently listed in the inventory, enter '0'."
}
},
"required": [
Expand All @@ -238,8 +245,8 @@
"date",
"tags",
"contact",
"feedbackMechanisms",
"AIUseCaseInventory"
"feedbackMechanism",
"AIUseCaseID"
],
"additionalProperties": false
"additionalProperties": true
}
Loading