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/js/formDataToJson.js b/js/formDataToJson.js index a330e22..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; @@ -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)); } 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 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