From 075f9f78941be8ec7b8fddd3057ead4fdf9ad2fe Mon Sep 17 00:00:00 2001 From: Natalia Luzuriaga Date: Tue, 19 Aug 2025 15:57:52 -0700 Subject: [PATCH 1/4] Added functionality to not include blank optional fields in output Signed-off-by: Natalia Luzuriaga --- js/formDataToJson.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/formDataToJson.js b/js/formDataToJson.js index a330e22..0056362 100644 --- a/js/formDataToJson.js +++ b/js/formDataToJson.js @@ -45,6 +45,11 @@ 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); From 13e94f08f826474350d6bca5927312b9506ba335 Mon Sep 17 00:00:00 2001 From: Natalia Luzuriaga Date: Tue, 19 Aug 2025 16:00:17 -0700 Subject: [PATCH 2/4] Update gov schema Signed-off-by: Natalia Luzuriaga --- schemas/gov/schema.json | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/schemas/gov/schema.json b/schemas/gov/schema.json index 2c451c7..a01e16b 100644 --- a/schemas/gov/schema.json +++ b/schemas/gov/schema.json @@ -75,7 +75,7 @@ "openSource", "governmentWideReuse", "exemptByNationalSecurity", - "exemptByIntelligence", + "exemptByNationalIntelligence", "exemptByFOIA", "exemptByEAR", "exemptByITAR", @@ -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", @@ -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": [ @@ -238,8 +245,8 @@ "date", "tags", "contact", - "feedbackMechanisms", - "AIUseCaseInventory" + "feedbackMechanism", + "AIUseCaseID" ], - "additionalProperties": false + "additionalProperties": true } \ No newline at end of file From 5c1892b35c92aba6b7b7c07e4616744168af8681 Mon Sep 17 00:00:00 2001 From: Natalia Luzuriaga Date: Tue, 19 Aug 2025 16:20:13 -0700 Subject: [PATCH 3/4] Update CMS schema to latest and adjusted form component rendering accordingly Signed-off-by: Natalia Luzuriaga --- js/autoGenerateFields.js | 2 +- schemas/cms/schema.json | 43 +++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/js/autoGenerateFields.js b/js/autoGenerateFields.js index 0c176b8..72a9bcc 100644 --- a/js/autoGenerateFields.js +++ b/js/autoGenerateFields.js @@ -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" diff --git a/schemas/cms/schema.json b/schemas/cms/schema.json index 8d7bbad..9b9e036 100644 --- a/schemas/cms/schema.json +++ b/schemas/cms/schema.json @@ -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", @@ -82,7 +81,7 @@ "openSource", "governmentWideReuse", "exemptByNationalSecurity", - "exemptByIntelligence", + "exemptByNationalIntelligence", "exemptByFOIA", "exemptByEAR", "exemptByITAR", @@ -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", @@ -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", @@ -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", @@ -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": [ @@ -400,7 +403,8 @@ "date", "tags", "contact", - "feedbackMechanisms", + "feedbackMechanism", + "AIUseCaseID", "localisation", "repositoryType", "userInput", @@ -409,8 +413,7 @@ "projects", "subsetInHealthcare", "userType", - "maturityModelTier", - "AIUseCaseInventory" + "maturityModelTier" ], "additionalProperties": false -} +} \ No newline at end of file From 2a34a4d13f8ac90a6abebf4227189e21f753af7a Mon Sep 17 00:00:00 2001 From: Natalia Luzuriaga Date: Tue, 19 Aug 2025 16:20:49 -0700 Subject: [PATCH 4/4] Added a check for an array for handling multi-field objects Signed-off-by: Natalia Luzuriaga --- js/formDataToJson.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/formDataToJson.js b/js/formDataToJson.js index 0056362..cc928cd 100644 --- a/js/formDataToJson.js +++ b/js/formDataToJson.js @@ -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; @@ -55,7 +54,7 @@ function populateObject(data, fields) { 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)); }